diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto new file mode 100644 index 00000000000..6af26ee880d --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto @@ -0,0 +1,1037 @@ +// Copyright 2022 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 +// +// http://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. + +syntax = "proto3"; + +package google.cloud.functions.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v2;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2.Function" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2.Function" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // Describe whether the function is gen1 or gen2. + Environment environment = 10; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Output only. The Cloud Build name of the latest successful deployment of the + // function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Optional. User managed repository created in Artifact Registry optionally with a + // customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "run.googleapis.com/Service" + } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this field is + // `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + } + ]; + + // Optional. The email of the trigger's service account. The service account must have + // permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. When listing functions in all locations, if one or more + // location(s) are unreachable, the response will contain functions from all + // reachable locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, specified + // in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed URL + // should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage signed + // URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be listed, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index e2e45ccb285..d4641902871 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -2696,6 +2696,3342 @@ export namespace google { } } + /** Namespace v2. */ + namespace v2 { + + /** Represents a FunctionService */ + class FunctionService extends $protobuf.rpc.Service { + + /** + * Constructs a new FunctionService 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 FunctionService 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): FunctionService; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Function + */ + public getFunction(request: google.cloud.functions.v2.IGetFunctionRequest, callback: google.cloud.functions.v2.FunctionService.GetFunctionCallback): void; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @returns Promise + */ + public getFunction(request: google.cloud.functions.v2.IGetFunctionRequest): Promise; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFunctionsResponse + */ + public listFunctions(request: google.cloud.functions.v2.IListFunctionsRequest, callback: google.cloud.functions.v2.FunctionService.ListFunctionsCallback): void; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @returns Promise + */ + public listFunctions(request: google.cloud.functions.v2.IListFunctionsRequest): Promise; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createFunction(request: google.cloud.functions.v2.ICreateFunctionRequest, callback: google.cloud.functions.v2.FunctionService.CreateFunctionCallback): void; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @returns Promise + */ + public createFunction(request: google.cloud.functions.v2.ICreateFunctionRequest): Promise; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateFunction(request: google.cloud.functions.v2.IUpdateFunctionRequest, callback: google.cloud.functions.v2.FunctionService.UpdateFunctionCallback): void; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @returns Promise + */ + public updateFunction(request: google.cloud.functions.v2.IUpdateFunctionRequest): Promise; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteFunction(request: google.cloud.functions.v2.IDeleteFunctionRequest, callback: google.cloud.functions.v2.FunctionService.DeleteFunctionCallback): void; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @returns Promise + */ + public deleteFunction(request: google.cloud.functions.v2.IDeleteFunctionRequest): Promise; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + */ + public generateUploadUrl(request: google.cloud.functions.v2.IGenerateUploadUrlRequest, callback: google.cloud.functions.v2.FunctionService.GenerateUploadUrlCallback): void; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @returns Promise + */ + public generateUploadUrl(request: google.cloud.functions.v2.IGenerateUploadUrlRequest): Promise; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + */ + public generateDownloadUrl(request: google.cloud.functions.v2.IGenerateDownloadUrlRequest, callback: google.cloud.functions.v2.FunctionService.GenerateDownloadUrlCallback): void; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @returns Promise + */ + public generateDownloadUrl(request: google.cloud.functions.v2.IGenerateDownloadUrlRequest): Promise; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRuntimesResponse + */ + public listRuntimes(request: google.cloud.functions.v2.IListRuntimesRequest, callback: google.cloud.functions.v2.FunctionService.ListRuntimesCallback): void; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @returns Promise + */ + public listRuntimes(request: google.cloud.functions.v2.IListRuntimesRequest): Promise; + } + + namespace FunctionService { + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#getFunction}. + * @param error Error, if any + * @param [response] Function + */ + type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2.Function) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listFunctions}. + * @param error Error, if any + * @param [response] ListFunctionsResponse + */ + type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2.ListFunctionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#createFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#updateFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#deleteFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateUploadUrl}. + * @param error Error, if any + * @param [response] GenerateUploadUrlResponse + */ + type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2.GenerateUploadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateDownloadUrl}. + * @param error Error, if any + * @param [response] GenerateDownloadUrlResponse + */ + type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2.GenerateDownloadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listRuntimes}. + * @param error Error, if any + * @param [response] ListRuntimesResponse + */ + type ListRuntimesCallback = (error: (Error|null), response?: google.cloud.functions.v2.ListRuntimesResponse) => void; + } + + /** Environment enum. */ + enum Environment { + ENVIRONMENT_UNSPECIFIED = 0, + GEN_1 = 1, + GEN_2 = 2 + } + + /** Properties of a Function. */ + interface IFunction { + + /** Function name */ + name?: (string|null); + + /** Function environment */ + environment?: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment|null); + + /** Function description */ + description?: (string|null); + + /** Function buildConfig */ + buildConfig?: (google.cloud.functions.v2.IBuildConfig|null); + + /** Function serviceConfig */ + serviceConfig?: (google.cloud.functions.v2.IServiceConfig|null); + + /** Function eventTrigger */ + eventTrigger?: (google.cloud.functions.v2.IEventTrigger|null); + + /** Function state */ + state?: (google.cloud.functions.v2.Function.State|keyof typeof google.cloud.functions.v2.Function.State|null); + + /** Function updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels */ + labels?: ({ [k: string]: string }|null); + + /** Function stateMessages */ + stateMessages?: (google.cloud.functions.v2.IStateMessage[]|null); + } + + /** Represents a Function. */ + class Function implements IFunction { + + /** + * Constructs a new Function. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IFunction); + + /** Function name. */ + public name: string; + + /** Function environment. */ + public environment: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment); + + /** Function description. */ + public description: string; + + /** Function buildConfig. */ + public buildConfig?: (google.cloud.functions.v2.IBuildConfig|null); + + /** Function serviceConfig. */ + public serviceConfig?: (google.cloud.functions.v2.IServiceConfig|null); + + /** Function eventTrigger. */ + public eventTrigger?: (google.cloud.functions.v2.IEventTrigger|null); + + /** Function state. */ + public state: (google.cloud.functions.v2.Function.State|keyof typeof google.cloud.functions.v2.Function.State); + + /** Function updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels. */ + public labels: { [k: string]: string }; + + /** Function stateMessages. */ + public stateMessages: google.cloud.functions.v2.IStateMessage[]; + + /** + * Creates a new Function instance using the specified properties. + * @param [properties] Properties to set + * @returns Function instance + */ + public static create(properties?: google.cloud.functions.v2.IFunction): google.cloud.functions.v2.Function; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Function message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Function + * @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.functions.v2.Function; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Function + * @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.functions.v2.Function; + + /** + * Verifies a Function 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 Function message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Function + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.Function; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @param message Function + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.Function, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Function to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Function { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + FAILED = 2, + DEPLOYING = 3, + DELETING = 4, + UNKNOWN = 5 + } + } + + /** Properties of a StateMessage. */ + interface IStateMessage { + + /** StateMessage severity */ + severity?: (google.cloud.functions.v2.StateMessage.Severity|keyof typeof google.cloud.functions.v2.StateMessage.Severity|null); + + /** StateMessage type */ + type?: (string|null); + + /** StateMessage message */ + message?: (string|null); + } + + /** Represents a StateMessage. */ + class StateMessage implements IStateMessage { + + /** + * Constructs a new StateMessage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IStateMessage); + + /** StateMessage severity. */ + public severity: (google.cloud.functions.v2.StateMessage.Severity|keyof typeof google.cloud.functions.v2.StateMessage.Severity); + + /** StateMessage type. */ + public type: string; + + /** StateMessage message. */ + public message: string; + + /** + * Creates a new StateMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns StateMessage instance + */ + public static create(properties?: google.cloud.functions.v2.IStateMessage): google.cloud.functions.v2.StateMessage; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StateMessage + * @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.functions.v2.StateMessage; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StateMessage + * @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.functions.v2.StateMessage; + + /** + * Verifies a StateMessage 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 StateMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StateMessage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.StateMessage; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @param message StateMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.StateMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StateMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace StateMessage { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + ERROR = 1, + WARNING = 2, + INFO = 3 + } + } + + /** Properties of a StorageSource. */ + interface IStorageSource { + + /** StorageSource bucket */ + bucket?: (string|null); + + /** StorageSource object */ + object?: (string|null); + + /** StorageSource generation */ + generation?: (number|Long|string|null); + } + + /** Represents a StorageSource. */ + class StorageSource implements IStorageSource { + + /** + * Constructs a new StorageSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IStorageSource); + + /** StorageSource bucket. */ + public bucket: string; + + /** StorageSource object. */ + public object: string; + + /** StorageSource generation. */ + public generation: (number|Long|string); + + /** + * Creates a new StorageSource instance using the specified properties. + * @param [properties] Properties to set + * @returns StorageSource instance + */ + public static create(properties?: google.cloud.functions.v2.IStorageSource): google.cloud.functions.v2.StorageSource; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StorageSource + * @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.functions.v2.StorageSource; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StorageSource + * @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.functions.v2.StorageSource; + + /** + * Verifies a StorageSource 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 StorageSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StorageSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.StorageSource; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @param message StorageSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.StorageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StorageSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RepoSource. */ + interface IRepoSource { + + /** RepoSource branchName */ + branchName?: (string|null); + + /** RepoSource tagName */ + tagName?: (string|null); + + /** RepoSource commitSha */ + commitSha?: (string|null); + + /** RepoSource projectId */ + projectId?: (string|null); + + /** RepoSource repoName */ + repoName?: (string|null); + + /** RepoSource dir */ + dir?: (string|null); + + /** RepoSource invertRegex */ + invertRegex?: (boolean|null); + } + + /** Represents a RepoSource. */ + class RepoSource implements IRepoSource { + + /** + * Constructs a new RepoSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IRepoSource); + + /** RepoSource branchName. */ + public branchName?: (string|null); + + /** RepoSource tagName. */ + public tagName?: (string|null); + + /** RepoSource commitSha. */ + public commitSha?: (string|null); + + /** RepoSource projectId. */ + public projectId: string; + + /** RepoSource repoName. */ + public repoName: string; + + /** RepoSource dir. */ + public dir: string; + + /** RepoSource invertRegex. */ + public invertRegex: boolean; + + /** RepoSource revision. */ + public revision?: ("branchName"|"tagName"|"commitSha"); + + /** + * Creates a new RepoSource instance using the specified properties. + * @param [properties] Properties to set + * @returns RepoSource instance + */ + public static create(properties?: google.cloud.functions.v2.IRepoSource): google.cloud.functions.v2.RepoSource; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RepoSource + * @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.functions.v2.RepoSource; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RepoSource + * @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.functions.v2.RepoSource; + + /** + * Verifies a RepoSource 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 RepoSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RepoSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.RepoSource; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @param message RepoSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.RepoSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RepoSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Source. */ + interface ISource { + + /** Source storageSource */ + storageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** Source repoSource */ + repoSource?: (google.cloud.functions.v2.IRepoSource|null); + } + + /** Represents a Source. */ + class Source implements ISource { + + /** + * Constructs a new Source. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISource); + + /** Source storageSource. */ + public storageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** Source repoSource. */ + public repoSource?: (google.cloud.functions.v2.IRepoSource|null); + + /** Source source. */ + public source?: ("storageSource"|"repoSource"); + + /** + * Creates a new Source instance using the specified properties. + * @param [properties] Properties to set + * @returns Source instance + */ + public static create(properties?: google.cloud.functions.v2.ISource): google.cloud.functions.v2.Source; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Source message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Source + * @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.functions.v2.Source; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Source + * @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.functions.v2.Source; + + /** + * Verifies a Source 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 Source message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Source + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.Source; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @param message Source + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.Source, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Source to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SourceProvenance. */ + interface ISourceProvenance { + + /** SourceProvenance resolvedStorageSource */ + resolvedStorageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource */ + resolvedRepoSource?: (google.cloud.functions.v2.IRepoSource|null); + } + + /** Represents a SourceProvenance. */ + class SourceProvenance implements ISourceProvenance { + + /** + * Constructs a new SourceProvenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISourceProvenance); + + /** SourceProvenance resolvedStorageSource. */ + public resolvedStorageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource. */ + public resolvedRepoSource?: (google.cloud.functions.v2.IRepoSource|null); + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceProvenance instance + */ + public static create(properties?: google.cloud.functions.v2.ISourceProvenance): google.cloud.functions.v2.SourceProvenance; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceProvenance + * @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.functions.v2.SourceProvenance; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceProvenance + * @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.functions.v2.SourceProvenance; + + /** + * Verifies a SourceProvenance 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 SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceProvenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SourceProvenance; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @param message SourceProvenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SourceProvenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceProvenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BuildConfig. */ + interface IBuildConfig { + + /** BuildConfig build */ + build?: (string|null); + + /** BuildConfig runtime */ + runtime?: (string|null); + + /** BuildConfig entryPoint */ + entryPoint?: (string|null); + + /** BuildConfig source */ + source?: (google.cloud.functions.v2.ISource|null); + + /** BuildConfig sourceProvenance */ + sourceProvenance?: (google.cloud.functions.v2.ISourceProvenance|null); + + /** BuildConfig workerPool */ + workerPool?: (string|null); + + /** BuildConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** BuildConfig dockerRepository */ + dockerRepository?: (string|null); + } + + /** Represents a BuildConfig. */ + class BuildConfig implements IBuildConfig { + + /** + * Constructs a new BuildConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IBuildConfig); + + /** BuildConfig build. */ + public build: string; + + /** BuildConfig runtime. */ + public runtime: string; + + /** BuildConfig entryPoint. */ + public entryPoint: string; + + /** BuildConfig source. */ + public source?: (google.cloud.functions.v2.ISource|null); + + /** BuildConfig sourceProvenance. */ + public sourceProvenance?: (google.cloud.functions.v2.ISourceProvenance|null); + + /** BuildConfig workerPool. */ + public workerPool: string; + + /** BuildConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** BuildConfig dockerRepository. */ + public dockerRepository: string; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BuildConfig instance + */ + public static create(properties?: google.cloud.functions.v2.IBuildConfig): google.cloud.functions.v2.BuildConfig; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BuildConfig + * @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.functions.v2.BuildConfig; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BuildConfig + * @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.functions.v2.BuildConfig; + + /** + * Verifies a BuildConfig 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 BuildConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BuildConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.BuildConfig; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @param message BuildConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.BuildConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BuildConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceConfig. */ + interface IServiceConfig { + + /** ServiceConfig service */ + service?: (string|null); + + /** ServiceConfig timeoutSeconds */ + timeoutSeconds?: (number|null); + + /** ServiceConfig availableMemory */ + availableMemory?: (string|null); + + /** ServiceConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** ServiceConfig maxInstanceCount */ + maxInstanceCount?: (number|null); + + /** ServiceConfig minInstanceCount */ + minInstanceCount?: (number|null); + + /** ServiceConfig vpcConnector */ + vpcConnector?: (string|null); + + /** ServiceConfig vpcConnectorEgressSettings */ + vpcConnectorEgressSettings?: (google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|null); + + /** ServiceConfig ingressSettings */ + ingressSettings?: (google.cloud.functions.v2.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.IngressSettings|null); + + /** ServiceConfig uri */ + uri?: (string|null); + + /** ServiceConfig serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** ServiceConfig allTrafficOnLatestRevision */ + allTrafficOnLatestRevision?: (boolean|null); + + /** ServiceConfig secretEnvironmentVariables */ + secretEnvironmentVariables?: (google.cloud.functions.v2.ISecretEnvVar[]|null); + + /** ServiceConfig secretVolumes */ + secretVolumes?: (google.cloud.functions.v2.ISecretVolume[]|null); + + /** ServiceConfig revision */ + revision?: (string|null); + } + + /** Represents a ServiceConfig. */ + class ServiceConfig implements IServiceConfig { + + /** + * Constructs a new ServiceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IServiceConfig); + + /** ServiceConfig service. */ + public service: string; + + /** ServiceConfig timeoutSeconds. */ + public timeoutSeconds: number; + + /** ServiceConfig availableMemory. */ + public availableMemory: string; + + /** ServiceConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** ServiceConfig maxInstanceCount. */ + public maxInstanceCount: number; + + /** ServiceConfig minInstanceCount. */ + public minInstanceCount: number; + + /** ServiceConfig vpcConnector. */ + public vpcConnector: string; + + /** ServiceConfig vpcConnectorEgressSettings. */ + public vpcConnectorEgressSettings: (google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings); + + /** ServiceConfig ingressSettings. */ + public ingressSettings: (google.cloud.functions.v2.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.IngressSettings); + + /** ServiceConfig uri. */ + public uri: string; + + /** ServiceConfig serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** ServiceConfig allTrafficOnLatestRevision. */ + public allTrafficOnLatestRevision: boolean; + + /** ServiceConfig secretEnvironmentVariables. */ + public secretEnvironmentVariables: google.cloud.functions.v2.ISecretEnvVar[]; + + /** ServiceConfig secretVolumes. */ + public secretVolumes: google.cloud.functions.v2.ISecretVolume[]; + + /** ServiceConfig revision. */ + public revision: string; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceConfig instance + */ + public static create(properties?: google.cloud.functions.v2.IServiceConfig): google.cloud.functions.v2.ServiceConfig; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceConfig + * @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.functions.v2.ServiceConfig; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceConfig + * @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.functions.v2.ServiceConfig; + + /** + * Verifies a ServiceConfig 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 ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ServiceConfig; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @param message ServiceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ServiceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ServiceConfig { + + /** VpcConnectorEgressSettings enum. */ + enum VpcConnectorEgressSettings { + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0, + PRIVATE_RANGES_ONLY = 1, + ALL_TRAFFIC = 2 + } + + /** IngressSettings enum. */ + enum IngressSettings { + INGRESS_SETTINGS_UNSPECIFIED = 0, + ALLOW_ALL = 1, + ALLOW_INTERNAL_ONLY = 2, + ALLOW_INTERNAL_AND_GCLB = 3 + } + } + + /** Properties of a SecretEnvVar. */ + interface ISecretEnvVar { + + /** SecretEnvVar key */ + key?: (string|null); + + /** SecretEnvVar projectId */ + projectId?: (string|null); + + /** SecretEnvVar secret */ + secret?: (string|null); + + /** SecretEnvVar version */ + version?: (string|null); + } + + /** Represents a SecretEnvVar. */ + class SecretEnvVar implements ISecretEnvVar { + + /** + * Constructs a new SecretEnvVar. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISecretEnvVar); + + /** SecretEnvVar key. */ + public key: string; + + /** SecretEnvVar projectId. */ + public projectId: string; + + /** SecretEnvVar secret. */ + public secret: string; + + /** SecretEnvVar version. */ + public version: string; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretEnvVar instance + */ + public static create(properties?: google.cloud.functions.v2.ISecretEnvVar): google.cloud.functions.v2.SecretEnvVar; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretEnvVar + * @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.functions.v2.SecretEnvVar; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretEnvVar + * @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.functions.v2.SecretEnvVar; + + /** + * Verifies a SecretEnvVar 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 SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretEnvVar + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SecretEnvVar; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @param message SecretEnvVar + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SecretEnvVar, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretEnvVar to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SecretVolume. */ + interface ISecretVolume { + + /** SecretVolume mountPath */ + mountPath?: (string|null); + + /** SecretVolume projectId */ + projectId?: (string|null); + + /** SecretVolume secret */ + secret?: (string|null); + + /** SecretVolume versions */ + versions?: (google.cloud.functions.v2.SecretVolume.ISecretVersion[]|null); + } + + /** Represents a SecretVolume. */ + class SecretVolume implements ISecretVolume { + + /** + * Constructs a new SecretVolume. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISecretVolume); + + /** SecretVolume mountPath. */ + public mountPath: string; + + /** SecretVolume projectId. */ + public projectId: string; + + /** SecretVolume secret. */ + public secret: string; + + /** SecretVolume versions. */ + public versions: google.cloud.functions.v2.SecretVolume.ISecretVersion[]; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVolume instance + */ + public static create(properties?: google.cloud.functions.v2.ISecretVolume): google.cloud.functions.v2.SecretVolume; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVolume + * @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.functions.v2.SecretVolume; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVolume + * @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.functions.v2.SecretVolume; + + /** + * Verifies a SecretVolume 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 SecretVolume message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVolume + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SecretVolume; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @param message SecretVolume + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SecretVolume, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVolume to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SecretVolume { + + /** Properties of a SecretVersion. */ + interface ISecretVersion { + + /** SecretVersion version */ + version?: (string|null); + + /** SecretVersion path */ + path?: (string|null); + } + + /** Represents a SecretVersion. */ + class SecretVersion implements ISecretVersion { + + /** + * Constructs a new SecretVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.SecretVolume.ISecretVersion); + + /** SecretVersion version. */ + public version: string; + + /** SecretVersion path. */ + public path: string; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVersion instance + */ + public static create(properties?: google.cloud.functions.v2.SecretVolume.ISecretVersion): google.cloud.functions.v2.SecretVolume.SecretVersion; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVersion + * @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.functions.v2.SecretVolume.SecretVersion; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVersion + * @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.functions.v2.SecretVolume.SecretVersion; + + /** + * Verifies a SecretVersion 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 SecretVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SecretVolume.SecretVersion; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @param message SecretVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SecretVolume.SecretVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EventTrigger. */ + interface IEventTrigger { + + /** EventTrigger trigger */ + trigger?: (string|null); + + /** EventTrigger triggerRegion */ + triggerRegion?: (string|null); + + /** EventTrigger eventType */ + eventType?: (string|null); + + /** EventTrigger eventFilters */ + eventFilters?: (google.cloud.functions.v2.IEventFilter[]|null); + + /** EventTrigger pubsubTopic */ + pubsubTopic?: (string|null); + + /** EventTrigger serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** EventTrigger retryPolicy */ + retryPolicy?: (google.cloud.functions.v2.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2.EventTrigger.RetryPolicy|null); + + /** EventTrigger channel */ + channel?: (string|null); + } + + /** Represents an EventTrigger. */ + class EventTrigger implements IEventTrigger { + + /** + * Constructs a new EventTrigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IEventTrigger); + + /** EventTrigger trigger. */ + public trigger: string; + + /** EventTrigger triggerRegion. */ + public triggerRegion: string; + + /** EventTrigger eventType. */ + public eventType: string; + + /** EventTrigger eventFilters. */ + public eventFilters: google.cloud.functions.v2.IEventFilter[]; + + /** EventTrigger pubsubTopic. */ + public pubsubTopic: string; + + /** EventTrigger serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** EventTrigger retryPolicy. */ + public retryPolicy: (google.cloud.functions.v2.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2.EventTrigger.RetryPolicy); + + /** EventTrigger channel. */ + public channel: string; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @param [properties] Properties to set + * @returns EventTrigger instance + */ + public static create(properties?: google.cloud.functions.v2.IEventTrigger): google.cloud.functions.v2.EventTrigger; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventTrigger + * @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.functions.v2.EventTrigger; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventTrigger + * @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.functions.v2.EventTrigger; + + /** + * Verifies an EventTrigger 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 EventTrigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventTrigger + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.EventTrigger; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @param message EventTrigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.EventTrigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventTrigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EventTrigger { + + /** RetryPolicy enum. */ + enum RetryPolicy { + RETRY_POLICY_UNSPECIFIED = 0, + RETRY_POLICY_DO_NOT_RETRY = 1, + RETRY_POLICY_RETRY = 2 + } + } + + /** Properties of an EventFilter. */ + interface IEventFilter { + + /** EventFilter attribute */ + attribute?: (string|null); + + /** EventFilter value */ + value?: (string|null); + + /** EventFilter operator */ + operator?: (string|null); + } + + /** Represents an EventFilter. */ + class EventFilter implements IEventFilter { + + /** + * Constructs a new EventFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IEventFilter); + + /** EventFilter attribute. */ + public attribute: string; + + /** EventFilter value. */ + public value: string; + + /** EventFilter operator. */ + public operator: string; + + /** + * Creates a new EventFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns EventFilter instance + */ + public static create(properties?: google.cloud.functions.v2.IEventFilter): google.cloud.functions.v2.EventFilter; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventFilter + * @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.functions.v2.EventFilter; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventFilter + * @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.functions.v2.EventFilter; + + /** + * Verifies an EventFilter 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 EventFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventFilter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.EventFilter; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @param message EventFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.EventFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetFunctionRequest. */ + interface IGetFunctionRequest { + + /** GetFunctionRequest name */ + name?: (string|null); + } + + /** Represents a GetFunctionRequest. */ + class GetFunctionRequest implements IGetFunctionRequest { + + /** + * Constructs a new GetFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGetFunctionRequest); + + /** GetFunctionRequest name. */ + public name: string; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IGetFunctionRequest): google.cloud.functions.v2.GetFunctionRequest; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFunctionRequest + * @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.functions.v2.GetFunctionRequest; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFunctionRequest + * @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.functions.v2.GetFunctionRequest; + + /** + * Verifies a GetFunctionRequest 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 GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GetFunctionRequest; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @param message GetFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GetFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsRequest. */ + interface IListFunctionsRequest { + + /** ListFunctionsRequest parent */ + parent?: (string|null); + + /** ListFunctionsRequest pageSize */ + pageSize?: (number|null); + + /** ListFunctionsRequest pageToken */ + pageToken?: (string|null); + + /** ListFunctionsRequest filter */ + filter?: (string|null); + + /** ListFunctionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListFunctionsRequest. */ + class ListFunctionsRequest implements IListFunctionsRequest { + + /** + * Constructs a new ListFunctionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListFunctionsRequest); + + /** ListFunctionsRequest parent. */ + public parent: string; + + /** ListFunctionsRequest pageSize. */ + public pageSize: number; + + /** ListFunctionsRequest pageToken. */ + public pageToken: string; + + /** ListFunctionsRequest filter. */ + public filter: string; + + /** ListFunctionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IListFunctionsRequest): google.cloud.functions.v2.ListFunctionsRequest; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsRequest + * @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.functions.v2.ListFunctionsRequest; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsRequest + * @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.functions.v2.ListFunctionsRequest; + + /** + * Verifies a ListFunctionsRequest 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 ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListFunctionsRequest; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @param message ListFunctionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListFunctionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsResponse. */ + interface IListFunctionsResponse { + + /** ListFunctionsResponse functions */ + functions?: (google.cloud.functions.v2.IFunction[]|null); + + /** ListFunctionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListFunctionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListFunctionsResponse. */ + class ListFunctionsResponse implements IListFunctionsResponse { + + /** + * Constructs a new ListFunctionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListFunctionsResponse); + + /** ListFunctionsResponse functions. */ + public functions: google.cloud.functions.v2.IFunction[]; + + /** ListFunctionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListFunctionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IListFunctionsResponse): google.cloud.functions.v2.ListFunctionsResponse; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsResponse + * @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.functions.v2.ListFunctionsResponse; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsResponse + * @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.functions.v2.ListFunctionsResponse; + + /** + * Verifies a ListFunctionsResponse 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 ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListFunctionsResponse; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @param message ListFunctionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListFunctionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateFunctionRequest. */ + interface ICreateFunctionRequest { + + /** CreateFunctionRequest parent */ + parent?: (string|null); + + /** CreateFunctionRequest function */ + "function"?: (google.cloud.functions.v2.IFunction|null); + + /** CreateFunctionRequest functionId */ + functionId?: (string|null); + } + + /** Represents a CreateFunctionRequest. */ + class CreateFunctionRequest implements ICreateFunctionRequest { + + /** + * Constructs a new CreateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ICreateFunctionRequest); + + /** CreateFunctionRequest parent. */ + public parent: string; + + /** CreateFunctionRequest function. */ + public function?: (google.cloud.functions.v2.IFunction|null); + + /** CreateFunctionRequest functionId. */ + public functionId: string; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.ICreateFunctionRequest): google.cloud.functions.v2.CreateFunctionRequest; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateFunctionRequest + * @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.functions.v2.CreateFunctionRequest; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateFunctionRequest + * @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.functions.v2.CreateFunctionRequest; + + /** + * Verifies a CreateFunctionRequest 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 CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.CreateFunctionRequest; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @param message CreateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.CreateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateFunctionRequest. */ + interface IUpdateFunctionRequest { + + /** UpdateFunctionRequest function */ + "function"?: (google.cloud.functions.v2.IFunction|null); + + /** UpdateFunctionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFunctionRequest. */ + class UpdateFunctionRequest implements IUpdateFunctionRequest { + + /** + * Constructs a new UpdateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IUpdateFunctionRequest); + + /** UpdateFunctionRequest function. */ + public function?: (google.cloud.functions.v2.IFunction|null); + + /** UpdateFunctionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IUpdateFunctionRequest): google.cloud.functions.v2.UpdateFunctionRequest; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFunctionRequest + * @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.functions.v2.UpdateFunctionRequest; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFunctionRequest + * @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.functions.v2.UpdateFunctionRequest; + + /** + * Verifies an UpdateFunctionRequest 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 UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.UpdateFunctionRequest; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @param message UpdateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.UpdateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteFunctionRequest. */ + interface IDeleteFunctionRequest { + + /** DeleteFunctionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteFunctionRequest. */ + class DeleteFunctionRequest implements IDeleteFunctionRequest { + + /** + * Constructs a new DeleteFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IDeleteFunctionRequest); + + /** DeleteFunctionRequest name. */ + public name: string; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IDeleteFunctionRequest): google.cloud.functions.v2.DeleteFunctionRequest; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteFunctionRequest + * @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.functions.v2.DeleteFunctionRequest; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteFunctionRequest + * @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.functions.v2.DeleteFunctionRequest; + + /** + * Verifies a DeleteFunctionRequest 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 DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.DeleteFunctionRequest; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @param message DeleteFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.DeleteFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlRequest. */ + interface IGenerateUploadUrlRequest { + + /** GenerateUploadUrlRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateUploadUrlRequest. */ + class GenerateUploadUrlRequest implements IGenerateUploadUrlRequest { + + /** + * Constructs a new GenerateUploadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateUploadUrlRequest); + + /** GenerateUploadUrlRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateUploadUrlRequest): google.cloud.functions.v2.GenerateUploadUrlRequest; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlRequest + * @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.functions.v2.GenerateUploadUrlRequest; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlRequest + * @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.functions.v2.GenerateUploadUrlRequest; + + /** + * Verifies a GenerateUploadUrlRequest 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 GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateUploadUrlRequest; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateUploadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateUploadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlResponse. */ + interface IGenerateUploadUrlResponse { + + /** GenerateUploadUrlResponse uploadUrl */ + uploadUrl?: (string|null); + + /** GenerateUploadUrlResponse storageSource */ + storageSource?: (google.cloud.functions.v2.IStorageSource|null); + } + + /** Represents a GenerateUploadUrlResponse. */ + class GenerateUploadUrlResponse implements IGenerateUploadUrlResponse { + + /** + * Constructs a new GenerateUploadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateUploadUrlResponse); + + /** GenerateUploadUrlResponse uploadUrl. */ + public uploadUrl: string; + + /** GenerateUploadUrlResponse storageSource. */ + public storageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateUploadUrlResponse): google.cloud.functions.v2.GenerateUploadUrlResponse; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlResponse + * @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.functions.v2.GenerateUploadUrlResponse; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlResponse + * @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.functions.v2.GenerateUploadUrlResponse; + + /** + * Verifies a GenerateUploadUrlResponse 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 GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateUploadUrlResponse; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateUploadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateUploadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlRequest. */ + interface IGenerateDownloadUrlRequest { + + /** GenerateDownloadUrlRequest name */ + name?: (string|null); + } + + /** Represents a GenerateDownloadUrlRequest. */ + class GenerateDownloadUrlRequest implements IGenerateDownloadUrlRequest { + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateDownloadUrlRequest); + + /** GenerateDownloadUrlRequest name. */ + public name: string; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateDownloadUrlRequest): google.cloud.functions.v2.GenerateDownloadUrlRequest; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlRequest + * @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.functions.v2.GenerateDownloadUrlRequest; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlRequest + * @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.functions.v2.GenerateDownloadUrlRequest; + + /** + * Verifies a GenerateDownloadUrlRequest 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 GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateDownloadUrlRequest; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateDownloadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlResponse. */ + interface IGenerateDownloadUrlResponse { + + /** GenerateDownloadUrlResponse downloadUrl */ + downloadUrl?: (string|null); + } + + /** Represents a GenerateDownloadUrlResponse. */ + class GenerateDownloadUrlResponse implements IGenerateDownloadUrlResponse { + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateDownloadUrlResponse); + + /** GenerateDownloadUrlResponse downloadUrl. */ + public downloadUrl: string; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateDownloadUrlResponse): google.cloud.functions.v2.GenerateDownloadUrlResponse; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlResponse + * @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.functions.v2.GenerateDownloadUrlResponse; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlResponse + * @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.functions.v2.GenerateDownloadUrlResponse; + + /** + * Verifies a GenerateDownloadUrlResponse 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 GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateDownloadUrlResponse; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateDownloadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesRequest. */ + interface IListRuntimesRequest { + + /** ListRuntimesRequest parent */ + parent?: (string|null); + + /** ListRuntimesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListRuntimesRequest. */ + class ListRuntimesRequest implements IListRuntimesRequest { + + /** + * Constructs a new ListRuntimesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListRuntimesRequest); + + /** ListRuntimesRequest parent. */ + public parent: string; + + /** ListRuntimesRequest filter. */ + public filter: string; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IListRuntimesRequest): google.cloud.functions.v2.ListRuntimesRequest; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesRequest + * @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.functions.v2.ListRuntimesRequest; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesRequest + * @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.functions.v2.ListRuntimesRequest; + + /** + * Verifies a ListRuntimesRequest 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 ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListRuntimesRequest; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @param message ListRuntimesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListRuntimesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesResponse. */ + interface IListRuntimesResponse { + + /** ListRuntimesResponse runtimes */ + runtimes?: (google.cloud.functions.v2.ListRuntimesResponse.IRuntime[]|null); + } + + /** Represents a ListRuntimesResponse. */ + class ListRuntimesResponse implements IListRuntimesResponse { + + /** + * Constructs a new ListRuntimesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListRuntimesResponse); + + /** ListRuntimesResponse runtimes. */ + public runtimes: google.cloud.functions.v2.ListRuntimesResponse.IRuntime[]; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IListRuntimesResponse): google.cloud.functions.v2.ListRuntimesResponse; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesResponse + * @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.functions.v2.ListRuntimesResponse; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesResponse + * @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.functions.v2.ListRuntimesResponse; + + /** + * Verifies a ListRuntimesResponse 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 ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListRuntimesResponse; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @param message ListRuntimesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListRuntimesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ListRuntimesResponse { + + /** Properties of a Runtime. */ + interface IRuntime { + + /** Runtime name */ + name?: (string|null); + + /** Runtime displayName */ + displayName?: (string|null); + + /** Runtime stage */ + stage?: (google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|null); + + /** Runtime warnings */ + warnings?: (string[]|null); + + /** Runtime environment */ + environment?: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment|null); + } + + /** Represents a Runtime. */ + class Runtime implements IRuntime { + + /** + * Constructs a new Runtime. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ListRuntimesResponse.IRuntime); + + /** Runtime name. */ + public name: string; + + /** Runtime displayName. */ + public displayName: string; + + /** Runtime stage. */ + public stage: (google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage); + + /** Runtime warnings. */ + public warnings: string[]; + + /** Runtime environment. */ + public environment: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment); + + /** + * Creates a new Runtime instance using the specified properties. + * @param [properties] Properties to set + * @returns Runtime instance + */ + public static create(properties?: google.cloud.functions.v2.ListRuntimesResponse.IRuntime): google.cloud.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Runtime + * @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.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Runtime + * @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.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Verifies a Runtime 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 Runtime message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Runtime + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @param message Runtime + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListRuntimesResponse.Runtime, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Runtime to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** RuntimeStage enum. */ + enum RuntimeStage { + RUNTIME_STAGE_UNSPECIFIED = 0, + DEVELOPMENT = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5, + DECOMMISSIONED = 6 + } + } + + /** 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 statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + + /** OperationMetadata requestResource */ + requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages */ + stages?: (google.cloud.functions.v2.IStage[]|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.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 statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** OperationMetadata requestResource. */ + public requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages. */ + public stages: google.cloud.functions.v2.IStage[]; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.functions.v2.IOperationMetadata): google.cloud.functions.v2.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2.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.functions.v2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2.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.functions.v2.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.functions.v2.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.functions.v2.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.functions.v2.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.functions.v2.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Stage. */ + interface IStage { + + /** Stage name */ + name?: (google.cloud.functions.v2.Stage.Name|keyof typeof google.cloud.functions.v2.Stage.Name|null); + + /** Stage message */ + message?: (string|null); + + /** Stage state */ + state?: (google.cloud.functions.v2.Stage.State|keyof typeof google.cloud.functions.v2.Stage.State|null); + + /** Stage resource */ + resource?: (string|null); + + /** Stage resourceUri */ + resourceUri?: (string|null); + + /** Stage stateMessages */ + stateMessages?: (google.cloud.functions.v2.IStateMessage[]|null); + } + + /** Represents a Stage. */ + class Stage implements IStage { + + /** + * Constructs a new Stage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IStage); + + /** Stage name. */ + public name: (google.cloud.functions.v2.Stage.Name|keyof typeof google.cloud.functions.v2.Stage.Name); + + /** Stage message. */ + public message: string; + + /** Stage state. */ + public state: (google.cloud.functions.v2.Stage.State|keyof typeof google.cloud.functions.v2.Stage.State); + + /** Stage resource. */ + public resource: string; + + /** Stage resourceUri. */ + public resourceUri: string; + + /** Stage stateMessages. */ + public stateMessages: google.cloud.functions.v2.IStateMessage[]; + + /** + * Creates a new Stage instance using the specified properties. + * @param [properties] Properties to set + * @returns Stage instance + */ + public static create(properties?: google.cloud.functions.v2.IStage): google.cloud.functions.v2.Stage; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Stage + * @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.functions.v2.Stage; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Stage + * @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.functions.v2.Stage; + + /** + * Verifies a Stage 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 Stage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Stage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.Stage; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @param message Stage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.Stage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Stage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Stage { + + /** Name enum. */ + enum Name { + NAME_UNSPECIFIED = 0, + ARTIFACT_REGISTRY = 1, + BUILD = 2, + SERVICE = 3, + TRIGGER = 4, + SERVICE_ROLLBACK = 5, + TRIGGER_ROLLBACK = 6 + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + NOT_STARTED = 1, + IN_PROGRESS = 2, + COMPLETE = 3 + } + } + } + /** Namespace v2alpha. */ namespace v2alpha { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 020f622ce89..78d62c3febc 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -6558,6 +6558,8382 @@ return v1; })(); + functions.v2 = (function() { + + /** + * Namespace v2. + * @memberof google.cloud.functions + * @namespace + */ + var v2 = {}; + + v2.FunctionService = (function() { + + /** + * Constructs a new FunctionService service. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a FunctionService + * @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 FunctionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (FunctionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = FunctionService; + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.functions.v2.FunctionService + * @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 {FunctionService} RPC service. Useful where requests and/or responses are streamed. + */ + FunctionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#getFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef GetFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.Function} [response] Function + */ + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.GetFunctionCallback} callback Node-style callback called with the error, if any, and Function + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.getFunction = function getFunction(request, callback) { + return this.rpcCall(getFunction, $root.google.cloud.functions.v2.GetFunctionRequest, $root.google.cloud.functions.v2.Function, request, callback); + }, "name", { value: "GetFunction" }); + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listFunctions}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef ListFunctionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.ListFunctionsResponse} [response] ListFunctionsResponse + */ + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.ListFunctionsCallback} callback Node-style callback called with the error, if any, and ListFunctionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listFunctions = function listFunctions(request, callback) { + return this.rpcCall(listFunctions, $root.google.cloud.functions.v2.ListFunctionsRequest, $root.google.cloud.functions.v2.ListFunctionsResponse, request, callback); + }, "name", { value: "ListFunctions" }); + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#createFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef CreateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.CreateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.createFunction = function createFunction(request, callback) { + return this.rpcCall(createFunction, $root.google.cloud.functions.v2.CreateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateFunction" }); + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#updateFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef UpdateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.UpdateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.updateFunction = function updateFunction(request, callback) { + return this.rpcCall(updateFunction, $root.google.cloud.functions.v2.UpdateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateFunction" }); + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#deleteFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef DeleteFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.DeleteFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.deleteFunction = function deleteFunction(request, callback) { + return this.rpcCall(deleteFunction, $root.google.cloud.functions.v2.DeleteFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteFunction" }); + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateUploadUrl}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef GenerateUploadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.GenerateUploadUrlResponse} [response] GenerateUploadUrlResponse + */ + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.GenerateUploadUrlCallback} callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateUploadUrl = function generateUploadUrl(request, callback) { + return this.rpcCall(generateUploadUrl, $root.google.cloud.functions.v2.GenerateUploadUrlRequest, $root.google.cloud.functions.v2.GenerateUploadUrlResponse, request, callback); + }, "name", { value: "GenerateUploadUrl" }); + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateDownloadUrl}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef GenerateDownloadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.GenerateDownloadUrlResponse} [response] GenerateDownloadUrlResponse + */ + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.GenerateDownloadUrlCallback} callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateDownloadUrl = function generateDownloadUrl(request, callback) { + return this.rpcCall(generateDownloadUrl, $root.google.cloud.functions.v2.GenerateDownloadUrlRequest, $root.google.cloud.functions.v2.GenerateDownloadUrlResponse, request, callback); + }, "name", { value: "GenerateDownloadUrl" }); + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listRuntimes}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef ListRuntimesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.ListRuntimesResponse} [response] ListRuntimesResponse + */ + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.ListRuntimesCallback} callback Node-style callback called with the error, if any, and ListRuntimesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listRuntimes = function listRuntimes(request, callback) { + return this.rpcCall(listRuntimes, $root.google.cloud.functions.v2.ListRuntimesRequest, $root.google.cloud.functions.v2.ListRuntimesResponse, request, callback); + }, "name", { value: "ListRuntimes" }); + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return FunctionService; + })(); + + /** + * Environment enum. + * @name google.cloud.functions.v2.Environment + * @enum {number} + * @property {number} ENVIRONMENT_UNSPECIFIED=0 ENVIRONMENT_UNSPECIFIED value + * @property {number} GEN_1=1 GEN_1 value + * @property {number} GEN_2=2 GEN_2 value + */ + v2.Environment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENVIRONMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "GEN_1"] = 1; + values[valuesById[2] = "GEN_2"] = 2; + return values; + })(); + + v2.Function = (function() { + + /** + * Properties of a Function. + * @memberof google.cloud.functions.v2 + * @interface IFunction + * @property {string|null} [name] Function name + * @property {google.cloud.functions.v2.Environment|null} [environment] Function environment + * @property {string|null} [description] Function description + * @property {google.cloud.functions.v2.IBuildConfig|null} [buildConfig] Function buildConfig + * @property {google.cloud.functions.v2.IServiceConfig|null} [serviceConfig] Function serviceConfig + * @property {google.cloud.functions.v2.IEventTrigger|null} [eventTrigger] Function eventTrigger + * @property {google.cloud.functions.v2.Function.State|null} [state] Function state + * @property {google.protobuf.ITimestamp|null} [updateTime] Function updateTime + * @property {Object.|null} [labels] Function labels + * @property {Array.|null} [stateMessages] Function stateMessages + */ + + /** + * Constructs a new Function. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a Function. + * @implements IFunction + * @constructor + * @param {google.cloud.functions.v2.IFunction=} [properties] Properties to set + */ + function Function(properties) { + this.labels = {}; + this.stateMessages = []; + 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]]; + } + + /** + * Function name. + * @member {string} name + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.name = ""; + + /** + * Function environment. + * @member {google.cloud.functions.v2.Environment} environment + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.environment = 0; + + /** + * Function description. + * @member {string} description + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.description = ""; + + /** + * Function buildConfig. + * @member {google.cloud.functions.v2.IBuildConfig|null|undefined} buildConfig + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.buildConfig = null; + + /** + * Function serviceConfig. + * @member {google.cloud.functions.v2.IServiceConfig|null|undefined} serviceConfig + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.serviceConfig = null; + + /** + * Function eventTrigger. + * @member {google.cloud.functions.v2.IEventTrigger|null|undefined} eventTrigger + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.eventTrigger = null; + + /** + * Function state. + * @member {google.cloud.functions.v2.Function.State} state + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.state = 0; + + /** + * Function updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.updateTime = null; + + /** + * Function labels. + * @member {Object.} labels + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.labels = $util.emptyObject; + + /** + * Function stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.IFunction=} [properties] Properties to set + * @returns {google.cloud.functions.v2.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.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.buildConfig != null && Object.hasOwnProperty.call(message, "buildConfig")) + $root.google.cloud.functions.v2.BuildConfig.encode(message.buildConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.serviceConfig != null && Object.hasOwnProperty.call(message, "serviceConfig")) + $root.google.cloud.functions.v2.ServiceConfig.encode(message.serviceConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.eventTrigger != null && Object.hasOwnProperty.call(message, "eventTrigger")) + $root.google.cloud.functions.v2.EventTrigger.encode(message.eventTrigger, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, 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.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.environment); + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.Function(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 10: + message.environment = reader.int32(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.buildConfig = $root.google.cloud.functions.v2.BuildConfig.decode(reader, reader.uint32()); + break; + case 4: + message.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.decode(reader, reader.uint32()); + break; + case 5: + message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.decode(reader, reader.uint32()); + break; + case 6: + message.state = reader.int32(); + break; + case 7: + message.updateTime = $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: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof google.cloud.functions.v2.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.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.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) { + var error = $root.google.cloud.functions.v2.BuildConfig.verify(message.buildConfig); + if (error) + return "buildConfig." + error; + } + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) { + var error = $root.google.cloud.functions.v2.ServiceConfig.verify(message.serviceConfig); + if (error) + return "serviceConfig." + error; + } + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) { + var error = $root.google.cloud.functions.v2.EventTrigger.verify(message.eventTrigger); + if (error) + return "eventTrigger." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + 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.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.Function + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.Function} Function + */ + Function.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.Function) + return object; + var message = new $root.google.cloud.functions.v2.Function(); + if (object.name != null) + message.name = String(object.name); + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.buildConfig != null) { + if (typeof object.buildConfig !== "object") + throw TypeError(".google.cloud.functions.v2.Function.buildConfig: object expected"); + message.buildConfig = $root.google.cloud.functions.v2.BuildConfig.fromObject(object.buildConfig); + } + if (object.serviceConfig != null) { + if (typeof object.serviceConfig !== "object") + throw TypeError(".google.cloud.functions.v2.Function.serviceConfig: object expected"); + message.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.fromObject(object.serviceConfig); + } + if (object.eventTrigger != null) { + if (typeof object.eventTrigger !== "object") + throw TypeError(".google.cloud.functions.v2.Function.eventTrigger: object expected"); + message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.fromObject(object.eventTrigger); + } + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "FAILED": + case 2: + message.state = 2; + break; + case "DEPLOYING": + case 3: + message.state = 3; + break; + case "DELETING": + case 4: + message.state = 4; + break; + case "UNKNOWN": + case 5: + message.state = 5; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.functions.v2.Function.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.functions.v2.Function.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.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2.Function.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2.Function.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.buildConfig = null; + object.serviceConfig = null; + object.eventTrigger = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.updateTime = null; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) + object.buildConfig = $root.google.cloud.functions.v2.BuildConfig.toObject(message.buildConfig, options); + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) + object.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.toObject(message.serviceConfig, options); + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) + object.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.toObject(message.eventTrigger, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2.Function.State[message.state] : message.state; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, 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.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2.StateMessage.toObject(message.stateMessages[j], options); + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.functions.v2.Function.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} FAILED=2 FAILED value + * @property {number} DEPLOYING=3 DEPLOYING value + * @property {number} DELETING=4 DELETING value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + Function.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "FAILED"] = 2; + values[valuesById[3] = "DEPLOYING"] = 3; + values[valuesById[4] = "DELETING"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + + return Function; + })(); + + v2.StateMessage = (function() { + + /** + * Properties of a StateMessage. + * @memberof google.cloud.functions.v2 + * @interface IStateMessage + * @property {google.cloud.functions.v2.StateMessage.Severity|null} [severity] StateMessage severity + * @property {string|null} [type] StateMessage type + * @property {string|null} [message] StateMessage message + */ + + /** + * Constructs a new StateMessage. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a StateMessage. + * @implements IStateMessage + * @constructor + * @param {google.cloud.functions.v2.IStateMessage=} [properties] Properties to set + */ + function StateMessage(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]]; + } + + /** + * StateMessage severity. + * @member {google.cloud.functions.v2.StateMessage.Severity} severity + * @memberof google.cloud.functions.v2.StateMessage + * @instance + */ + StateMessage.prototype.severity = 0; + + /** + * StateMessage type. + * @member {string} type + * @memberof google.cloud.functions.v2.StateMessage + * @instance + */ + StateMessage.prototype.type = ""; + + /** + * StateMessage message. + * @member {string} message + * @memberof google.cloud.functions.v2.StateMessage + * @instance + */ + StateMessage.prototype.message = ""; + + /** + * Creates a new StateMessage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.IStateMessage=} [properties] Properties to set + * @returns {google.cloud.functions.v2.StateMessage} StateMessage instance + */ + StateMessage.create = function create(properties) { + return new StateMessage(properties); + }; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.StateMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.severity = reader.int32(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StateMessage message. + * @function verify + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StateMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.StateMessage} StateMessage + */ + StateMessage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.StateMessage) + return object; + var message = new $root.google.cloud.functions.v2.StateMessage(); + switch (object.severity) { + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "ERROR": + case 1: + message.severity = 1; + break; + case "WARNING": + case 2: + message.severity = 2; + break; + case "INFO": + case 3: + message.severity = 3; + break; + } + if (object.type != null) + message.type = String(object.type); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.StateMessage} message StateMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StateMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + object.type = ""; + object.message = ""; + } + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.cloud.functions.v2.StateMessage.Severity[message.severity] : message.severity; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this StateMessage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.StateMessage + * @instance + * @returns {Object.} JSON object + */ + StateMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Severity enum. + * @name google.cloud.functions.v2.StateMessage.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} ERROR=1 ERROR value + * @property {number} WARNING=2 WARNING value + * @property {number} INFO=3 INFO value + */ + StateMessage.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ERROR"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "INFO"] = 3; + return values; + })(); + + return StateMessage; + })(); + + v2.StorageSource = (function() { + + /** + * Properties of a StorageSource. + * @memberof google.cloud.functions.v2 + * @interface IStorageSource + * @property {string|null} [bucket] StorageSource bucket + * @property {string|null} [object] StorageSource object + * @property {number|Long|null} [generation] StorageSource generation + */ + + /** + * Constructs a new StorageSource. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a StorageSource. + * @implements IStorageSource + * @constructor + * @param {google.cloud.functions.v2.IStorageSource=} [properties] Properties to set + */ + function StorageSource(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]]; + } + + /** + * StorageSource bucket. + * @member {string} bucket + * @memberof google.cloud.functions.v2.StorageSource + * @instance + */ + StorageSource.prototype.bucket = ""; + + /** + * StorageSource object. + * @member {string} object + * @memberof google.cloud.functions.v2.StorageSource + * @instance + */ + StorageSource.prototype.object = ""; + + /** + * StorageSource generation. + * @member {number|Long} generation + * @memberof google.cloud.functions.v2.StorageSource + * @instance + */ + StorageSource.prototype.generation = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StorageSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.IStorageSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2.StorageSource} StorageSource instance + */ + StorageSource.create = function create(properties) { + return new StorageSource(properties); + }; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); + if (message.object != null && Object.hasOwnProperty.call(message, "object")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.object); + if (message.generation != null && Object.hasOwnProperty.call(message, "generation")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.generation); + return writer; + }; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.StorageSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bucket = reader.string(); + break; + case 2: + message.object = reader.string(); + break; + case 3: + message.generation = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StorageSource message. + * @function verify + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StorageSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.object != null && message.hasOwnProperty("object")) + if (!$util.isString(message.object)) + return "object: string expected"; + if (message.generation != null && message.hasOwnProperty("generation")) + if (!$util.isInteger(message.generation) && !(message.generation && $util.isInteger(message.generation.low) && $util.isInteger(message.generation.high))) + return "generation: integer|Long expected"; + return null; + }; + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.StorageSource} StorageSource + */ + StorageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.StorageSource) + return object; + var message = new $root.google.cloud.functions.v2.StorageSource(); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.object != null) + message.object = String(object.object); + if (object.generation != null) + if ($util.Long) + (message.generation = $util.Long.fromValue(object.generation)).unsigned = false; + else if (typeof object.generation === "string") + message.generation = parseInt(object.generation, 10); + else if (typeof object.generation === "number") + message.generation = object.generation; + else if (typeof object.generation === "object") + message.generation = new $util.LongBits(object.generation.low >>> 0, object.generation.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.StorageSource} message StorageSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StorageSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bucket = ""; + object.object = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.generation = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.generation = options.longs === String ? "0" : 0; + } + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.object != null && message.hasOwnProperty("object")) + object.object = message.object; + if (message.generation != null && message.hasOwnProperty("generation")) + if (typeof message.generation === "number") + object.generation = options.longs === String ? String(message.generation) : message.generation; + else + object.generation = options.longs === String ? $util.Long.prototype.toString.call(message.generation) : options.longs === Number ? new $util.LongBits(message.generation.low >>> 0, message.generation.high >>> 0).toNumber() : message.generation; + return object; + }; + + /** + * Converts this StorageSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.StorageSource + * @instance + * @returns {Object.} JSON object + */ + StorageSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StorageSource; + })(); + + v2.RepoSource = (function() { + + /** + * Properties of a RepoSource. + * @memberof google.cloud.functions.v2 + * @interface IRepoSource + * @property {string|null} [branchName] RepoSource branchName + * @property {string|null} [tagName] RepoSource tagName + * @property {string|null} [commitSha] RepoSource commitSha + * @property {string|null} [projectId] RepoSource projectId + * @property {string|null} [repoName] RepoSource repoName + * @property {string|null} [dir] RepoSource dir + * @property {boolean|null} [invertRegex] RepoSource invertRegex + */ + + /** + * Constructs a new RepoSource. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a RepoSource. + * @implements IRepoSource + * @constructor + * @param {google.cloud.functions.v2.IRepoSource=} [properties] Properties to set + */ + function RepoSource(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]]; + } + + /** + * RepoSource branchName. + * @member {string|null|undefined} branchName + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.branchName = null; + + /** + * RepoSource tagName. + * @member {string|null|undefined} tagName + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.tagName = null; + + /** + * RepoSource commitSha. + * @member {string|null|undefined} commitSha + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.commitSha = null; + + /** + * RepoSource projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.projectId = ""; + + /** + * RepoSource repoName. + * @member {string} repoName + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.repoName = ""; + + /** + * RepoSource dir. + * @member {string} dir + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.dir = ""; + + /** + * RepoSource invertRegex. + * @member {boolean} invertRegex + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.invertRegex = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RepoSource revision. + * @member {"branchName"|"tagName"|"commitSha"|undefined} revision + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + Object.defineProperty(RepoSource.prototype, "revision", { + get: $util.oneOfGetter($oneOfFields = ["branchName", "tagName", "commitSha"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RepoSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.IRepoSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2.RepoSource} RepoSource instance + */ + RepoSource.create = function create(properties) { + return new RepoSource(properties); + }; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.repoName != null && Object.hasOwnProperty.call(message, "repoName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.repoName); + if (message.branchName != null && Object.hasOwnProperty.call(message, "branchName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.branchName); + if (message.tagName != null && Object.hasOwnProperty.call(message, "tagName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tagName); + if (message.commitSha != null && Object.hasOwnProperty.call(message, "commitSha")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.commitSha); + if (message.dir != null && Object.hasOwnProperty.call(message, "dir")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dir); + if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.invertRegex); + return writer; + }; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.RepoSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.branchName = reader.string(); + break; + case 4: + message.tagName = reader.string(); + break; + case 5: + message.commitSha = reader.string(); + break; + case 1: + message.projectId = reader.string(); + break; + case 2: + message.repoName = reader.string(); + break; + case 6: + message.dir = reader.string(); + break; + case 7: + message.invertRegex = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RepoSource message. + * @function verify + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RepoSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + properties.revision = 1; + if (!$util.isString(message.branchName)) + return "branchName: string expected"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.tagName)) + return "tagName: string expected"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.commitSha)) + return "commitSha: string expected"; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.repoName != null && message.hasOwnProperty("repoName")) + if (!$util.isString(message.repoName)) + return "repoName: string expected"; + if (message.dir != null && message.hasOwnProperty("dir")) + if (!$util.isString(message.dir)) + return "dir: string expected"; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + if (typeof message.invertRegex !== "boolean") + return "invertRegex: boolean expected"; + return null; + }; + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.RepoSource} RepoSource + */ + RepoSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.RepoSource) + return object; + var message = new $root.google.cloud.functions.v2.RepoSource(); + if (object.branchName != null) + message.branchName = String(object.branchName); + if (object.tagName != null) + message.tagName = String(object.tagName); + if (object.commitSha != null) + message.commitSha = String(object.commitSha); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.repoName != null) + message.repoName = String(object.repoName); + if (object.dir != null) + message.dir = String(object.dir); + if (object.invertRegex != null) + message.invertRegex = Boolean(object.invertRegex); + return message; + }; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.RepoSource} message RepoSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RepoSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.projectId = ""; + object.repoName = ""; + object.dir = ""; + object.invertRegex = false; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.repoName != null && message.hasOwnProperty("repoName")) + object.repoName = message.repoName; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + object.branchName = message.branchName; + if (options.oneofs) + object.revision = "branchName"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + object.tagName = message.tagName; + if (options.oneofs) + object.revision = "tagName"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + object.commitSha = message.commitSha; + if (options.oneofs) + object.revision = "commitSha"; + } + if (message.dir != null && message.hasOwnProperty("dir")) + object.dir = message.dir; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + object.invertRegex = message.invertRegex; + return object; + }; + + /** + * Converts this RepoSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.RepoSource + * @instance + * @returns {Object.} JSON object + */ + RepoSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RepoSource; + })(); + + v2.Source = (function() { + + /** + * Properties of a Source. + * @memberof google.cloud.functions.v2 + * @interface ISource + * @property {google.cloud.functions.v2.IStorageSource|null} [storageSource] Source storageSource + * @property {google.cloud.functions.v2.IRepoSource|null} [repoSource] Source repoSource + */ + + /** + * Constructs a new Source. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a Source. + * @implements ISource + * @constructor + * @param {google.cloud.functions.v2.ISource=} [properties] Properties to set + */ + function Source(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]]; + } + + /** + * Source storageSource. + * @member {google.cloud.functions.v2.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2.Source + * @instance + */ + Source.prototype.storageSource = null; + + /** + * Source repoSource. + * @member {google.cloud.functions.v2.IRepoSource|null|undefined} repoSource + * @memberof google.cloud.functions.v2.Source + * @instance + */ + Source.prototype.repoSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Source source. + * @member {"storageSource"|"repoSource"|undefined} source + * @memberof google.cloud.functions.v2.Source + * @instance + */ + Object.defineProperty(Source.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["storageSource", "repoSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Source instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.ISource=} [properties] Properties to set + * @returns {google.cloud.functions.v2.Source} Source instance + */ + Source.create = function create(properties) { + return new Source(properties); + }; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2.StorageSource.encode(message.storageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.repoSource != null && Object.hasOwnProperty.call(message, "repoSource")) + $root.google.cloud.functions.v2.RepoSource.encode(message.repoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Source message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.Source(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.repoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Source message. + * @function verify + * @memberof google.cloud.functions.v2.Source + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Source.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + properties.source = 1; + { + var error = $root.google.cloud.functions.v2.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.functions.v2.RepoSource.verify(message.repoSource); + if (error) + return "repoSource." + error; + } + } + return null; + }; + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.Source + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.Source} Source + */ + Source.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.Source) + return object; + var message = new $root.google.cloud.functions.v2.Source(); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2.Source.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2.StorageSource.fromObject(object.storageSource); + } + if (object.repoSource != null) { + if (typeof object.repoSource !== "object") + throw TypeError(".google.cloud.functions.v2.Source.repoSource: object expected"); + message.repoSource = $root.google.cloud.functions.v2.RepoSource.fromObject(object.repoSource); + } + return message; + }; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.Source} message Source + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Source.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + object.storageSource = $root.google.cloud.functions.v2.StorageSource.toObject(message.storageSource, options); + if (options.oneofs) + object.source = "storageSource"; + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + object.repoSource = $root.google.cloud.functions.v2.RepoSource.toObject(message.repoSource, options); + if (options.oneofs) + object.source = "repoSource"; + } + return object; + }; + + /** + * Converts this Source to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.Source + * @instance + * @returns {Object.} JSON object + */ + Source.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Source; + })(); + + v2.SourceProvenance = (function() { + + /** + * Properties of a SourceProvenance. + * @memberof google.cloud.functions.v2 + * @interface ISourceProvenance + * @property {google.cloud.functions.v2.IStorageSource|null} [resolvedStorageSource] SourceProvenance resolvedStorageSource + * @property {google.cloud.functions.v2.IRepoSource|null} [resolvedRepoSource] SourceProvenance resolvedRepoSource + */ + + /** + * Constructs a new SourceProvenance. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a SourceProvenance. + * @implements ISourceProvenance + * @constructor + * @param {google.cloud.functions.v2.ISourceProvenance=} [properties] Properties to set + */ + function SourceProvenance(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]]; + } + + /** + * SourceProvenance resolvedStorageSource. + * @member {google.cloud.functions.v2.IStorageSource|null|undefined} resolvedStorageSource + * @memberof google.cloud.functions.v2.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedStorageSource = null; + + /** + * SourceProvenance resolvedRepoSource. + * @member {google.cloud.functions.v2.IRepoSource|null|undefined} resolvedRepoSource + * @memberof google.cloud.functions.v2.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedRepoSource = null; + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.ISourceProvenance=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance instance + */ + SourceProvenance.create = function create(properties) { + return new SourceProvenance(properties); + }; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resolvedStorageSource != null && Object.hasOwnProperty.call(message, "resolvedStorageSource")) + $root.google.cloud.functions.v2.StorageSource.encode(message.resolvedStorageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.resolvedRepoSource != null && Object.hasOwnProperty.call(message, "resolvedRepoSource")) + $root.google.cloud.functions.v2.RepoSource.encode(message.resolvedRepoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SourceProvenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceProvenance message. + * @function verify + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceProvenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) { + var error = $root.google.cloud.functions.v2.StorageSource.verify(message.resolvedStorageSource); + if (error) + return "resolvedStorageSource." + error; + } + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) { + var error = $root.google.cloud.functions.v2.RepoSource.verify(message.resolvedRepoSource); + if (error) + return "resolvedRepoSource." + error; + } + return null; + }; + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance + */ + SourceProvenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SourceProvenance) + return object; + var message = new $root.google.cloud.functions.v2.SourceProvenance(); + if (object.resolvedStorageSource != null) { + if (typeof object.resolvedStorageSource !== "object") + throw TypeError(".google.cloud.functions.v2.SourceProvenance.resolvedStorageSource: object expected"); + message.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.fromObject(object.resolvedStorageSource); + } + if (object.resolvedRepoSource != null) { + if (typeof object.resolvedRepoSource !== "object") + throw TypeError(".google.cloud.functions.v2.SourceProvenance.resolvedRepoSource: object expected"); + message.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.fromObject(object.resolvedRepoSource); + } + return message; + }; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.SourceProvenance} message SourceProvenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceProvenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resolvedStorageSource = null; + object.resolvedRepoSource = null; + } + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) + object.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.toObject(message.resolvedStorageSource, options); + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) + object.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.toObject(message.resolvedRepoSource, options); + return object; + }; + + /** + * Converts this SourceProvenance to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SourceProvenance + * @instance + * @returns {Object.} JSON object + */ + SourceProvenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SourceProvenance; + })(); + + v2.BuildConfig = (function() { + + /** + * Properties of a BuildConfig. + * @memberof google.cloud.functions.v2 + * @interface IBuildConfig + * @property {string|null} [build] BuildConfig build + * @property {string|null} [runtime] BuildConfig runtime + * @property {string|null} [entryPoint] BuildConfig entryPoint + * @property {google.cloud.functions.v2.ISource|null} [source] BuildConfig source + * @property {google.cloud.functions.v2.ISourceProvenance|null} [sourceProvenance] BuildConfig sourceProvenance + * @property {string|null} [workerPool] BuildConfig workerPool + * @property {Object.|null} [environmentVariables] BuildConfig environmentVariables + * @property {string|null} [dockerRepository] BuildConfig dockerRepository + */ + + /** + * Constructs a new BuildConfig. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a BuildConfig. + * @implements IBuildConfig + * @constructor + * @param {google.cloud.functions.v2.IBuildConfig=} [properties] Properties to set + */ + function BuildConfig(properties) { + this.environmentVariables = {}; + 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]]; + } + + /** + * BuildConfig build. + * @member {string} build + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.build = ""; + + /** + * BuildConfig runtime. + * @member {string} runtime + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.runtime = ""; + + /** + * BuildConfig entryPoint. + * @member {string} entryPoint + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.entryPoint = ""; + + /** + * BuildConfig source. + * @member {google.cloud.functions.v2.ISource|null|undefined} source + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.source = null; + + /** + * BuildConfig sourceProvenance. + * @member {google.cloud.functions.v2.ISourceProvenance|null|undefined} sourceProvenance + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.sourceProvenance = null; + + /** + * BuildConfig workerPool. + * @member {string} workerPool + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.workerPool = ""; + + /** + * BuildConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * BuildConfig dockerRepository. + * @member {string} dockerRepository + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.dockerRepository = ""; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.IBuildConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig instance + */ + BuildConfig.create = function create(properties) { + return new BuildConfig(properties); + }; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.build != null && Object.hasOwnProperty.call(message, "build")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.build); + if (message.runtime != null && Object.hasOwnProperty.call(message, "runtime")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.runtime); + if (message.entryPoint != null && Object.hasOwnProperty.call(message, "entryPoint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entryPoint); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + $root.google.cloud.functions.v2.Source.encode(message.source, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.workerPool != null && Object.hasOwnProperty.call(message, "workerPool")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.workerPool); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), 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.environmentVariables[keys[i]]).ldelim(); + if (message.dockerRepository != null && Object.hasOwnProperty.call(message, "dockerRepository")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.dockerRepository); + if (message.sourceProvenance != null && Object.hasOwnProperty.call(message, "sourceProvenance")) + $root.google.cloud.functions.v2.SourceProvenance.encode(message.sourceProvenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.BuildConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.build = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + case 3: + message.entryPoint = reader.string(); + break; + case 4: + message.source = $root.google.cloud.functions.v2.Source.decode(reader, reader.uint32()); + break; + case 8: + message.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.decode(reader, reader.uint32()); + break; + case 5: + message.workerPool = reader.string(); + break; + case 6: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + 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.environmentVariables[key] = value; + break; + case 7: + message.dockerRepository = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BuildConfig message. + * @function verify + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BuildConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.build != null && message.hasOwnProperty("build")) + if (!$util.isString(message.build)) + return "build: string expected"; + if (message.runtime != null && message.hasOwnProperty("runtime")) + if (!$util.isString(message.runtime)) + return "runtime: string expected"; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + if (!$util.isString(message.entryPoint)) + return "entryPoint: string expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.functions.v2.Source.verify(message.source); + if (error) + return "source." + error; + } + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) { + var error = $root.google.cloud.functions.v2.SourceProvenance.verify(message.sourceProvenance); + if (error) + return "sourceProvenance." + error; + } + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + if (!$util.isString(message.workerPool)) + return "workerPool: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + if (!$util.isString(message.dockerRepository)) + return "dockerRepository: string expected"; + return null; + }; + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig + */ + BuildConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.BuildConfig) + return object; + var message = new $root.google.cloud.functions.v2.BuildConfig(); + if (object.build != null) + message.build = String(object.build); + if (object.runtime != null) + message.runtime = String(object.runtime); + if (object.entryPoint != null) + message.entryPoint = String(object.entryPoint); + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.functions.v2.BuildConfig.source: object expected"); + message.source = $root.google.cloud.functions.v2.Source.fromObject(object.source); + } + if (object.sourceProvenance != null) { + if (typeof object.sourceProvenance !== "object") + throw TypeError(".google.cloud.functions.v2.BuildConfig.sourceProvenance: object expected"); + message.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.fromObject(object.sourceProvenance); + } + if (object.workerPool != null) + message.workerPool = String(object.workerPool); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2.BuildConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.dockerRepository != null) + message.dockerRepository = String(object.dockerRepository); + return message; + }; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.BuildConfig} message BuildConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BuildConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.build = ""; + object.runtime = ""; + object.entryPoint = ""; + object.source = null; + object.workerPool = ""; + object.dockerRepository = ""; + object.sourceProvenance = null; + } + if (message.build != null && message.hasOwnProperty("build")) + object.build = message.build; + if (message.runtime != null && message.hasOwnProperty("runtime")) + object.runtime = message.runtime; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + object.entryPoint = message.entryPoint; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.functions.v2.Source.toObject(message.source, options); + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + object.workerPool = message.workerPool; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + object.dockerRepository = message.dockerRepository; + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) + object.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.toObject(message.sourceProvenance, options); + return object; + }; + + /** + * Converts this BuildConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + * @returns {Object.} JSON object + */ + BuildConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BuildConfig; + })(); + + v2.ServiceConfig = (function() { + + /** + * Properties of a ServiceConfig. + * @memberof google.cloud.functions.v2 + * @interface IServiceConfig + * @property {string|null} [service] ServiceConfig service + * @property {number|null} [timeoutSeconds] ServiceConfig timeoutSeconds + * @property {string|null} [availableMemory] ServiceConfig availableMemory + * @property {Object.|null} [environmentVariables] ServiceConfig environmentVariables + * @property {number|null} [maxInstanceCount] ServiceConfig maxInstanceCount + * @property {number|null} [minInstanceCount] ServiceConfig minInstanceCount + * @property {string|null} [vpcConnector] ServiceConfig vpcConnector + * @property {google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|null} [vpcConnectorEgressSettings] ServiceConfig vpcConnectorEgressSettings + * @property {google.cloud.functions.v2.ServiceConfig.IngressSettings|null} [ingressSettings] ServiceConfig ingressSettings + * @property {string|null} [uri] ServiceConfig uri + * @property {string|null} [serviceAccountEmail] ServiceConfig serviceAccountEmail + * @property {boolean|null} [allTrafficOnLatestRevision] ServiceConfig allTrafficOnLatestRevision + * @property {Array.|null} [secretEnvironmentVariables] ServiceConfig secretEnvironmentVariables + * @property {Array.|null} [secretVolumes] ServiceConfig secretVolumes + * @property {string|null} [revision] ServiceConfig revision + */ + + /** + * Constructs a new ServiceConfig. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ServiceConfig. + * @implements IServiceConfig + * @constructor + * @param {google.cloud.functions.v2.IServiceConfig=} [properties] Properties to set + */ + function ServiceConfig(properties) { + this.environmentVariables = {}; + this.secretEnvironmentVariables = []; + this.secretVolumes = []; + 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]]; + } + + /** + * ServiceConfig service. + * @member {string} service + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.service = ""; + + /** + * ServiceConfig timeoutSeconds. + * @member {number} timeoutSeconds + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.timeoutSeconds = 0; + + /** + * ServiceConfig availableMemory. + * @member {string} availableMemory + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.availableMemory = ""; + + /** + * ServiceConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * ServiceConfig maxInstanceCount. + * @member {number} maxInstanceCount + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.maxInstanceCount = 0; + + /** + * ServiceConfig minInstanceCount. + * @member {number} minInstanceCount + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.minInstanceCount = 0; + + /** + * ServiceConfig vpcConnector. + * @member {string} vpcConnector + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnector = ""; + + /** + * ServiceConfig vpcConnectorEgressSettings. + * @member {google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings} vpcConnectorEgressSettings + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnectorEgressSettings = 0; + + /** + * ServiceConfig ingressSettings. + * @member {google.cloud.functions.v2.ServiceConfig.IngressSettings} ingressSettings + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.ingressSettings = 0; + + /** + * ServiceConfig uri. + * @member {string} uri + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.uri = ""; + + /** + * ServiceConfig serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.serviceAccountEmail = ""; + + /** + * ServiceConfig allTrafficOnLatestRevision. + * @member {boolean} allTrafficOnLatestRevision + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.allTrafficOnLatestRevision = false; + + /** + * ServiceConfig secretEnvironmentVariables. + * @member {Array.} secretEnvironmentVariables + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretEnvironmentVariables = $util.emptyArray; + + /** + * ServiceConfig secretVolumes. + * @member {Array.} secretVolumes + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretVolumes = $util.emptyArray; + + /** + * ServiceConfig revision. + * @member {string} revision + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.revision = ""; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.IServiceConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig instance + */ + ServiceConfig.create = function create(properties) { + return new ServiceConfig(properties); + }; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + if (message.timeoutSeconds != null && Object.hasOwnProperty.call(message, "timeoutSeconds")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.timeoutSeconds); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.maxInstanceCount != null && Object.hasOwnProperty.call(message, "maxInstanceCount")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxInstanceCount); + if (message.vpcConnector != null && Object.hasOwnProperty.call(message, "vpcConnector")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.vpcConnector); + if (message.vpcConnectorEgressSettings != null && Object.hasOwnProperty.call(message, "vpcConnectorEgressSettings")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.vpcConnectorEgressSettings); + if (message.ingressSettings != null && Object.hasOwnProperty.call(message, "ingressSettings")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.ingressSettings); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.uri); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.serviceAccountEmail); + if (message.minInstanceCount != null && Object.hasOwnProperty.call(message, "minInstanceCount")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.minInstanceCount); + if (message.availableMemory != null && Object.hasOwnProperty.call(message, "availableMemory")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.availableMemory); + if (message.allTrafficOnLatestRevision != null && Object.hasOwnProperty.call(message, "allTrafficOnLatestRevision")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.allTrafficOnLatestRevision); + if (message.secretEnvironmentVariables != null && message.secretEnvironmentVariables.length) + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) + $root.google.cloud.functions.v2.SecretEnvVar.encode(message.secretEnvironmentVariables[i], writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.revision); + if (message.secretVolumes != null && message.secretVolumes.length) + for (var i = 0; i < message.secretVolumes.length; ++i) + $root.google.cloud.functions.v2.SecretVolume.encode(message.secretVolumes[i], writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ServiceConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.service = reader.string(); + break; + case 2: + message.timeoutSeconds = reader.int32(); + break; + case 13: + message.availableMemory = reader.string(); + break; + case 4: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + 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.environmentVariables[key] = value; + break; + case 5: + message.maxInstanceCount = reader.int32(); + break; + case 12: + message.minInstanceCount = reader.int32(); + break; + case 6: + message.vpcConnector = reader.string(); + break; + case 7: + message.vpcConnectorEgressSettings = reader.int32(); + break; + case 8: + message.ingressSettings = reader.int32(); + break; + case 9: + message.uri = reader.string(); + break; + case 10: + message.serviceAccountEmail = reader.string(); + break; + case 16: + message.allTrafficOnLatestRevision = reader.bool(); + break; + case 17: + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2.SecretEnvVar.decode(reader, reader.uint32())); + break; + case 19: + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2.SecretVolume.decode(reader, reader.uint32())); + break; + case 18: + message.revision = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceConfig message. + * @function verify + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + if (!$util.isInteger(message.timeoutSeconds)) + return "timeoutSeconds: integer expected"; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + if (!$util.isString(message.availableMemory)) + return "availableMemory: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + if (!$util.isInteger(message.maxInstanceCount)) + return "maxInstanceCount: integer expected"; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + if (!$util.isInteger(message.minInstanceCount)) + return "minInstanceCount: integer expected"; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + if (!$util.isString(message.vpcConnector)) + return "vpcConnector: string expected"; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + switch (message.vpcConnectorEgressSettings) { + default: + return "vpcConnectorEgressSettings: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + switch (message.ingressSettings) { + default: + return "ingressSettings: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + if (typeof message.allTrafficOnLatestRevision !== "boolean") + return "allTrafficOnLatestRevision: boolean expected"; + if (message.secretEnvironmentVariables != null && message.hasOwnProperty("secretEnvironmentVariables")) { + if (!Array.isArray(message.secretEnvironmentVariables)) + return "secretEnvironmentVariables: array expected"; + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) { + var error = $root.google.cloud.functions.v2.SecretEnvVar.verify(message.secretEnvironmentVariables[i]); + if (error) + return "secretEnvironmentVariables." + error; + } + } + if (message.secretVolumes != null && message.hasOwnProperty("secretVolumes")) { + if (!Array.isArray(message.secretVolumes)) + return "secretVolumes: array expected"; + for (var i = 0; i < message.secretVolumes.length; ++i) { + var error = $root.google.cloud.functions.v2.SecretVolume.verify(message.secretVolumes[i]); + if (error) + return "secretVolumes." + error; + } + } + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isString(message.revision)) + return "revision: string expected"; + return null; + }; + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig + */ + ServiceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ServiceConfig) + return object; + var message = new $root.google.cloud.functions.v2.ServiceConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.timeoutSeconds != null) + message.timeoutSeconds = object.timeoutSeconds | 0; + if (object.availableMemory != null) + message.availableMemory = String(object.availableMemory); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2.ServiceConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.maxInstanceCount != null) + message.maxInstanceCount = object.maxInstanceCount | 0; + if (object.minInstanceCount != null) + message.minInstanceCount = object.minInstanceCount | 0; + if (object.vpcConnector != null) + message.vpcConnector = String(object.vpcConnector); + switch (object.vpcConnectorEgressSettings) { + case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.vpcConnectorEgressSettings = 0; + break; + case "PRIVATE_RANGES_ONLY": + case 1: + message.vpcConnectorEgressSettings = 1; + break; + case "ALL_TRAFFIC": + case 2: + message.vpcConnectorEgressSettings = 2; + break; + } + switch (object.ingressSettings) { + case "INGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.ingressSettings = 0; + break; + case "ALLOW_ALL": + case 1: + message.ingressSettings = 1; + break; + case "ALLOW_INTERNAL_ONLY": + case 2: + message.ingressSettings = 2; + break; + case "ALLOW_INTERNAL_AND_GCLB": + case 3: + message.ingressSettings = 3; + break; + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + if (object.allTrafficOnLatestRevision != null) + message.allTrafficOnLatestRevision = Boolean(object.allTrafficOnLatestRevision); + if (object.secretEnvironmentVariables) { + if (!Array.isArray(object.secretEnvironmentVariables)) + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretEnvironmentVariables: array expected"); + message.secretEnvironmentVariables = []; + for (var i = 0; i < object.secretEnvironmentVariables.length; ++i) { + if (typeof object.secretEnvironmentVariables[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretEnvironmentVariables: object expected"); + message.secretEnvironmentVariables[i] = $root.google.cloud.functions.v2.SecretEnvVar.fromObject(object.secretEnvironmentVariables[i]); + } + } + if (object.secretVolumes) { + if (!Array.isArray(object.secretVolumes)) + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretVolumes: array expected"); + message.secretVolumes = []; + for (var i = 0; i < object.secretVolumes.length; ++i) { + if (typeof object.secretVolumes[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretVolumes: object expected"); + message.secretVolumes[i] = $root.google.cloud.functions.v2.SecretVolume.fromObject(object.secretVolumes[i]); + } + } + if (object.revision != null) + message.revision = String(object.revision); + return message; + }; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.ServiceConfig} message ServiceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.secretEnvironmentVariables = []; + object.secretVolumes = []; + } + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.service = ""; + object.timeoutSeconds = 0; + object.maxInstanceCount = 0; + object.vpcConnector = ""; + object.vpcConnectorEgressSettings = options.enums === String ? "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" : 0; + object.ingressSettings = options.enums === String ? "INGRESS_SETTINGS_UNSPECIFIED" : 0; + object.uri = ""; + object.serviceAccountEmail = ""; + object.minInstanceCount = 0; + object.availableMemory = ""; + object.allTrafficOnLatestRevision = false; + object.revision = ""; + } + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + object.timeoutSeconds = message.timeoutSeconds; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + object.maxInstanceCount = message.maxInstanceCount; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + object.vpcConnector = message.vpcConnector; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + object.minInstanceCount = message.minInstanceCount; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + object.availableMemory = message.availableMemory; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + object.allTrafficOnLatestRevision = message.allTrafficOnLatestRevision; + if (message.secretEnvironmentVariables && message.secretEnvironmentVariables.length) { + object.secretEnvironmentVariables = []; + for (var j = 0; j < message.secretEnvironmentVariables.length; ++j) + object.secretEnvironmentVariables[j] = $root.google.cloud.functions.v2.SecretEnvVar.toObject(message.secretEnvironmentVariables[j], options); + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.secretVolumes && message.secretVolumes.length) { + object.secretVolumes = []; + for (var j = 0; j < message.secretVolumes.length; ++j) + object.secretVolumes[j] = $root.google.cloud.functions.v2.SecretVolume.toObject(message.secretVolumes[j], options); + } + return object; + }; + + /** + * Converts this ServiceConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + * @returns {Object.} JSON object + */ + ServiceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * VpcConnectorEgressSettings enum. + * @name google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings + * @enum {number} + * @property {number} VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED=0 VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED value + * @property {number} PRIVATE_RANGES_ONLY=1 PRIVATE_RANGES_ONLY value + * @property {number} ALL_TRAFFIC=2 ALL_TRAFFIC value + */ + ServiceConfig.VpcConnectorEgressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIVATE_RANGES_ONLY"] = 1; + values[valuesById[2] = "ALL_TRAFFIC"] = 2; + return values; + })(); + + /** + * IngressSettings enum. + * @name google.cloud.functions.v2.ServiceConfig.IngressSettings + * @enum {number} + * @property {number} INGRESS_SETTINGS_UNSPECIFIED=0 INGRESS_SETTINGS_UNSPECIFIED value + * @property {number} ALLOW_ALL=1 ALLOW_ALL value + * @property {number} ALLOW_INTERNAL_ONLY=2 ALLOW_INTERNAL_ONLY value + * @property {number} ALLOW_INTERNAL_AND_GCLB=3 ALLOW_INTERNAL_AND_GCLB value + */ + ServiceConfig.IngressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_ALL"] = 1; + values[valuesById[2] = "ALLOW_INTERNAL_ONLY"] = 2; + values[valuesById[3] = "ALLOW_INTERNAL_AND_GCLB"] = 3; + return values; + })(); + + return ServiceConfig; + })(); + + v2.SecretEnvVar = (function() { + + /** + * Properties of a SecretEnvVar. + * @memberof google.cloud.functions.v2 + * @interface ISecretEnvVar + * @property {string|null} [key] SecretEnvVar key + * @property {string|null} [projectId] SecretEnvVar projectId + * @property {string|null} [secret] SecretEnvVar secret + * @property {string|null} [version] SecretEnvVar version + */ + + /** + * Constructs a new SecretEnvVar. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a SecretEnvVar. + * @implements ISecretEnvVar + * @constructor + * @param {google.cloud.functions.v2.ISecretEnvVar=} [properties] Properties to set + */ + function SecretEnvVar(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]]; + } + + /** + * SecretEnvVar key. + * @member {string} key + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.key = ""; + + /** + * SecretEnvVar projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.projectId = ""; + + /** + * SecretEnvVar secret. + * @member {string} secret + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.secret = ""; + + /** + * SecretEnvVar version. + * @member {string} version + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.version = ""; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.ISecretEnvVar=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar instance + */ + SecretEnvVar.create = function create(properties) { + return new SecretEnvVar(properties); + }; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.version); + return writer; + }; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SecretEnvVar(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretEnvVar message. + * @function verify + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretEnvVar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar + */ + SecretEnvVar.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SecretEnvVar) + return object; + var message = new $root.google.cloud.functions.v2.SecretEnvVar(); + if (object.key != null) + message.key = String(object.key); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.SecretEnvVar} message SecretEnvVar + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretEnvVar.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.projectId = ""; + object.secret = ""; + object.version = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this SecretEnvVar to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + * @returns {Object.} JSON object + */ + SecretEnvVar.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretEnvVar; + })(); + + v2.SecretVolume = (function() { + + /** + * Properties of a SecretVolume. + * @memberof google.cloud.functions.v2 + * @interface ISecretVolume + * @property {string|null} [mountPath] SecretVolume mountPath + * @property {string|null} [projectId] SecretVolume projectId + * @property {string|null} [secret] SecretVolume secret + * @property {Array.|null} [versions] SecretVolume versions + */ + + /** + * Constructs a new SecretVolume. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a SecretVolume. + * @implements ISecretVolume + * @constructor + * @param {google.cloud.functions.v2.ISecretVolume=} [properties] Properties to set + */ + function SecretVolume(properties) { + this.versions = []; + 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]]; + } + + /** + * SecretVolume mountPath. + * @member {string} mountPath + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.mountPath = ""; + + /** + * SecretVolume projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.projectId = ""; + + /** + * SecretVolume secret. + * @member {string} secret + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.secret = ""; + + /** + * SecretVolume versions. + * @member {Array.} versions + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.versions = $util.emptyArray; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.ISecretVolume=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume instance + */ + SecretVolume.create = function create(properties) { + return new SecretVolume(properties); + }; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mountPath != null && Object.hasOwnProperty.call(message, "mountPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mountPath); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.functions.v2.SecretVolume.SecretVersion.encode(message.versions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SecretVolume(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mountPath = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVolume message. + * @function verify + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVolume.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + if (!$util.isString(message.mountPath)) + return "mountPath: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.functions.v2.SecretVolume.SecretVersion.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + return null; + }; + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume + */ + SecretVolume.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SecretVolume) + return object; + var message = new $root.google.cloud.functions.v2.SecretVolume(); + if (object.mountPath != null) + message.mountPath = String(object.mountPath); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.functions.v2.SecretVolume.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.functions.v2.SecretVolume.versions: object expected"); + message.versions[i] = $root.google.cloud.functions.v2.SecretVolume.SecretVersion.fromObject(object.versions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.SecretVolume} message SecretVolume + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVolume.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.mountPath = ""; + object.projectId = ""; + object.secret = ""; + } + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + object.mountPath = message.mountPath; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.functions.v2.SecretVolume.SecretVersion.toObject(message.versions[j], options); + } + return object; + }; + + /** + * Converts this SecretVolume to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + * @returns {Object.} JSON object + */ + SecretVolume.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SecretVolume.SecretVersion = (function() { + + /** + * Properties of a SecretVersion. + * @memberof google.cloud.functions.v2.SecretVolume + * @interface ISecretVersion + * @property {string|null} [version] SecretVersion version + * @property {string|null} [path] SecretVersion path + */ + + /** + * Constructs a new SecretVersion. + * @memberof google.cloud.functions.v2.SecretVolume + * @classdesc Represents a SecretVersion. + * @implements ISecretVersion + * @constructor + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion=} [properties] Properties to set + */ + function SecretVersion(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]]; + } + + /** + * SecretVersion version. + * @member {string} version + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.version = ""; + + /** + * SecretVersion path. + * @member {string} path + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.path = ""; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion instance + */ + SecretVersion.create = function create(properties) { + return new SecretVersion(properties); + }; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.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.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SecretVolume.SecretVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVersion message. + * @function verify + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVersion.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.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion + */ + SecretVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SecretVolume.SecretVersion) + return object; + var message = new $root.google.cloud.functions.v2.SecretVolume.SecretVersion(); + if (object.version != null) + message.version = String(object.version); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.SecretVersion} message SecretVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.path = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this SecretVersion to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @instance + * @returns {Object.} JSON object + */ + SecretVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretVersion; + })(); + + return SecretVolume; + })(); + + v2.EventTrigger = (function() { + + /** + * Properties of an EventTrigger. + * @memberof google.cloud.functions.v2 + * @interface IEventTrigger + * @property {string|null} [trigger] EventTrigger trigger + * @property {string|null} [triggerRegion] EventTrigger triggerRegion + * @property {string|null} [eventType] EventTrigger eventType + * @property {Array.|null} [eventFilters] EventTrigger eventFilters + * @property {string|null} [pubsubTopic] EventTrigger pubsubTopic + * @property {string|null} [serviceAccountEmail] EventTrigger serviceAccountEmail + * @property {google.cloud.functions.v2.EventTrigger.RetryPolicy|null} [retryPolicy] EventTrigger retryPolicy + * @property {string|null} [channel] EventTrigger channel + */ + + /** + * Constructs a new EventTrigger. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an EventTrigger. + * @implements IEventTrigger + * @constructor + * @param {google.cloud.functions.v2.IEventTrigger=} [properties] Properties to set + */ + function EventTrigger(properties) { + this.eventFilters = []; + 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]]; + } + + /** + * EventTrigger trigger. + * @member {string} trigger + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.trigger = ""; + + /** + * EventTrigger triggerRegion. + * @member {string} triggerRegion + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.triggerRegion = ""; + + /** + * EventTrigger eventType. + * @member {string} eventType + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.eventType = ""; + + /** + * EventTrigger eventFilters. + * @member {Array.} eventFilters + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.eventFilters = $util.emptyArray; + + /** + * EventTrigger pubsubTopic. + * @member {string} pubsubTopic + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.pubsubTopic = ""; + + /** + * EventTrigger serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.serviceAccountEmail = ""; + + /** + * EventTrigger retryPolicy. + * @member {google.cloud.functions.v2.EventTrigger.RetryPolicy} retryPolicy + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.retryPolicy = 0; + + /** + * EventTrigger channel. + * @member {string} channel + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.channel = ""; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.IEventTrigger=} [properties] Properties to set + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger instance + */ + EventTrigger.create = function create(properties) { + return new EventTrigger(properties); + }; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.trigger); + if (message.triggerRegion != null && Object.hasOwnProperty.call(message, "triggerRegion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerRegion); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.eventType); + if (message.eventFilters != null && message.eventFilters.length) + for (var i = 0; i < message.eventFilters.length; ++i) + $root.google.cloud.functions.v2.EventFilter.encode(message.eventFilters[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pubsubTopic != null && Object.hasOwnProperty.call(message, "pubsubTopic")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pubsubTopic); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.serviceAccountEmail); + if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.retryPolicy); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.channel); + return writer; + }; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.EventTrigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trigger = reader.string(); + break; + case 2: + message.triggerRegion = reader.string(); + break; + case 3: + message.eventType = reader.string(); + break; + case 4: + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2.EventFilter.decode(reader, reader.uint32())); + break; + case 5: + message.pubsubTopic = reader.string(); + break; + case 6: + message.serviceAccountEmail = reader.string(); + break; + case 7: + message.retryPolicy = reader.int32(); + break; + case 8: + message.channel = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventTrigger message. + * @function verify + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventTrigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) + if (!$util.isString(message.trigger)) + return "trigger: string expected"; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + if (!$util.isString(message.triggerRegion)) + return "triggerRegion: string expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.eventFilters != null && message.hasOwnProperty("eventFilters")) { + if (!Array.isArray(message.eventFilters)) + return "eventFilters: array expected"; + for (var i = 0; i < message.eventFilters.length; ++i) { + var error = $root.google.cloud.functions.v2.EventFilter.verify(message.eventFilters[i]); + if (error) + return "eventFilters." + error; + } + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + if (!$util.isString(message.pubsubTopic)) + return "pubsubTopic: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + switch (message.retryPolicy) { + default: + return "retryPolicy: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.channel != null && message.hasOwnProperty("channel")) + if (!$util.isString(message.channel)) + return "channel: string expected"; + return null; + }; + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger + */ + EventTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.EventTrigger) + return object; + var message = new $root.google.cloud.functions.v2.EventTrigger(); + if (object.trigger != null) + message.trigger = String(object.trigger); + if (object.triggerRegion != null) + message.triggerRegion = String(object.triggerRegion); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.eventFilters) { + if (!Array.isArray(object.eventFilters)) + throw TypeError(".google.cloud.functions.v2.EventTrigger.eventFilters: array expected"); + message.eventFilters = []; + for (var i = 0; i < object.eventFilters.length; ++i) { + if (typeof object.eventFilters[i] !== "object") + throw TypeError(".google.cloud.functions.v2.EventTrigger.eventFilters: object expected"); + message.eventFilters[i] = $root.google.cloud.functions.v2.EventFilter.fromObject(object.eventFilters[i]); + } + } + if (object.pubsubTopic != null) + message.pubsubTopic = String(object.pubsubTopic); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + switch (object.retryPolicy) { + case "RETRY_POLICY_UNSPECIFIED": + case 0: + message.retryPolicy = 0; + break; + case "RETRY_POLICY_DO_NOT_RETRY": + case 1: + message.retryPolicy = 1; + break; + case "RETRY_POLICY_RETRY": + case 2: + message.retryPolicy = 2; + break; + } + if (object.channel != null) + message.channel = String(object.channel); + return message; + }; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.EventTrigger} message EventTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.eventFilters = []; + if (options.defaults) { + object.trigger = ""; + object.triggerRegion = ""; + object.eventType = ""; + object.pubsubTopic = ""; + object.serviceAccountEmail = ""; + object.retryPolicy = options.enums === String ? "RETRY_POLICY_UNSPECIFIED" : 0; + object.channel = ""; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = message.trigger; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + object.triggerRegion = message.triggerRegion; + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.eventFilters && message.eventFilters.length) { + object.eventFilters = []; + for (var j = 0; j < message.eventFilters.length; ++j) + object.eventFilters[j] = $root.google.cloud.functions.v2.EventFilter.toObject(message.eventFilters[j], options); + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + object.pubsubTopic = message.pubsubTopic; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = message.channel; + return object; + }; + + /** + * Converts this EventTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + * @returns {Object.} JSON object + */ + EventTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * RetryPolicy enum. + * @name google.cloud.functions.v2.EventTrigger.RetryPolicy + * @enum {number} + * @property {number} RETRY_POLICY_UNSPECIFIED=0 RETRY_POLICY_UNSPECIFIED value + * @property {number} RETRY_POLICY_DO_NOT_RETRY=1 RETRY_POLICY_DO_NOT_RETRY value + * @property {number} RETRY_POLICY_RETRY=2 RETRY_POLICY_RETRY value + */ + EventTrigger.RetryPolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETRY_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "RETRY_POLICY_DO_NOT_RETRY"] = 1; + values[valuesById[2] = "RETRY_POLICY_RETRY"] = 2; + return values; + })(); + + return EventTrigger; + })(); + + v2.EventFilter = (function() { + + /** + * Properties of an EventFilter. + * @memberof google.cloud.functions.v2 + * @interface IEventFilter + * @property {string|null} [attribute] EventFilter attribute + * @property {string|null} [value] EventFilter value + * @property {string|null} [operator] EventFilter operator + */ + + /** + * Constructs a new EventFilter. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an EventFilter. + * @implements IEventFilter + * @constructor + * @param {google.cloud.functions.v2.IEventFilter=} [properties] Properties to set + */ + function EventFilter(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]]; + } + + /** + * EventFilter attribute. + * @member {string} attribute + * @memberof google.cloud.functions.v2.EventFilter + * @instance + */ + EventFilter.prototype.attribute = ""; + + /** + * EventFilter value. + * @member {string} value + * @memberof google.cloud.functions.v2.EventFilter + * @instance + */ + EventFilter.prototype.value = ""; + + /** + * EventFilter operator. + * @member {string} operator + * @memberof google.cloud.functions.v2.EventFilter + * @instance + */ + EventFilter.prototype.operator = ""; + + /** + * Creates a new EventFilter instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.IEventFilter=} [properties] Properties to set + * @returns {google.cloud.functions.v2.EventFilter} EventFilter instance + */ + EventFilter.create = function create(properties) { + return new EventFilter(properties); + }; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attribute != null && Object.hasOwnProperty.call(message, "attribute")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attribute); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.operator != null && Object.hasOwnProperty.call(message, "operator")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.operator); + return writer; + }; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.EventFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attribute = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.operator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventFilter message. + * @function verify + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventFilter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attribute != null && message.hasOwnProperty("attribute")) + if (!$util.isString(message.attribute)) + return "attribute: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.operator != null && message.hasOwnProperty("operator")) + if (!$util.isString(message.operator)) + return "operator: string expected"; + return null; + }; + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.EventFilter} EventFilter + */ + EventFilter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.EventFilter) + return object; + var message = new $root.google.cloud.functions.v2.EventFilter(); + if (object.attribute != null) + message.attribute = String(object.attribute); + if (object.value != null) + message.value = String(object.value); + if (object.operator != null) + message.operator = String(object.operator); + return message; + }; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.EventFilter} message EventFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventFilter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attribute = ""; + object.value = ""; + object.operator = ""; + } + if (message.attribute != null && message.hasOwnProperty("attribute")) + object.attribute = message.attribute; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.operator != null && message.hasOwnProperty("operator")) + object.operator = message.operator; + return object; + }; + + /** + * Converts this EventFilter to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.EventFilter + * @instance + * @returns {Object.} JSON object + */ + EventFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventFilter; + })(); + + v2.GetFunctionRequest = (function() { + + /** + * Properties of a GetFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface IGetFunctionRequest + * @property {string|null} [name] GetFunctionRequest name + */ + + /** + * Constructs a new GetFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GetFunctionRequest. + * @implements IGetFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.IGetFunctionRequest=} [properties] Properties to set + */ + function GetFunctionRequest(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]]; + } + + /** + * GetFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @instance + */ + GetFunctionRequest.prototype.name = ""; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.IGetFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest instance + */ + GetFunctionRequest.create = function create(properties) { + return new GetFunctionRequest(properties); + }; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.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 GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GetFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFunctionRequest.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 GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest + */ + GetFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GetFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.GetFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.GetFunctionRequest} message GetFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFunctionRequest.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 GetFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + GetFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetFunctionRequest; + })(); + + v2.ListFunctionsRequest = (function() { + + /** + * Properties of a ListFunctionsRequest. + * @memberof google.cloud.functions.v2 + * @interface IListFunctionsRequest + * @property {string|null} [parent] ListFunctionsRequest parent + * @property {number|null} [pageSize] ListFunctionsRequest pageSize + * @property {string|null} [pageToken] ListFunctionsRequest pageToken + * @property {string|null} [filter] ListFunctionsRequest filter + * @property {string|null} [orderBy] ListFunctionsRequest orderBy + */ + + /** + * Constructs a new ListFunctionsRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListFunctionsRequest. + * @implements IListFunctionsRequest + * @constructor + * @param {google.cloud.functions.v2.IListFunctionsRequest=} [properties] Properties to set + */ + function ListFunctionsRequest(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]]; + } + + /** + * ListFunctionsRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.parent = ""; + + /** + * ListFunctionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageSize = 0; + + /** + * ListFunctionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageToken = ""; + + /** + * ListFunctionsRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.filter = ""; + + /** + * ListFunctionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.IListFunctionsRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest instance + */ + ListFunctionsRequest.create = function create(properties) { + return new ListFunctionsRequest(properties); + }; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.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 ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListFunctionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + 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; + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsRequest message. + * @function verify + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsRequest.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 ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest + */ + ListFunctionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListFunctionsRequest) + return object; + var message = new $root.google.cloud.functions.v2.ListFunctionsRequest(); + 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 ListFunctionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.ListFunctionsRequest} message ListFunctionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsRequest.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; + }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsRequest; + })(); + + v2.ListFunctionsResponse = (function() { + + /** + * Properties of a ListFunctionsResponse. + * @memberof google.cloud.functions.v2 + * @interface IListFunctionsResponse + * @property {Array.|null} [functions] ListFunctionsResponse functions + * @property {string|null} [nextPageToken] ListFunctionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListFunctionsResponse unreachable + */ + + /** + * Constructs a new ListFunctionsResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListFunctionsResponse. + * @implements IListFunctionsResponse + * @constructor + * @param {google.cloud.functions.v2.IListFunctionsResponse=} [properties] Properties to set + */ + function ListFunctionsResponse(properties) { + this.functions = []; + 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]]; + } + + /** + * ListFunctionsResponse functions. + * @member {Array.} functions + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.functions = $util.emptyArray; + + /** + * ListFunctionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.nextPageToken = ""; + + /** + * ListFunctionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.IListFunctionsResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse instance + */ + ListFunctionsResponse.create = function create(properties) { + return new ListFunctionsResponse(properties); + }; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functions != null && message.functions.length) + for (var i = 0; i < message.functions.length; ++i) + $root.google.cloud.functions.v2.Function.encode(message.functions[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 ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListFunctionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2.Function.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; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsResponse message. + * @function verify + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functions != null && message.hasOwnProperty("functions")) { + if (!Array.isArray(message.functions)) + return "functions: array expected"; + for (var i = 0; i < message.functions.length; ++i) { + var error = $root.google.cloud.functions.v2.Function.verify(message.functions[i]); + if (error) + return "functions." + 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; + }; + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse + */ + ListFunctionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListFunctionsResponse) + return object; + var message = new $root.google.cloud.functions.v2.ListFunctionsResponse(); + if (object.functions) { + if (!Array.isArray(object.functions)) + throw TypeError(".google.cloud.functions.v2.ListFunctionsResponse.functions: array expected"); + message.functions = []; + for (var i = 0; i < object.functions.length; ++i) { + if (typeof object.functions[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ListFunctionsResponse.functions: object expected"); + message.functions[i] = $root.google.cloud.functions.v2.Function.fromObject(object.functions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.functions.v2.ListFunctionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.ListFunctionsResponse} message ListFunctionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.functions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.functions && message.functions.length) { + object.functions = []; + for (var j = 0; j < message.functions.length; ++j) + object.functions[j] = $root.google.cloud.functions.v2.Function.toObject(message.functions[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; + }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsResponse; + })(); + + v2.CreateFunctionRequest = (function() { + + /** + * Properties of a CreateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface ICreateFunctionRequest + * @property {string|null} [parent] CreateFunctionRequest parent + * @property {google.cloud.functions.v2.IFunction|null} ["function"] CreateFunctionRequest function + * @property {string|null} [functionId] CreateFunctionRequest functionId + */ + + /** + * Constructs a new CreateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a CreateFunctionRequest. + * @implements ICreateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.ICreateFunctionRequest=} [properties] Properties to set + */ + function CreateFunctionRequest(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]]; + } + + /** + * CreateFunctionRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.parent = ""; + + /** + * CreateFunctionRequest function. + * @member {google.cloud.functions.v2.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype["function"] = null; + + /** + * CreateFunctionRequest functionId. + * @member {string} functionId + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.functionId = ""; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.ICreateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest instance + */ + CreateFunctionRequest.create = function create(properties) { + return new CreateFunctionRequest(properties); + }; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.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["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2.Function.encode(message["function"], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.functionId != null && Object.hasOwnProperty.call(message, "functionId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.functionId); + return writer; + }; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.CreateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); + break; + case 3: + message.functionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateFunctionRequest.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["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (!$util.isString(message.functionId)) + return "functionId: string expected"; + return null; + }; + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest + */ + CreateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.CreateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.CreateFunctionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2.CreateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2.Function.fromObject(object["function"]); + } + if (object.functionId != null) + message.functionId = String(object.functionId); + return message; + }; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.CreateFunctionRequest} message CreateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object["function"] = null; + object.functionId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2.Function.toObject(message["function"], options); + if (message.functionId != null && message.hasOwnProperty("functionId")) + object.functionId = message.functionId; + return object; + }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateFunctionRequest; + })(); + + v2.UpdateFunctionRequest = (function() { + + /** + * Properties of an UpdateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface IUpdateFunctionRequest + * @property {google.cloud.functions.v2.IFunction|null} ["function"] UpdateFunctionRequest function + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFunctionRequest updateMask + */ + + /** + * Constructs a new UpdateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an UpdateFunctionRequest. + * @implements IUpdateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.IUpdateFunctionRequest=} [properties] Properties to set + */ + function UpdateFunctionRequest(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]]; + } + + /** + * UpdateFunctionRequest function. + * @member {google.cloud.functions.v2.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype["function"] = null; + + /** + * UpdateFunctionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.IUpdateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest instance + */ + UpdateFunctionRequest.create = function create(properties) { + return new UpdateFunctionRequest(properties); + }; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2.Function.encode(message["function"], 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 UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.UpdateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["function"] = $root.google.cloud.functions.v2.Function.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 an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2.Function.verify(message["function"]); + if (error) + return "function." + 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 an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest + */ + UpdateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.UpdateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.UpdateFunctionRequest(); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2.UpdateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2.Function.fromObject(object["function"]); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.functions.v2.UpdateFunctionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.UpdateFunctionRequest} message UpdateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object["function"] = null; + object.updateMask = null; + } + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2.Function.toObject(message["function"], options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateFunctionRequest; + })(); + + v2.DeleteFunctionRequest = (function() { + + /** + * Properties of a DeleteFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface IDeleteFunctionRequest + * @property {string|null} [name] DeleteFunctionRequest name + */ + + /** + * Constructs a new DeleteFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a DeleteFunctionRequest. + * @implements IDeleteFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.IDeleteFunctionRequest=} [properties] Properties to set + */ + function DeleteFunctionRequest(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]]; + } + + /** + * DeleteFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @instance + */ + DeleteFunctionRequest.prototype.name = ""; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.IDeleteFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest instance + */ + DeleteFunctionRequest.create = function create(properties) { + return new DeleteFunctionRequest(properties); + }; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.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 DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.DeleteFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteFunctionRequest.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 DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest + */ + DeleteFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.DeleteFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.DeleteFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.DeleteFunctionRequest} message DeleteFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteFunctionRequest.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 DeleteFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteFunctionRequest; + })(); + + v2.GenerateUploadUrlRequest = (function() { + + /** + * Properties of a GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2 + * @interface IGenerateUploadUrlRequest + * @property {string|null} [parent] GenerateUploadUrlRequest parent + */ + + /** + * Constructs a new GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateUploadUrlRequest. + * @implements IGenerateUploadUrlRequest + * @constructor + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest=} [properties] Properties to set + */ + function GenerateUploadUrlRequest(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]]; + } + + /** + * GenerateUploadUrlRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @instance + */ + GenerateUploadUrlRequest.prototype.parent = ""; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest instance + */ + GenerateUploadUrlRequest.create = function create(properties) { + return new GenerateUploadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.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); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateUploadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlRequest.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"; + return null; + }; + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest + */ + GenerateUploadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateUploadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2.GenerateUploadUrlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.GenerateUploadUrlRequest} message GenerateUploadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlRequest; + })(); + + v2.GenerateUploadUrlResponse = (function() { + + /** + * Properties of a GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2 + * @interface IGenerateUploadUrlResponse + * @property {string|null} [uploadUrl] GenerateUploadUrlResponse uploadUrl + * @property {google.cloud.functions.v2.IStorageSource|null} [storageSource] GenerateUploadUrlResponse storageSource + */ + + /** + * Constructs a new GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateUploadUrlResponse. + * @implements IGenerateUploadUrlResponse + * @constructor + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse=} [properties] Properties to set + */ + function GenerateUploadUrlResponse(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]]; + } + + /** + * GenerateUploadUrlResponse uploadUrl. + * @member {string} uploadUrl + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.uploadUrl = ""; + + /** + * GenerateUploadUrlResponse storageSource. + * @member {google.cloud.functions.v2.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.storageSource = null; + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse instance + */ + GenerateUploadUrlResponse.create = function create(properties) { + return new GenerateUploadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uploadUrl != null && Object.hasOwnProperty.call(message, "uploadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uploadUrl); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2.StorageSource.encode(message.storageSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateUploadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploadUrl = reader.string(); + break; + case 2: + message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + if (!$util.isString(message.uploadUrl)) + return "uploadUrl: string expected"; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + var error = $root.google.cloud.functions.v2.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + return null; + }; + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse + */ + GenerateUploadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateUploadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2.GenerateUploadUrlResponse(); + if (object.uploadUrl != null) + message.uploadUrl = String(object.uploadUrl); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2.GenerateUploadUrlResponse.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2.StorageSource.fromObject(object.storageSource); + } + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.GenerateUploadUrlResponse} message GenerateUploadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uploadUrl = ""; + object.storageSource = null; + } + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + object.uploadUrl = message.uploadUrl; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) + object.storageSource = $root.google.cloud.functions.v2.StorageSource.toObject(message.storageSource, options); + return object; + }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlResponse; + })(); + + v2.GenerateDownloadUrlRequest = (function() { + + /** + * Properties of a GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2 + * @interface IGenerateDownloadUrlRequest + * @property {string|null} [name] GenerateDownloadUrlRequest name + */ + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateDownloadUrlRequest. + * @implements IGenerateDownloadUrlRequest + * @constructor + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest=} [properties] Properties to set + */ + function GenerateDownloadUrlRequest(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]]; + } + + /** + * GenerateDownloadUrlRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @instance + */ + GenerateDownloadUrlRequest.prototype.name = ""; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest instance + */ + GenerateDownloadUrlRequest.create = function create(properties) { + return new GenerateDownloadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.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 GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateDownloadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlRequest.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 GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + */ + GenerateDownloadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateDownloadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2.GenerateDownloadUrlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.GenerateDownloadUrlRequest} message GenerateDownloadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlRequest.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 GenerateDownloadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlRequest; + })(); + + v2.GenerateDownloadUrlResponse = (function() { + + /** + * Properties of a GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2 + * @interface IGenerateDownloadUrlResponse + * @property {string|null} [downloadUrl] GenerateDownloadUrlResponse downloadUrl + */ + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateDownloadUrlResponse. + * @implements IGenerateDownloadUrlResponse + * @constructor + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse=} [properties] Properties to set + */ + function GenerateDownloadUrlResponse(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]]; + } + + /** + * GenerateDownloadUrlResponse downloadUrl. + * @member {string} downloadUrl + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @instance + */ + GenerateDownloadUrlResponse.prototype.downloadUrl = ""; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse instance + */ + GenerateDownloadUrlResponse.create = function create(properties) { + return new GenerateDownloadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.downloadUrl != null && Object.hasOwnProperty.call(message, "downloadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.downloadUrl); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateDownloadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.downloadUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + if (!$util.isString(message.downloadUrl)) + return "downloadUrl: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + */ + GenerateDownloadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateDownloadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2.GenerateDownloadUrlResponse(); + if (object.downloadUrl != null) + message.downloadUrl = String(object.downloadUrl); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.GenerateDownloadUrlResponse} message GenerateDownloadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.downloadUrl = ""; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + object.downloadUrl = message.downloadUrl; + return object; + }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlResponse; + })(); + + v2.ListRuntimesRequest = (function() { + + /** + * Properties of a ListRuntimesRequest. + * @memberof google.cloud.functions.v2 + * @interface IListRuntimesRequest + * @property {string|null} [parent] ListRuntimesRequest parent + * @property {string|null} [filter] ListRuntimesRequest filter + */ + + /** + * Constructs a new ListRuntimesRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListRuntimesRequest. + * @implements IListRuntimesRequest + * @constructor + * @param {google.cloud.functions.v2.IListRuntimesRequest=} [properties] Properties to set + */ + function ListRuntimesRequest(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]]; + } + + /** + * ListRuntimesRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.parent = ""; + + /** + * ListRuntimesRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.filter = ""; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.IListRuntimesRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest instance + */ + ListRuntimesRequest.create = function create(properties) { + return new ListRuntimesRequest(properties); + }; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.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.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListRuntimesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesRequest message. + * @function verify + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesRequest.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.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest + */ + ListRuntimesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListRuntimesRequest) + return object; + var message = new $root.google.cloud.functions.v2.ListRuntimesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.ListRuntimesRequest} message ListRuntimesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListRuntimesRequest; + })(); + + v2.ListRuntimesResponse = (function() { + + /** + * Properties of a ListRuntimesResponse. + * @memberof google.cloud.functions.v2 + * @interface IListRuntimesResponse + * @property {Array.|null} [runtimes] ListRuntimesResponse runtimes + */ + + /** + * Constructs a new ListRuntimesResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListRuntimesResponse. + * @implements IListRuntimesResponse + * @constructor + * @param {google.cloud.functions.v2.IListRuntimesResponse=} [properties] Properties to set + */ + function ListRuntimesResponse(properties) { + this.runtimes = []; + 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]]; + } + + /** + * ListRuntimesResponse runtimes. + * @member {Array.} runtimes + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @instance + */ + ListRuntimesResponse.prototype.runtimes = $util.emptyArray; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.IListRuntimesResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse instance + */ + ListRuntimesResponse.create = function create(properties) { + return new ListRuntimesResponse(properties); + }; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.runtimes != null && message.runtimes.length) + for (var i = 0; i < message.runtimes.length; ++i) + $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.encode(message.runtimes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListRuntimesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesResponse message. + * @function verify + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.runtimes != null && message.hasOwnProperty("runtimes")) { + if (!Array.isArray(message.runtimes)) + return "runtimes: array expected"; + for (var i = 0; i < message.runtimes.length; ++i) { + var error = $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify(message.runtimes[i]); + if (error) + return "runtimes." + error; + } + } + return null; + }; + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse + */ + ListRuntimesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListRuntimesResponse) + return object; + var message = new $root.google.cloud.functions.v2.ListRuntimesResponse(); + if (object.runtimes) { + if (!Array.isArray(object.runtimes)) + throw TypeError(".google.cloud.functions.v2.ListRuntimesResponse.runtimes: array expected"); + message.runtimes = []; + for (var i = 0; i < object.runtimes.length; ++i) { + if (typeof object.runtimes[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ListRuntimesResponse.runtimes: object expected"); + message.runtimes[i] = $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.fromObject(object.runtimes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse} message ListRuntimesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.runtimes = []; + if (message.runtimes && message.runtimes.length) { + object.runtimes = []; + for (var j = 0; j < message.runtimes.length; ++j) + object.runtimes[j] = $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.toObject(message.runtimes[j], options); + } + return object; + }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ListRuntimesResponse.Runtime = (function() { + + /** + * Properties of a Runtime. + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @interface IRuntime + * @property {string|null} [name] Runtime name + * @property {string|null} [displayName] Runtime displayName + * @property {google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|null} [stage] Runtime stage + * @property {Array.|null} [warnings] Runtime warnings + * @property {google.cloud.functions.v2.Environment|null} [environment] Runtime environment + */ + + /** + * Constructs a new Runtime. + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @classdesc Represents a Runtime. + * @implements IRuntime + * @constructor + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime=} [properties] Properties to set + */ + function Runtime(properties) { + this.warnings = []; + 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]]; + } + + /** + * Runtime name. + * @member {string} name + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.name = ""; + + /** + * Runtime displayName. + * @member {string} displayName + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.displayName = ""; + + /** + * Runtime stage. + * @member {google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage} stage + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.stage = 0; + + /** + * Runtime warnings. + * @member {Array.} warnings + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.warnings = $util.emptyArray; + + /** + * Runtime environment. + * @member {google.cloud.functions.v2.Environment} environment + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.environment = 0; + + /** + * Creates a new Runtime instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime instance + */ + Runtime.create = function create(properties) { + return new Runtime(properties); + }; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.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.stage != null && Object.hasOwnProperty.call(message, "stage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.stage); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.warnings[i]); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.environment); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 5: + message.displayName = reader.string(); + break; + case 2: + message.stage = reader.int32(); + break; + case 3: + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + case 4: + message.environment = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Runtime message. + * @function verify + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Runtime.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.stage != null && message.hasOwnProperty("stage")) + switch (message.stage) { + default: + return "stage: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) + if (!$util.isString(message.warnings[i])) + return "warnings: string[] expected"; + } + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime + */ + Runtime.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime) + return object; + var message = new $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.stage) { + case "RUNTIME_STAGE_UNSPECIFIED": + case 0: + message.stage = 0; + break; + case "DEVELOPMENT": + case 1: + message.stage = 1; + break; + case "ALPHA": + case 2: + message.stage = 2; + break; + case "BETA": + case 3: + message.stage = 3; + break; + case "GA": + case 4: + message.stage = 4; + break; + case "DEPRECATED": + case 5: + message.stage = 5; + break; + case "DECOMMISSIONED": + case 6: + message.stage = 6; + break; + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.functions.v2.ListRuntimesResponse.Runtime.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) + message.warnings[i] = String(object.warnings[i]); + } + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.Runtime} message Runtime + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Runtime.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.warnings = []; + if (options.defaults) { + object.name = ""; + object.stage = options.enums === String ? "RUNTIME_STAGE_UNSPECIFIED" : 0; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.stage != null && message.hasOwnProperty("stage")) + object.stage = options.enums === String ? $root.google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = message.warnings[j]; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + return object; + }; + + /** + * Converts this Runtime to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + * @returns {Object.} JSON object + */ + Runtime.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Runtime; + })(); + + /** + * RuntimeStage enum. + * @name google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage + * @enum {number} + * @property {number} RUNTIME_STAGE_UNSPECIFIED=0 RUNTIME_STAGE_UNSPECIFIED value + * @property {number} DEVELOPMENT=1 DEVELOPMENT 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 + * @property {number} DECOMMISSIONED=6 DECOMMISSIONED value + */ + ListRuntimesResponse.RuntimeStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RUNTIME_STAGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DEVELOPMENT"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + values[valuesById[6] = "DECOMMISSIONED"] = 6; + return values; + })(); + + return ListRuntimesResponse; + })(); + + v2.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.functions.v2 + * @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} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion + * @property {google.protobuf.IAny|null} [requestResource] OperationMetadata requestResource + * @property {Array.|null} [stages] OperationMetadata stages + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.functions.v2.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + this.stages = []; + 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.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * OperationMetadata requestResource. + * @member {google.protobuf.IAny|null|undefined} requestResource + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.requestResource = null; + + /** + * OperationMetadata stages. + * @member {Array.} stages + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stages = $util.emptyArray; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.functions.v2.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.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.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + if (message.requestResource != null && Object.hasOwnProperty.call(message, "requestResource")) + $root.google.protobuf.Any.encode(message.requestResource, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.stages != null && message.stages.length) + for (var i = 0; i < message.stages.length; ++i) + $root.google.cloud.functions.v2.Stage.encode(message.stages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.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.functions.v2.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.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) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + 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.statusDetail = reader.string(); + break; + case 6: + message.cancelRequested = reader.bool(); + break; + case 7: + message.apiVersion = reader.string(); + break; + case 8: + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2.Stage.decode(reader, reader.uint32())); + 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.functions.v2.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.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.functions.v2.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.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) { + var error = $root.google.protobuf.Any.verify(message.requestResource); + if (error) + return "requestResource." + error; + } + if (message.stages != null && message.hasOwnProperty("stages")) { + if (!Array.isArray(message.stages)) + return "stages: array expected"; + for (var i = 0; i < message.stages.length; ++i) { + var error = $root.google.cloud.functions.v2.Stage.verify(message.stages[i]); + if (error) + return "stages." + error; + } + } + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.OperationMetadata) + return object; + var message = new $root.google.cloud.functions.v2.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.functions.v2.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.functions.v2.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.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + if (object.requestResource != null) { + if (typeof object.requestResource !== "object") + throw TypeError(".google.cloud.functions.v2.OperationMetadata.requestResource: object expected"); + message.requestResource = $root.google.protobuf.Any.fromObject(object.requestResource); + } + if (object.stages) { + if (!Array.isArray(object.stages)) + throw TypeError(".google.cloud.functions.v2.OperationMetadata.stages: array expected"); + message.stages = []; + for (var i = 0; i < object.stages.length; ++i) { + if (typeof object.stages[i] !== "object") + throw TypeError(".google.cloud.functions.v2.OperationMetadata.stages: object expected"); + message.stages[i] = $root.google.cloud.functions.v2.Stage.fromObject(object.stages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.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.arrays || options.defaults) + object.stages = []; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; + object.requestResource = null; + } + 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.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) + object.requestResource = $root.google.protobuf.Any.toObject(message.requestResource, options); + if (message.stages && message.stages.length) { + object.stages = []; + for (var j = 0; j < message.stages.length; ++j) + object.stages[j] = $root.google.cloud.functions.v2.Stage.toObject(message.stages[j], options); + } + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadata; + })(); + + v2.Stage = (function() { + + /** + * Properties of a Stage. + * @memberof google.cloud.functions.v2 + * @interface IStage + * @property {google.cloud.functions.v2.Stage.Name|null} [name] Stage name + * @property {string|null} [message] Stage message + * @property {google.cloud.functions.v2.Stage.State|null} [state] Stage state + * @property {string|null} [resource] Stage resource + * @property {string|null} [resourceUri] Stage resourceUri + * @property {Array.|null} [stateMessages] Stage stateMessages + */ + + /** + * Constructs a new Stage. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a Stage. + * @implements IStage + * @constructor + * @param {google.cloud.functions.v2.IStage=} [properties] Properties to set + */ + function Stage(properties) { + this.stateMessages = []; + 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]]; + } + + /** + * Stage name. + * @member {google.cloud.functions.v2.Stage.Name} name + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.name = 0; + + /** + * Stage message. + * @member {string} message + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.message = ""; + + /** + * Stage state. + * @member {google.cloud.functions.v2.Stage.State} state + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.state = 0; + + /** + * Stage resource. + * @member {string} resource + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.resource = ""; + + /** + * Stage resourceUri. + * @member {string} resourceUri + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.resourceUri = ""; + + /** + * Stage stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Stage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.IStage=} [properties] Properties to set + * @returns {google.cloud.functions.v2.Stage} Stage instance + */ + Stage.create = function create(properties) { + return new Stage(properties); + }; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.name); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.resource); + if (message.resourceUri != null && Object.hasOwnProperty.call(message, "resourceUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resourceUri); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.Stage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.int32(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.resource = reader.string(); + break; + case 5: + message.resourceUri = reader.string(); + break; + case 6: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Stage message. + * @function verify + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Stage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + switch (message.name) { + default: + return "name: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + if (!$util.isString(message.resourceUri)) + return "resourceUri: string expected"; + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.Stage} Stage + */ + Stage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.Stage) + return object; + var message = new $root.google.cloud.functions.v2.Stage(); + switch (object.name) { + case "NAME_UNSPECIFIED": + case 0: + message.name = 0; + break; + case "ARTIFACT_REGISTRY": + case 1: + message.name = 1; + break; + case "BUILD": + case 2: + message.name = 2; + break; + case "SERVICE": + case 3: + message.name = 3; + break; + case "TRIGGER": + case 4: + message.name = 4; + break; + case "SERVICE_ROLLBACK": + case 5: + message.name = 5; + break; + case "TRIGGER_ROLLBACK": + case 6: + message.name = 6; + break; + } + if (object.message != null) + message.message = String(object.message); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "NOT_STARTED": + case 1: + message.state = 1; + break; + case "IN_PROGRESS": + case 2: + message.state = 2; + break; + case "COMPLETE": + case 3: + message.state = 3; + break; + } + if (object.resource != null) + message.resource = String(object.resource); + if (object.resourceUri != null) + message.resourceUri = String(object.resourceUri); + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2.Stage.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2.Stage.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.Stage} message Stage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Stage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.defaults) { + object.name = options.enums === String ? "NAME_UNSPECIFIED" : 0; + object.message = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.resource = ""; + object.resourceUri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = options.enums === String ? $root.google.cloud.functions.v2.Stage.Name[message.name] : message.name; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2.Stage.State[message.state] : message.state; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + object.resourceUri = message.resourceUri; + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2.StateMessage.toObject(message.stateMessages[j], options); + } + return object; + }; + + /** + * Converts this Stage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.Stage + * @instance + * @returns {Object.} JSON object + */ + Stage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Name enum. + * @name google.cloud.functions.v2.Stage.Name + * @enum {number} + * @property {number} NAME_UNSPECIFIED=0 NAME_UNSPECIFIED value + * @property {number} ARTIFACT_REGISTRY=1 ARTIFACT_REGISTRY value + * @property {number} BUILD=2 BUILD value + * @property {number} SERVICE=3 SERVICE value + * @property {number} TRIGGER=4 TRIGGER value + * @property {number} SERVICE_ROLLBACK=5 SERVICE_ROLLBACK value + * @property {number} TRIGGER_ROLLBACK=6 TRIGGER_ROLLBACK value + */ + Stage.Name = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NAME_UNSPECIFIED"] = 0; + values[valuesById[1] = "ARTIFACT_REGISTRY"] = 1; + values[valuesById[2] = "BUILD"] = 2; + values[valuesById[3] = "SERVICE"] = 3; + values[valuesById[4] = "TRIGGER"] = 4; + values[valuesById[5] = "SERVICE_ROLLBACK"] = 5; + values[valuesById[6] = "TRIGGER_ROLLBACK"] = 6; + return values; + })(); + + /** + * State enum. + * @name google.cloud.functions.v2.Stage.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} NOT_STARTED=1 NOT_STARTED value + * @property {number} IN_PROGRESS=2 IN_PROGRESS value + * @property {number} COMPLETE=3 COMPLETE value + */ + Stage.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_STARTED"] = 1; + values[valuesById[2] = "IN_PROGRESS"] = 2; + values[valuesById[3] = "COMPLETE"] = 3; + return values; + })(); + + return Stage; + })(); + + return v2; + })(); + functions.v2alpha = (function() { /** diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index deecc0c40b8..31d343a0d5c 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -808,6 +808,991 @@ } } }, + "v2": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v2;functions", + "java_multiple_files": true, + "java_outer_classname": "FunctionsProto", + "java_package": "com.google.cloud.functions.v2", + "objc_class_prefix": "GCF", + "(google.api.resource_definition).type": "cloudkms.googleapis.com/CryptoKey", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" + }, + "nested": { + "FunctionService": { + "options": { + "(google.api.default_host)": "cloudfunctions.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "GetFunction": { + "requestType": "GetFunctionRequest", + "responseType": "Function", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListFunctions": { + "requestType": "ListFunctionsRequest", + "responseType": "ListFunctionsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/functions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/functions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateFunction": { + "requestType": "CreateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}/functions", + "(google.api.http).body": "function", + "(google.api.method_signature)": "parent,function,function_id", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}/functions", + "body": "function" + } + }, + { + "(google.api.method_signature)": "parent,function,function_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2.Function", + "metadata_type": "google.cloud.functions.v2.OperationMetadata" + } + } + ] + }, + "UpdateFunction": { + "requestType": "UpdateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2/{function.name=projects/*/locations/*/functions/*}", + "(google.api.http).body": "function", + "(google.api.method_signature)": "function,update_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{function.name=projects/*/locations/*/functions/*}", + "body": "function" + } + }, + { + "(google.api.method_signature)": "function,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2.Function", + "metadata_type": "google.cloud.functions.v2.OperationMetadata" + } + } + ] + }, + "DeleteFunction": { + "requestType": "DeleteFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.functions.v2.OperationMetadata" + } + } + ] + }, + "GenerateUploadUrl": { + "requestType": "GenerateUploadUrlRequest", + "responseType": "GenerateUploadUrlResponse", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "body": "*" + } + } + ] + }, + "GenerateDownloadUrl": { + "requestType": "GenerateDownloadUrlRequest", + "responseType": "GenerateDownloadUrlResponse", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "body": "*" + } + } + ] + }, + "ListRuntimes": { + "requestType": "ListRuntimesRequest", + "responseType": "ListRuntimesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/runtimes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/runtimes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Environment": { + "values": { + "ENVIRONMENT_UNSPECIFIED": 0, + "GEN_1": 1, + "GEN_2": 2 + } + }, + "Function": { + "options": { + "(google.api.resource).type": "cloudfunctions.googleapis.com/Function", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/functions/{function}", + "(google.api.resource).plural": "functions", + "(google.api.resource).singular": "function" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "environment": { + "type": "Environment", + "id": 10 + }, + "description": { + "type": "string", + "id": 2 + }, + "buildConfig": { + "type": "BuildConfig", + "id": 3 + }, + "serviceConfig": { + "type": "ServiceConfig", + "id": 4 + }, + "eventTrigger": { + "type": "EventTrigger", + "id": 5 + }, + "state": { + "type": "State", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "FAILED": 2, + "DEPLOYING": 3, + "DELETING": 4, + "UNKNOWN": 5 + } + } + } + }, + "StateMessage": { + "fields": { + "severity": { + "type": "Severity", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "ERROR": 1, + "WARNING": 2, + "INFO": 3 + } + } + } + }, + "StorageSource": { + "fields": { + "bucket": { + "type": "string", + "id": 1 + }, + "object": { + "type": "string", + "id": 2 + }, + "generation": { + "type": "int64", + "id": 3 + } + } + }, + "RepoSource": { + "oneofs": { + "revision": { + "oneof": [ + "branchName", + "tagName", + "commitSha" + ] + } + }, + "fields": { + "branchName": { + "type": "string", + "id": 3 + }, + "tagName": { + "type": "string", + "id": 4 + }, + "commitSha": { + "type": "string", + "id": 5 + }, + "projectId": { + "type": "string", + "id": 1 + }, + "repoName": { + "type": "string", + "id": 2 + }, + "dir": { + "type": "string", + "id": 6 + }, + "invertRegex": { + "type": "bool", + "id": 7 + } + } + }, + "Source": { + "oneofs": { + "source": { + "oneof": [ + "storageSource", + "repoSource" + ] + } + }, + "fields": { + "storageSource": { + "type": "StorageSource", + "id": 1 + }, + "repoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "SourceProvenance": { + "fields": { + "resolvedStorageSource": { + "type": "StorageSource", + "id": 1 + }, + "resolvedRepoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "BuildConfig": { + "fields": { + "build": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Build" + } + }, + "runtime": { + "type": "string", + "id": 2 + }, + "entryPoint": { + "type": "string", + "id": 3 + }, + "source": { + "type": "Source", + "id": 4 + }, + "sourceProvenance": { + "type": "SourceProvenance", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "workerPool": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/WorkerPool" + } + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "dockerRepository": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "artifactregistry.googleapis.com/Repository" + } + } + } + }, + "ServiceConfig": { + "fields": { + "service": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "run.googleapis.com/Service" + } + }, + "timeoutSeconds": { + "type": "int32", + "id": 2 + }, + "availableMemory": { + "type": "string", + "id": 13 + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 4 + }, + "maxInstanceCount": { + "type": "int32", + "id": 5 + }, + "minInstanceCount": { + "type": "int32", + "id": 12 + }, + "vpcConnector": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "vpcaccess.googleapis.com/Connector" + } + }, + "vpcConnectorEgressSettings": { + "type": "VpcConnectorEgressSettings", + "id": 7 + }, + "ingressSettings": { + "type": "IngressSettings", + "id": 8 + }, + "uri": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 10 + }, + "allTrafficOnLatestRevision": { + "type": "bool", + "id": 16 + }, + "secretEnvironmentVariables": { + "rule": "repeated", + "type": "SecretEnvVar", + "id": 17 + }, + "secretVolumes": { + "rule": "repeated", + "type": "SecretVolume", + "id": 19 + }, + "revision": { + "type": "string", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VpcConnectorEgressSettings": { + "values": { + "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": 0, + "PRIVATE_RANGES_ONLY": 1, + "ALL_TRAFFIC": 2 + } + }, + "IngressSettings": { + "values": { + "INGRESS_SETTINGS_UNSPECIFIED": 0, + "ALLOW_ALL": 1, + "ALLOW_INTERNAL_ONLY": 2, + "ALLOW_INTERNAL_AND_GCLB": 3 + } + } + } + }, + "SecretEnvVar": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "version": { + "type": "string", + "id": 4 + } + } + }, + "SecretVolume": { + "fields": { + "mountPath": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "versions": { + "rule": "repeated", + "type": "SecretVersion", + "id": 4 + } + }, + "nested": { + "SecretVersion": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + } + } + }, + "EventTrigger": { + "fields": { + "trigger": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" + } + }, + "triggerRegion": { + "type": "string", + "id": 2 + }, + "eventType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventFilters": { + "rule": "repeated", + "type": "EventFilter", + "id": 4 + }, + "pubsubTopic": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "pubsub.googleapis.com/Topic" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retryPolicy": { + "type": "RetryPolicy", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "channel": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } + } + }, + "nested": { + "RetryPolicy": { + "values": { + "RETRY_POLICY_UNSPECIFIED": 0, + "RETRY_POLICY_DO_NOT_RETRY": 1, + "RETRY_POLICY_RETRY": 2 + } + } + } + }, + "EventFilter": { + "fields": { + "attribute": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "value": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "operator": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GetFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "ListFunctionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudfunctions.googleapis.com/Function" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 5 + } + } + }, + "ListFunctionsResponse": { + "fields": { + "functions": { + "rule": "repeated", + "type": "Function", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "CreateFunctionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "function": { + "type": "Function", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "functionId": { + "type": "string", + "id": 3 + } + } + }, + "UpdateFunctionRequest": { + "fields": { + "function": { + "type": "Function", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateUploadUrlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + } + } + }, + "GenerateUploadUrlResponse": { + "fields": { + "uploadUrl": { + "type": "string", + "id": 1 + }, + "storageSource": { + "type": "StorageSource", + "id": 2 + } + } + }, + "GenerateDownloadUrlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateDownloadUrlResponse": { + "fields": { + "downloadUrl": { + "type": "string", + "id": 1 + } + } + }, + "ListRuntimesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "filter": { + "type": "string", + "id": 2 + } + } + }, + "ListRuntimesResponse": { + "fields": { + "runtimes": { + "rule": "repeated", + "type": "Runtime", + "id": 1 + } + }, + "nested": { + "Runtime": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 5 + }, + "stage": { + "type": "RuntimeStage", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "environment": { + "type": "Environment", + "id": 4 + } + } + }, + "RuntimeStage": { + "values": { + "RUNTIME_STAGE_UNSPECIFIED": 0, + "DEVELOPMENT": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5, + "DECOMMISSIONED": 6 + } + } + } + }, + "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 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + }, + "requestResource": { + "type": "google.protobuf.Any", + "id": 8 + }, + "stages": { + "rule": "repeated", + "type": "Stage", + "id": 9 + } + } + }, + "Stage": { + "fields": { + "name": { + "type": "Name", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 3 + }, + "resource": { + "type": "string", + "id": 4 + }, + "resourceUri": { + "type": "string", + "id": 5 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 6 + } + }, + "nested": { + "Name": { + "values": { + "NAME_UNSPECIFIED": 0, + "ARTIFACT_REGISTRY": 1, + "BUILD": 2, + "SERVICE": 3, + "TRIGGER": 4, + "SERVICE_ROLLBACK": 5, + "TRIGGER_ROLLBACK": 6 + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "NOT_STARTED": 1, + "IN_PROGRESS": 2, + "COMPLETE": 3 + } + } + } + } + } + }, "v2alpha": { "options": { "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v2alpha;functions", diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js new file mode 100644 index 00000000000..7198882b668 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, function1) { + // [START cloudfunctions_v2_generated_FunctionService_CreateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2_generated_FunctionService_CreateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js new file mode 100644 index 00000000000..9744732034c --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js new file mode 100644 index 00000000000..fa98e64f8ae --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js new file mode 100644 index 00000000000..ab5e53d96cf --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js new file mode 100644 index 00000000000..6ea862fc56d --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudfunctions_v2_generated_FunctionService_GetFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2_generated_FunctionService_GetFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js new file mode 100644 index 00000000000..f73e73993fa --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudfunctions_v2_generated_FunctionService_ListFunctions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2_generated_FunctionService_ListFunctions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js new file mode 100644 index 00000000000..5f1c1aa5ce5 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudfunctions_v2_generated_FunctionService_ListRuntimes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js new file mode 100644 index 00000000000..4809d97928b --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(function1) { + // [START cloudfunctions_v2_generated_FunctionService_UpdateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json new file mode 100644 index 00000000000..f7cda5ba911 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -0,0 +1,367 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "2.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", + "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.functions.v2.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-functions/src/index.ts b/packages/google-cloud-functions/src/index.ts index 9a05b7715c9..ee0653e9ff7 100644 --- a/packages/google-cloud-functions/src/index.ts +++ b/packages/google-cloud-functions/src/index.ts @@ -17,13 +17,14 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v2 from './v2'; import * as v2alpha from './v2alpha'; import * as v2beta from './v2beta'; const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; type CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; -export {v1, v2alpha, v2beta, CloudFunctionsServiceClient}; -export default {v1, v2alpha, v2beta, CloudFunctionsServiceClient}; +export {v1, v2, v2alpha, v2beta, CloudFunctionsServiceClient}; +export default {v1, v2, v2alpha, v2beta, CloudFunctionsServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-functions/src/v2/function_service_client.ts b/packages/google-cloud-functions/src/v2/function_service_client.ts new file mode 100644 index 00000000000..53fab6b0fa9 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -0,0 +1,2413 @@ +// Copyright 2022 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 * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2 + */ +export class FunctionServiceClient { + 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}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @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://developers.google.com/identity/protocols/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.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); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new IamClient(this._gaxGrpc, opts); + + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && '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 if (opts.fallback === 'rest') { + 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 = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'functions' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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 === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + body: '*', + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + body: '*', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2.Function' + ) as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata' + ) as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2.Function' + ) as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata' + ) as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata) + ), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata) + ), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2.FunctionService', + 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 = gax.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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.functions.v2.FunctionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2.FunctionService, + 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 functionServiceStubMethods = [ + 'getFunction', + 'listFunctions', + 'createFunction', + 'updateFunction', + 'deleteFunction', + 'generateUploadUrl', + 'generateDownloadUrl', + 'listRuntimes', + ]; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * 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 -- + // ------------------- + /** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Function]{@link google.cloud.functions.v2.Function}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.get_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2.IGetFunctionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | undefined, + {} | undefined + ] + >; + getFunction( + request: protos.google.cloud.functions.v2.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; + getFunction( + request: protos.google.cloud.functions.v2.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; + getFunction( + request?: protos.google.cloud.functions.v2.IGetFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IFunction, + | protos.google.cloud.functions.v2.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFunction(request, options, callback); + } + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v2.GenerateUploadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | undefined, + {} | undefined + ] + >; + generateUploadUrl( + request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.generateUploadUrl(request, options, callback); + } + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage signed + * URL should 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 [GenerateDownloadUrlResponse]{@link google.cloud.functions.v2.GenerateDownloadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | undefined, + {} | undefined + ] + >; + generateDownloadUrl( + request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.generateDownloadUrl(request, options, callback); + } + /** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListRuntimesResponse]{@link google.cloud.functions.v2.ListRuntimesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2.IListRuntimesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | undefined, + {} | undefined + ] + >; + listRuntimes( + request: protos.google.cloud.functions.v2.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request: protos.google.cloud.functions.v2.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request?: protos.google.cloud.functions.v2.IListRuntimesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + | protos.google.cloud.functions.v2.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listRuntimes(request, options, callback); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.create_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createFunction( + request: protos.google.cloud.functions.v2.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request: protos.google.cloud.functions.v2.ICreateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.create_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + >; + } + /** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.update_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateFunction( + request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.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'] = + gax.routingHeader.fromParams({ + 'function.name': request.function!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.update_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + >; + } + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.delete_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteFunction( + request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.delete_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2.OperationMetadata + >; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Function]{@link google.cloud.functions.v2.Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction[], + protos.google.cloud.functions.v2.IListFunctionsRequest | null, + protos.google.cloud.functions.v2.IListFunctionsResponse + ] + >; + listFunctions( + request: protos.google.cloud.functions.v2.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + > + ): void; + listFunctions( + request: protos.google.cloud.functions.v2.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + > + ): void; + listFunctions( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + >, + callback?: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + > + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction[], + protos.google.cloud.functions.v2.IListFunctionsRequest | null, + protos.google.cloud.functions.v2.IListFunctionsResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFunctions(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, 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 function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [Function]{@link google.cloud.functions.v2.Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listFunctions`, 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 function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Function]{@link google.cloud.functions.v2.Function}. 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/function_service.list_functions.js + * region_tag:cloudfunctions_v2_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as unknown as RequestType, + 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 [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + + /** + * 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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * 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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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, + options?: + | 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]> { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | 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 { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project: string, location: string, build: string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project: string, location: string, channel: string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project: string, location: string, connector: string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .connector; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project: string, location: string, functionParam: string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * 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 project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project: string, location: string, repository: string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project: string, location: string, service: string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project: string, topic: string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project: string, location: string, trigger: string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project: string, location: string, workerPool: string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-functions/src/v2/function_service_client_config.json b/packages/google-cloud-functions/src/v2/function_service_client_config.json new file mode 100644 index 00000000000..936769f0cb7 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2/function_service_proto_list.json b/packages/google-cloud-functions/src/v2/function_service_proto_list.json new file mode 100644 index 00000000000..cfde205a091 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2/functions.proto" +] diff --git a/packages/google-cloud-functions/src/v2/gapic_metadata.json b/packages/google-cloud-functions/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..4342a4d7966 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2/index.ts b/packages/google-cloud-functions/src/v2/index.ts new file mode 100644 index 00000000000..a9477c6cf34 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 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. ** + +export {FunctionServiceClient} from './function_service_client'; diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2.ts b/packages/google-cloud-functions/test/gapic_function_service_v2.ts new file mode 100644 index 00000000000..52f37991902 --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2.ts @@ -0,0 +1,3093 @@ +// Copyright 2022 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; + +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('v2.FunctionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.Function() + ); + client.innerApiCalls.getFunction = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IFunction | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFunction(request), expectedError); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IGenerateUploadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateUploadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IListRuntimesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listRuntimes(request), expectedError); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createFunction(request), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFunction(request), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteFunction(request), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IFunction[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listFunctions(request), expectedError); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2.Function) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + 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.ListOperationsResponse[] = + []; + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.ListOperationsResponse[] = + []; + 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('build', () => { + const fakePath = '/rendered/path/build'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + build: 'buildValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.buildPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath( + 'projectValue', + 'locationValue', + 'buildValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, 'buildValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('channel', () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + channel: 'channelValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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', + '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('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('connector', () => { + const fakePath = '/rendered/path/connector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + connector: 'connectorValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('function', () => { + const fakePath = '/rendered/path/function'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + function: 'functionValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.functionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath( + 'projectValue', + 'locationValue', + 'functionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, 'functionValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('repository', () => { + const fakePath = '/rendered/path/repository'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + repository: 'repositoryValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath( + 'projectValue', + 'locationValue', + 'repositoryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, 'repositoryValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath( + 'projectValue', + 'locationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('topic', () => { + const fakePath = '/rendered/path/topic'; + const expectedParameters = { + project: 'projectValue', + topic: 'topicValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.topicPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath('projectValue', 'topicValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, 'topicValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('trigger', () => { + const fakePath = '/rendered/path/trigger'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + trigger: 'triggerValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath( + 'projectValue', + 'locationValue', + 'triggerValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, 'triggerValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('workerPool', () => { + const fakePath = '/rendered/path/workerPool'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + worker_pool: 'workerPoolValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath( + 'projectValue', + 'locationValue', + 'workerPoolValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'workerPoolValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});