google-cloud-video_intelligence 2.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/AUTHENTICATION.md +51 -59
- data/LICENSE.md +203 -0
- data/MIGRATING.md +274 -0
- data/README.md +36 -62
- data/lib/{google/cloud/video_intelligence/credentials.rb → google-cloud-video_intelligence.rb} +5 -13
- data/lib/google/cloud/video_intelligence.rb +88 -157
- data/lib/google/cloud/video_intelligence/version.rb +6 -2
- metadata +99 -83
- data/LICENSE +0 -201
- data/lib/google/cloud/video_intelligence/v1.rb +0 -186
- data/lib/google/cloud/video_intelligence/v1/credentials.rb +0 -41
- data/lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb +0 -707
- data/lib/google/cloud/video_intelligence/v1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/video_intelligence/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/video_intelligence/v1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/video_intelligence/v1/doc/google/rpc/status.rb +0 -87
- data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client.rb +0 -306
- data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client_config.json +0 -31
- data/lib/google/cloud/video_intelligence/v1beta2.rb +0 -149
- data/lib/google/cloud/video_intelligence/v1beta2/credentials.rb +0 -41
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/cloud/videointelligence/v1beta2/video_intelligence.rb +0 -372
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/rpc/status.rb +0 -87
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client.rb +0 -306
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client_config.json +0 -31
- data/lib/google/cloud/video_intelligence/v1p1beta1.rb +0 -187
- data/lib/google/cloud/video_intelligence/v1p1beta1/credentials.rb +0 -41
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/cloud/videointelligence/v1p1beta1/video_intelligence.rb +0 -410
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/rpc/status.rb +0 -87
- data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client.rb +0 -306
- data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client_config.json +0 -31
- data/lib/google/cloud/video_intelligence/v1p2beta1.rb +0 -187
- data/lib/google/cloud/video_intelligence/v1p2beta1/credentials.rb +0 -41
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/cloud/videointelligence/v1p2beta1/video_intelligence.rb +0 -442
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/rpc/status.rb +0 -87
- data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client.rb +0 -306
- data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client_config.json +0 -31
- data/lib/google/cloud/videointelligence/v1/video_intelligence_pb.rb +0 -270
- data/lib/google/cloud/videointelligence/v1/video_intelligence_services_pb.rb +0 -51
- data/lib/google/cloud/videointelligence/v1beta2/video_intelligence_pb.rb +0 -168
- data/lib/google/cloud/videointelligence/v1beta2/video_intelligence_services_pb.rb +0 -50
- data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_pb.rb +0 -170
- data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_services_pb.rb +0 -50
- data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_pb.rb +0 -191
- data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_services_pb.rb +0 -51
@@ -1,51 +0,0 @@
|
|
1
|
-
# Copyright 2019 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
module Google
|
17
|
-
module Longrunning
|
18
|
-
# This resource represents a long-running operation that is the result of a
|
19
|
-
# network API call.
|
20
|
-
# @!attribute [rw] name
|
21
|
-
# @return [String]
|
22
|
-
# The server-assigned name, which is only unique within the same service that
|
23
|
-
# originally returns it. If you use the default HTTP mapping, the
|
24
|
-
# `name` should have the format of `operations/some/unique/name`.
|
25
|
-
# @!attribute [rw] metadata
|
26
|
-
# @return [Google::Protobuf::Any]
|
27
|
-
# Service-specific metadata associated with the operation. It typically
|
28
|
-
# contains progress information and common metadata such as create time.
|
29
|
-
# Some services might not provide such metadata. Any method that returns a
|
30
|
-
# long-running operation should document the metadata type, if any.
|
31
|
-
# @!attribute [rw] done
|
32
|
-
# @return [true, false]
|
33
|
-
# If the value is `false`, it means the operation is still in progress.
|
34
|
-
# If `true`, the operation is completed, and either `error` or `response` is
|
35
|
-
# available.
|
36
|
-
# @!attribute [rw] error
|
37
|
-
# @return [Google::Rpc::Status]
|
38
|
-
# The error result of the operation in case of failure or cancellation.
|
39
|
-
# @!attribute [rw] response
|
40
|
-
# @return [Google::Protobuf::Any]
|
41
|
-
# The normal response of the operation in case of success. If the original
|
42
|
-
# method returns no data on success, such as `Delete`, the response is
|
43
|
-
# `google.protobuf.Empty`. If the original method is standard
|
44
|
-
# `Get`/`Create`/`Update`, the response should be the resource. For other
|
45
|
-
# methods, the response should have the type `XxxResponse`, where `Xxx`
|
46
|
-
# is the original method name. For example, if the original method name
|
47
|
-
# is `TakeSnapshot()`, the inferred response type is
|
48
|
-
# `TakeSnapshotResponse`.
|
49
|
-
class Operation; end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,131 +0,0 @@
|
|
1
|
-
# Copyright 2019 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
module Google
|
17
|
-
module Protobuf
|
18
|
-
# `Any` contains an arbitrary serialized protocol buffer message along with a
|
19
|
-
# URL that describes the type of the serialized message.
|
20
|
-
#
|
21
|
-
# Protobuf library provides support to pack/unpack Any values in the form
|
22
|
-
# of utility functions or additional generated methods of the Any type.
|
23
|
-
#
|
24
|
-
# Example 1: Pack and unpack a message in C++.
|
25
|
-
#
|
26
|
-
# Foo foo = ...;
|
27
|
-
# Any any;
|
28
|
-
# any.PackFrom(foo);
|
29
|
-
# ...
|
30
|
-
# if (any.UnpackTo(&foo)) {
|
31
|
-
# ...
|
32
|
-
# }
|
33
|
-
#
|
34
|
-
# Example 2: Pack and unpack a message in Java.
|
35
|
-
#
|
36
|
-
# Foo foo = ...;
|
37
|
-
# Any any = Any.pack(foo);
|
38
|
-
# ...
|
39
|
-
# if (any.is(Foo.class)) {
|
40
|
-
# foo = any.unpack(Foo.class);
|
41
|
-
# }
|
42
|
-
#
|
43
|
-
# Example 3: Pack and unpack a message in Python.
|
44
|
-
#
|
45
|
-
# foo = Foo(...)
|
46
|
-
# any = Any()
|
47
|
-
# any.Pack(foo)
|
48
|
-
# ...
|
49
|
-
# if any.Is(Foo.DESCRIPTOR):
|
50
|
-
# any.Unpack(foo)
|
51
|
-
# ...
|
52
|
-
#
|
53
|
-
# Example 4: Pack and unpack a message in Go
|
54
|
-
#
|
55
|
-
# foo := &pb.Foo{...}
|
56
|
-
# any, err := ptypes.MarshalAny(foo)
|
57
|
-
# ...
|
58
|
-
# foo := &pb.Foo{}
|
59
|
-
# if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
60
|
-
# ...
|
61
|
-
# }
|
62
|
-
#
|
63
|
-
# The pack methods provided by protobuf library will by default use
|
64
|
-
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
65
|
-
# methods only use the fully qualified type name after the last '/'
|
66
|
-
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
67
|
-
# name "y.z".
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# = JSON
|
71
|
-
#
|
72
|
-
# The JSON representation of an `Any` value uses the regular
|
73
|
-
# representation of the deserialized, embedded message, with an
|
74
|
-
# additional field `@type` which contains the type URL. Example:
|
75
|
-
#
|
76
|
-
# package google.profile;
|
77
|
-
# message Person {
|
78
|
-
# string first_name = 1;
|
79
|
-
# string last_name = 2;
|
80
|
-
# }
|
81
|
-
#
|
82
|
-
# {
|
83
|
-
# "@type": "type.googleapis.com/google.profile.Person",
|
84
|
-
# "firstName": <string>,
|
85
|
-
# "lastName": <string>
|
86
|
-
# }
|
87
|
-
#
|
88
|
-
# If the embedded message type is well-known and has a custom JSON
|
89
|
-
# representation, that representation will be embedded adding a field
|
90
|
-
# `value` which holds the custom JSON in addition to the `@type`
|
91
|
-
# field. Example (for message {Google::Protobuf::Duration}):
|
92
|
-
#
|
93
|
-
# {
|
94
|
-
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
95
|
-
# "value": "1.212s"
|
96
|
-
# }
|
97
|
-
# @!attribute [rw] type_url
|
98
|
-
# @return [String]
|
99
|
-
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message. This string must contain at least
|
101
|
-
# one "/" character. The last segment of the URL's path must represent
|
102
|
-
# the fully qualified name of the type (as in
|
103
|
-
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
104
|
-
# (e.g., leading "." is not accepted).
|
105
|
-
#
|
106
|
-
# In practice, teams usually precompile into the binary all types that they
|
107
|
-
# expect it to use in the context of Any. However, for URLs which use the
|
108
|
-
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
109
|
-
# server that maps type URLs to message definitions as follows:
|
110
|
-
#
|
111
|
-
# * If no scheme is provided, `https` is assumed.
|
112
|
-
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
113
|
-
# value in binary format, or produce an error.
|
114
|
-
# * Applications are allowed to cache lookup results based on the
|
115
|
-
# URL, or have them precompiled into a binary to avoid any
|
116
|
-
# lookup. Therefore, binary compatibility needs to be preserved
|
117
|
-
# on changes to types. (Use versioned type names to manage
|
118
|
-
# breaking changes.)
|
119
|
-
#
|
120
|
-
# Note: this functionality is not currently available in the official
|
121
|
-
# protobuf release, and it is not used for type URLs beginning with
|
122
|
-
# type.googleapis.com.
|
123
|
-
#
|
124
|
-
# Schemes other than `http`, `https` (or the empty scheme) might be
|
125
|
-
# used with implementation specific semantics.
|
126
|
-
# @!attribute [rw] value
|
127
|
-
# @return [String]
|
128
|
-
# Must be a valid serialized protocol buffer of the above specified type.
|
129
|
-
class Any; end
|
130
|
-
end
|
131
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# Copyright 2019 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
module Google
|
17
|
-
module Protobuf
|
18
|
-
# A Duration represents a signed, fixed-length span of time represented
|
19
|
-
# as a count of seconds and fractions of seconds at nanosecond
|
20
|
-
# resolution. It is independent of any calendar and concepts like "day"
|
21
|
-
# or "month". It is related to Timestamp in that the difference between
|
22
|
-
# two Timestamp values is a Duration and it can be added or subtracted
|
23
|
-
# from a Timestamp. Range is approximately +-10,000 years.
|
24
|
-
#
|
25
|
-
# = Examples
|
26
|
-
#
|
27
|
-
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
28
|
-
#
|
29
|
-
# Timestamp start = ...;
|
30
|
-
# Timestamp end = ...;
|
31
|
-
# Duration duration = ...;
|
32
|
-
#
|
33
|
-
# duration.seconds = end.seconds - start.seconds;
|
34
|
-
# duration.nanos = end.nanos - start.nanos;
|
35
|
-
#
|
36
|
-
# if (duration.seconds < 0 && duration.nanos > 0) {
|
37
|
-
# duration.seconds += 1;
|
38
|
-
# duration.nanos -= 1000000000;
|
39
|
-
# } else if (durations.seconds > 0 && duration.nanos < 0) {
|
40
|
-
# duration.seconds -= 1;
|
41
|
-
# duration.nanos += 1000000000;
|
42
|
-
# }
|
43
|
-
#
|
44
|
-
# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
45
|
-
#
|
46
|
-
# Timestamp start = ...;
|
47
|
-
# Duration duration = ...;
|
48
|
-
# Timestamp end = ...;
|
49
|
-
#
|
50
|
-
# end.seconds = start.seconds + duration.seconds;
|
51
|
-
# end.nanos = start.nanos + duration.nanos;
|
52
|
-
#
|
53
|
-
# if (end.nanos < 0) {
|
54
|
-
# end.seconds -= 1;
|
55
|
-
# end.nanos += 1000000000;
|
56
|
-
# } else if (end.nanos >= 1000000000) {
|
57
|
-
# end.seconds += 1;
|
58
|
-
# end.nanos -= 1000000000;
|
59
|
-
# }
|
60
|
-
#
|
61
|
-
# Example 3: Compute Duration from datetime.timedelta in Python.
|
62
|
-
#
|
63
|
-
# td = datetime.timedelta(days=3, minutes=10)
|
64
|
-
# duration = Duration()
|
65
|
-
# duration.FromTimedelta(td)
|
66
|
-
#
|
67
|
-
# = JSON Mapping
|
68
|
-
#
|
69
|
-
# In JSON format, the Duration type is encoded as a string rather than an
|
70
|
-
# object, where the string ends in the suffix "s" (indicating seconds) and
|
71
|
-
# is preceded by the number of seconds, with nanoseconds expressed as
|
72
|
-
# fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
73
|
-
# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
74
|
-
# be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
75
|
-
# microsecond should be expressed in JSON format as "3.000001s".
|
76
|
-
# @!attribute [rw] seconds
|
77
|
-
# @return [Integer]
|
78
|
-
# Signed seconds of the span of time. Must be from -315,576,000,000
|
79
|
-
# to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
80
|
-
# 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
81
|
-
# @!attribute [rw] nanos
|
82
|
-
# @return [Integer]
|
83
|
-
# Signed fractions of a second at nanosecond resolution of the span
|
84
|
-
# of time. Durations less than one second are represented with a 0
|
85
|
-
# `seconds` field and a positive or negative `nanos` field. For durations
|
86
|
-
# of one second or more, a non-zero value for the `nanos` field must be
|
87
|
-
# of the same sign as the `seconds` field. Must be from -999,999,999
|
88
|
-
# to +999,999,999 inclusive.
|
89
|
-
class Duration; end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# Copyright 2019 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
module Google
|
17
|
-
module Rpc
|
18
|
-
# The `Status` type defines a logical error model that is suitable for
|
19
|
-
# different programming environments, including REST APIs and RPC APIs. It is
|
20
|
-
# used by [gRPC](https://github.com/grpc). The error model is designed to be:
|
21
|
-
#
|
22
|
-
# * Simple to use and understand for most users
|
23
|
-
# * Flexible enough to meet unexpected needs
|
24
|
-
#
|
25
|
-
# = Overview
|
26
|
-
#
|
27
|
-
# The `Status` message contains three pieces of data: error code, error
|
28
|
-
# message, and error details. The error code should be an enum value of
|
29
|
-
# {Google::Rpc::Code}, but it may accept additional error codes
|
30
|
-
# if needed. The error message should be a developer-facing English message
|
31
|
-
# that helps developers *understand* and *resolve* the error. If a localized
|
32
|
-
# user-facing error message is needed, put the localized message in the error
|
33
|
-
# details or localize it in the client. The optional error details may contain
|
34
|
-
# arbitrary information about the error. There is a predefined set of error
|
35
|
-
# detail types in the package `google.rpc` that can be used for common error
|
36
|
-
# conditions.
|
37
|
-
#
|
38
|
-
# = Language mapping
|
39
|
-
#
|
40
|
-
# The `Status` message is the logical representation of the error model, but it
|
41
|
-
# is not necessarily the actual wire format. When the `Status` message is
|
42
|
-
# exposed in different client libraries and different wire protocols, it can be
|
43
|
-
# mapped differently. For example, it will likely be mapped to some exceptions
|
44
|
-
# in Java, but more likely mapped to some error codes in C.
|
45
|
-
#
|
46
|
-
# = Other uses
|
47
|
-
#
|
48
|
-
# The error model and the `Status` message can be used in a variety of
|
49
|
-
# environments, either with or without APIs, to provide a
|
50
|
-
# consistent developer experience across different environments.
|
51
|
-
#
|
52
|
-
# Example uses of this error model include:
|
53
|
-
#
|
54
|
-
# * Partial errors. If a service needs to return partial errors to the client,
|
55
|
-
# it may embed the `Status` in the normal response to indicate the partial
|
56
|
-
# errors.
|
57
|
-
#
|
58
|
-
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
59
|
-
# have a `Status` message for error reporting.
|
60
|
-
#
|
61
|
-
# * Batch operations. If a client uses batch request and batch response, the
|
62
|
-
# `Status` message should be used directly inside batch response, one for
|
63
|
-
# each error sub-response.
|
64
|
-
#
|
65
|
-
# * Asynchronous operations. If an API call embeds asynchronous operation
|
66
|
-
# results in its response, the status of those operations should be
|
67
|
-
# represented directly using the `Status` message.
|
68
|
-
#
|
69
|
-
# * Logging. If some API errors are stored in logs, the message `Status` could
|
70
|
-
# be used directly after any stripping needed for security/privacy reasons.
|
71
|
-
# @!attribute [rw] code
|
72
|
-
# @return [Integer]
|
73
|
-
# The status code, which should be an enum value of
|
74
|
-
# {Google::Rpc::Code}.
|
75
|
-
# @!attribute [rw] message
|
76
|
-
# @return [String]
|
77
|
-
# A developer-facing error message, which should be in English. Any
|
78
|
-
# user-facing error message should be localized and sent in the
|
79
|
-
# {Google::Rpc::Status#details} field, or localized
|
80
|
-
# by the client.
|
81
|
-
# @!attribute [rw] details
|
82
|
-
# @return [Array<Google::Protobuf::Any>]
|
83
|
-
# A list of messages that carry the error details. There is a common set of
|
84
|
-
# message types for APIs to use.
|
85
|
-
class Status; end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,306 +0,0 @@
|
|
1
|
-
# Copyright 2019 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
#
|
15
|
-
# EDITING INSTRUCTIONS
|
16
|
-
# This file was generated from the file
|
17
|
-
# https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1/video_intelligence.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
require "google/gax/operation"
|
28
|
-
require "google/longrunning/operations_client"
|
29
|
-
|
30
|
-
require "google/cloud/videointelligence/v1/video_intelligence_pb"
|
31
|
-
require "google/cloud/video_intelligence/v1/credentials"
|
32
|
-
require "google/cloud/video_intelligence/version"
|
33
|
-
|
34
|
-
module Google
|
35
|
-
module Cloud
|
36
|
-
module VideoIntelligence
|
37
|
-
module V1
|
38
|
-
# Service that implements Google Cloud Video Intelligence API.
|
39
|
-
#
|
40
|
-
# @!attribute [r] video_intelligence_service_stub
|
41
|
-
# @return [Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Stub]
|
42
|
-
class VideoIntelligenceServiceClient
|
43
|
-
# @private
|
44
|
-
attr_reader :video_intelligence_service_stub
|
45
|
-
|
46
|
-
# The default address of the service.
|
47
|
-
SERVICE_ADDRESS = "videointelligence.googleapis.com".freeze
|
48
|
-
|
49
|
-
# The default port of the service.
|
50
|
-
DEFAULT_SERVICE_PORT = 443
|
51
|
-
|
52
|
-
# The default set of gRPC interceptors.
|
53
|
-
GRPC_INTERCEPTORS = []
|
54
|
-
|
55
|
-
DEFAULT_TIMEOUT = 30
|
56
|
-
|
57
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
58
|
-
# this service.
|
59
|
-
ALL_SCOPES = [
|
60
|
-
"https://www.googleapis.com/auth/cloud-platform"
|
61
|
-
].freeze
|
62
|
-
|
63
|
-
# @private
|
64
|
-
class OperationsClient < Google::Longrunning::OperationsClient
|
65
|
-
self::SERVICE_ADDRESS = VideoIntelligenceServiceClient::SERVICE_ADDRESS
|
66
|
-
self::GRPC_INTERCEPTORS = VideoIntelligenceServiceClient::GRPC_INTERCEPTORS
|
67
|
-
end
|
68
|
-
|
69
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
70
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
71
|
-
# be many types.
|
72
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
73
|
-
# authenticating requests made by this client.
|
74
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
75
|
-
# credentials for this client.
|
76
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
77
|
-
# credentials for this client.
|
78
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
79
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
80
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
81
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
82
|
-
# metadata for requests, generally, to give OAuth credentials.
|
83
|
-
# @param scopes [Array<String>]
|
84
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
85
|
-
# an updater_proc is supplied.
|
86
|
-
# @param client_config [Hash]
|
87
|
-
# A Hash for call options for each method. See
|
88
|
-
# Google::Gax#construct_settings for the structure of
|
89
|
-
# this data. Falls back to the default config if not specified
|
90
|
-
# or the specified config is missing data points.
|
91
|
-
# @param timeout [Numeric]
|
92
|
-
# The default timeout, in seconds, for calls made through this client.
|
93
|
-
# @param metadata [Hash]
|
94
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
95
|
-
# @param service_address [String]
|
96
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
97
|
-
# @param service_port [Integer]
|
98
|
-
# Override for the service port, or `nil` to leave as the default.
|
99
|
-
# @param exception_transformer [Proc]
|
100
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
101
|
-
# custom error handling.
|
102
|
-
def initialize \
|
103
|
-
credentials: nil,
|
104
|
-
scopes: ALL_SCOPES,
|
105
|
-
client_config: {},
|
106
|
-
timeout: DEFAULT_TIMEOUT,
|
107
|
-
metadata: nil,
|
108
|
-
service_address: nil,
|
109
|
-
service_port: nil,
|
110
|
-
exception_transformer: nil,
|
111
|
-
lib_name: nil,
|
112
|
-
lib_version: ""
|
113
|
-
# These require statements are intentionally placed here to initialize
|
114
|
-
# the gRPC module only when it's required.
|
115
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
116
|
-
require "google/gax/grpc"
|
117
|
-
require "google/cloud/videointelligence/v1/video_intelligence_services_pb"
|
118
|
-
|
119
|
-
credentials ||= Google::Cloud::VideoIntelligence::V1::Credentials.default
|
120
|
-
|
121
|
-
@operations_client = OperationsClient.new(
|
122
|
-
credentials: credentials,
|
123
|
-
scopes: scopes,
|
124
|
-
client_config: client_config,
|
125
|
-
timeout: timeout,
|
126
|
-
lib_name: lib_name,
|
127
|
-
service_address: service_address,
|
128
|
-
service_port: service_port,
|
129
|
-
lib_version: lib_version,
|
130
|
-
metadata: metadata,
|
131
|
-
)
|
132
|
-
|
133
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
134
|
-
updater_proc = Google::Cloud::VideoIntelligence::V1::Credentials.new(credentials).updater_proc
|
135
|
-
end
|
136
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
137
|
-
channel = credentials
|
138
|
-
end
|
139
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
140
|
-
chan_creds = credentials
|
141
|
-
end
|
142
|
-
if credentials.is_a?(Proc)
|
143
|
-
updater_proc = credentials
|
144
|
-
end
|
145
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
146
|
-
updater_proc = credentials.updater_proc
|
147
|
-
end
|
148
|
-
|
149
|
-
package_version = Google::Cloud::VideoIntelligence::VERSION
|
150
|
-
|
151
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
152
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
153
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
154
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
155
|
-
google_api_client.freeze
|
156
|
-
|
157
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
158
|
-
headers.merge!(metadata) unless metadata.nil?
|
159
|
-
client_config_file = Pathname.new(__dir__).join(
|
160
|
-
"video_intelligence_service_client_config.json"
|
161
|
-
)
|
162
|
-
defaults = client_config_file.open do |f|
|
163
|
-
Google::Gax.construct_settings(
|
164
|
-
"google.cloud.videointelligence.v1.VideoIntelligenceService",
|
165
|
-
JSON.parse(f.read),
|
166
|
-
client_config,
|
167
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
168
|
-
timeout,
|
169
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
170
|
-
metadata: headers
|
171
|
-
)
|
172
|
-
end
|
173
|
-
|
174
|
-
# Allow overriding the service path/port in subclasses.
|
175
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
176
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
177
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
178
|
-
@video_intelligence_service_stub = Google::Gax::Grpc.create_stub(
|
179
|
-
service_path,
|
180
|
-
port,
|
181
|
-
chan_creds: chan_creds,
|
182
|
-
channel: channel,
|
183
|
-
updater_proc: updater_proc,
|
184
|
-
scopes: scopes,
|
185
|
-
interceptors: interceptors,
|
186
|
-
&Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Stub.method(:new)
|
187
|
-
)
|
188
|
-
|
189
|
-
@annotate_video = Google::Gax.create_api_call(
|
190
|
-
@video_intelligence_service_stub.method(:annotate_video),
|
191
|
-
defaults["annotate_video"],
|
192
|
-
exception_transformer: exception_transformer
|
193
|
-
)
|
194
|
-
end
|
195
|
-
|
196
|
-
# Service calls
|
197
|
-
|
198
|
-
# Performs asynchronous video annotation. Progress and results can be
|
199
|
-
# retrieved through the `google.longrunning.Operations` interface.
|
200
|
-
# `Operation.metadata` contains `AnnotateVideoProgress` (progress).
|
201
|
-
# `Operation.response` contains `AnnotateVideoResponse` (results).
|
202
|
-
#
|
203
|
-
# @param features [Array<Google::Cloud::VideoIntelligence::V1::Feature>]
|
204
|
-
# Required. Requested video annotation features.
|
205
|
-
# @param input_uri [String]
|
206
|
-
# Input video location. Currently, only
|
207
|
-
# [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
|
208
|
-
# supported, which must be specified in the following format:
|
209
|
-
# `gs://bucket-id/object-id` (other URI formats return
|
210
|
-
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
211
|
-
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
212
|
-
# A video URI may include wildcards in `object-id`, and thus identify
|
213
|
-
# multiple videos. Supported wildcards: '*' to match 0 or more characters;
|
214
|
-
# '?' to match 1 character. If unset, the input video should be embedded
|
215
|
-
# in the request as `input_content`. If set, `input_content` should be unset.
|
216
|
-
# @param input_content [String]
|
217
|
-
# The video data bytes.
|
218
|
-
# If unset, the input video(s) should be specified via `input_uri`.
|
219
|
-
# If set, `input_uri` should be unset.
|
220
|
-
# @param video_context [Google::Cloud::VideoIntelligence::V1::VideoContext | Hash]
|
221
|
-
# Additional video context and/or feature-specific parameters.
|
222
|
-
# A hash of the same form as `Google::Cloud::VideoIntelligence::V1::VideoContext`
|
223
|
-
# can also be provided.
|
224
|
-
# @param output_uri [String]
|
225
|
-
# Optional. Location where the output (in JSON format) should be stored.
|
226
|
-
# Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
|
227
|
-
# URIs are supported, which must be specified in the following format:
|
228
|
-
# `gs://bucket-id/object-id` (other URI formats return
|
229
|
-
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
230
|
-
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
231
|
-
# @param location_id [String]
|
232
|
-
# Optional. Cloud region where annotation should take place. Supported cloud
|
233
|
-
# regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region
|
234
|
-
# is specified, a region will be determined based on video file location.
|
235
|
-
# @param options [Google::Gax::CallOptions]
|
236
|
-
# Overrides the default settings for this call, e.g, timeout,
|
237
|
-
# retries, etc.
|
238
|
-
# @return [Google::Gax::Operation]
|
239
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
240
|
-
# @example
|
241
|
-
# require "google/cloud/video_intelligence"
|
242
|
-
#
|
243
|
-
# video_intelligence_client = Google::Cloud::VideoIntelligence.new(version: :v1)
|
244
|
-
# features_element = :LABEL_DETECTION
|
245
|
-
# features = [features_element]
|
246
|
-
# input_uri = "gs://cloud-samples-data/video/cat.mp4"
|
247
|
-
#
|
248
|
-
# # Register a callback during the method call.
|
249
|
-
# operation = video_intelligence_client.annotate_video(features, input_uri: input_uri) do |op|
|
250
|
-
# raise op.results.message if op.error?
|
251
|
-
# op_results = op.results
|
252
|
-
# # Process the results.
|
253
|
-
#
|
254
|
-
# metadata = op.metadata
|
255
|
-
# # Process the metadata.
|
256
|
-
# end
|
257
|
-
#
|
258
|
-
# # Or use the return value to register a callback.
|
259
|
-
# operation.on_done do |op|
|
260
|
-
# raise op.results.message if op.error?
|
261
|
-
# op_results = op.results
|
262
|
-
# # Process the results.
|
263
|
-
#
|
264
|
-
# metadata = op.metadata
|
265
|
-
# # Process the metadata.
|
266
|
-
# end
|
267
|
-
#
|
268
|
-
# # Manually reload the operation.
|
269
|
-
# operation.reload!
|
270
|
-
#
|
271
|
-
# # Or block until the operation completes, triggering callbacks on
|
272
|
-
# # completion.
|
273
|
-
# operation.wait_until_done!
|
274
|
-
|
275
|
-
def annotate_video \
|
276
|
-
features,
|
277
|
-
input_uri: nil,
|
278
|
-
input_content: nil,
|
279
|
-
video_context: nil,
|
280
|
-
output_uri: nil,
|
281
|
-
location_id: nil,
|
282
|
-
options: nil
|
283
|
-
req = {
|
284
|
-
features: features,
|
285
|
-
input_uri: input_uri,
|
286
|
-
input_content: input_content,
|
287
|
-
video_context: video_context,
|
288
|
-
output_uri: output_uri,
|
289
|
-
location_id: location_id
|
290
|
-
}.delete_if { |_, v| v.nil? }
|
291
|
-
req = Google::Gax::to_proto(req, Google::Cloud::VideoIntelligence::V1::AnnotateVideoRequest)
|
292
|
-
operation = Google::Gax::Operation.new(
|
293
|
-
@annotate_video.call(req, options),
|
294
|
-
@operations_client,
|
295
|
-
Google::Cloud::VideoIntelligence::V1::AnnotateVideoResponse,
|
296
|
-
Google::Cloud::VideoIntelligence::V1::AnnotateVideoProgress,
|
297
|
-
call_options: options
|
298
|
-
)
|
299
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
300
|
-
operation
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|