google-cloud-automl 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -4
- data/LICENSE.md +2 -2
- data/README.md +3 -149
- data/lib/google/cloud/automl/version.rb +1 -1
- metadata +15 -42
- data/AUTHENTICATION.md +0 -122
- data/MIGRATING.md +0 -324
- data/lib/google/cloud/automl/helpers.rb +0 -31
- data/lib/google/cloud/automl.rb +0 -243
- data/lib/google-cloud-automl.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e91ef07b4fcf9898a658a1db7e2d2cb13cd77f7b931981e9588af8f42f7c9688
|
|
4
|
+
data.tar.gz: 8eada9551d494a0609a6007e24af8fef3ec0f5b2cd591ff5a051256057810cf8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87cfaa67844a4740214a1df3018ceef14b6fbc9b1c4d9f8488c460a64e3e2165ac484d661a234095bfa736df8e5553700b93bfddbad3e68a4c061d72d02d735a
|
|
7
|
+
data.tar.gz: c3525f5c8897ed2781552cf266ae1c2710c84880f5d585ab162a16d813b7b33276471ef04213560dac6067bdbe23bca5b9e5ec36bd1aeee164da8c831b39b813
|
data/.yardopts
CHANGED
data/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Apache License
|
|
2
2
|
Version 2.0, January 2004
|
|
3
|
-
|
|
3
|
+
https://www.apache.org/licenses/
|
|
4
4
|
|
|
5
5
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
6
|
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
193
193
|
You may obtain a copy of the License at
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
196
196
|
|
|
197
197
|
Unless required by applicable law or agreed to in writing, software
|
|
198
198
|
distributed under the License is distributed on an "AS IS" BASIS,
|
data/README.md
CHANGED
|
@@ -1,150 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tombstone for Ruby gem google-cloud-automl
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
AutoML makes the power of machine learning available to you even if you have limited knowledge of machine learning. You can use AutoML to build on Google's machine learning capabilities to create your own custom machine learning models that are tailored to your business needs, and then integrate those models into your applications and web sites.
|
|
6
|
-
|
|
7
|
-
Actual client classes for the various versions of this API are defined in
|
|
8
|
-
_versioned_ client gems, with names of the form `google-cloud-automl-v*`.
|
|
9
|
-
The gem `google-cloud-automl` is the main client library that brings the
|
|
10
|
-
versioned gems in as dependencies, and provides high-level methods for
|
|
11
|
-
constructing clients. More information on versioned clients can be found below
|
|
12
|
-
in the section titled *Which client should I use?*.
|
|
13
|
-
|
|
14
|
-
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-automl/latest)
|
|
15
|
-
for this library, google-cloud-automl, to see the convenience methods for
|
|
16
|
-
constructing client objects. Reference documentation for the client objects
|
|
17
|
-
themselves can be found in the client library documentation for the versioned
|
|
18
|
-
client gems:
|
|
19
|
-
[google-cloud-automl-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-automl-v1/latest).
|
|
20
|
-
|
|
21
|
-
See also the [Product Documentation](https://cloud.google.com/automl)
|
|
22
|
-
for more usage information.
|
|
23
|
-
|
|
24
|
-
## Quick Start
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
$ gem install google-cloud-automl
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
In order to use this library, you first need to go through the following steps:
|
|
31
|
-
|
|
32
|
-
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
|
33
|
-
1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
|
34
|
-
1. [Enable the API.](https://console.cloud.google.com/apis/library/automl.googleapis.com)
|
|
35
|
-
1. {file:AUTHENTICATION.md Set up authentication.}
|
|
36
|
-
|
|
37
|
-
```ruby
|
|
38
|
-
require "google/cloud/automl"
|
|
39
|
-
|
|
40
|
-
client = Google::Cloud::AutoML.prediction_service
|
|
41
|
-
request = ::Google::Cloud::AutoML::V1::PredictRequest.new # (request fields as keyword arguments...)
|
|
42
|
-
response = client.predict request
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Migrating from 0.x versions
|
|
46
|
-
|
|
47
|
-
The 1.0 release of the google-cloud-automl client is a significant upgrade
|
|
48
|
-
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
|
49
|
-
and includes substantial interface changes. Existing code written for earlier
|
|
50
|
-
versions of this library will likely require updates to use this version.
|
|
51
|
-
See the {file:MIGRATING.md MIGRATING.md} document for more information.
|
|
52
|
-
|
|
53
|
-
## Debug Logging
|
|
54
|
-
|
|
55
|
-
This library comes with opt-in Debug Logging that can help you troubleshoot
|
|
56
|
-
your application's integration with the API. When logging is activated, key
|
|
57
|
-
events such as requests and responses, along with data payloads and metadata
|
|
58
|
-
such as headers and client configuration, are logged to the standard error
|
|
59
|
-
stream.
|
|
60
|
-
|
|
61
|
-
**WARNING:** Client Library Debug Logging includes your data payloads in
|
|
62
|
-
plaintext, which could include sensitive data such as PII for yourself or your
|
|
63
|
-
customers, private keys, or other security data that could be compromising if
|
|
64
|
-
leaked. Always practice good data hygiene with your application logs, and follow
|
|
65
|
-
the principle of least access. Google also recommends that Client Library Debug
|
|
66
|
-
Logging be enabled only temporarily during active debugging, and not used
|
|
67
|
-
permanently in production.
|
|
68
|
-
|
|
69
|
-
To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
|
|
70
|
-
to the value `all`. Alternatively, you can set the value to a comma-delimited
|
|
71
|
-
list of client library gem names. This will select the default logging behavior,
|
|
72
|
-
which writes logs to the standard error stream. On a local workstation, this may
|
|
73
|
-
result in logs appearing on the console. When running on a Google Cloud hosting
|
|
74
|
-
service such as [Google Cloud Run](https://cloud.google.com/run), this generally
|
|
75
|
-
results in logs appearing alongside your application logs in the
|
|
76
|
-
[Google Cloud Logging](https://cloud.google.com/logging/) service.
|
|
77
|
-
|
|
78
|
-
Debug logging also requires that the versioned clients for this service be
|
|
79
|
-
sufficiently recent, released after about Dec 10, 2024. If logging is not
|
|
80
|
-
working, try updating the versioned clients in your bundle or installed gems:
|
|
81
|
-
[google-cloud-automl-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-automl-v1/latest).
|
|
82
|
-
|
|
83
|
-
## Supported Ruby Versions
|
|
84
|
-
|
|
85
|
-
This library is supported on Ruby 3.2+.
|
|
86
|
-
|
|
87
|
-
Google provides official support for Ruby versions that are actively supported
|
|
88
|
-
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
89
|
-
in security maintenance, and not end of life. Older versions of Ruby _may_
|
|
90
|
-
still work, but are unsupported and not recommended. See
|
|
91
|
-
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
|
92
|
-
support schedule.
|
|
93
|
-
|
|
94
|
-
## Which client should I use?
|
|
95
|
-
|
|
96
|
-
Most modern Ruby client libraries for Google APIs come in two flavors: the main
|
|
97
|
-
client library with a name such as `google-cloud-automl`,
|
|
98
|
-
and lower-level _versioned_ client libraries with names such as
|
|
99
|
-
`google-cloud-automl-v1`.
|
|
100
|
-
_In most cases, you should install the main client._
|
|
101
|
-
|
|
102
|
-
### What's the difference between the main client and a versioned client?
|
|
103
|
-
|
|
104
|
-
A _versioned client_ provides a basic set of data types and client classes for
|
|
105
|
-
a _single version_ of a specific service. (That is, for a service with multiple
|
|
106
|
-
versions, there might be a separate versioned client for each service version.)
|
|
107
|
-
Most versioned clients are written and maintained by a code generator.
|
|
108
|
-
|
|
109
|
-
The _main client_ is designed to provide you with the _recommended_ client
|
|
110
|
-
interfaces for the service. There will be only one main client for any given
|
|
111
|
-
service, even a service with multiple versions. The main client includes
|
|
112
|
-
factory methods for constructing the client objects we recommend for most
|
|
113
|
-
users. In some cases, those will be classes provided by an underlying versioned
|
|
114
|
-
client; in other cases, they will be handwritten higher-level client objects
|
|
115
|
-
with additional capabilities, convenience methods, or best practices built in.
|
|
116
|
-
Generally, the main client will default to a recommended service version,
|
|
117
|
-
although in some cases you can override this if you need to talk to a specific
|
|
118
|
-
service version.
|
|
119
|
-
|
|
120
|
-
### Why would I want to use the main client?
|
|
121
|
-
|
|
122
|
-
We recommend that most users install the main client gem for a service. You can
|
|
123
|
-
identify this gem as the one _without_ a version in its name, e.g.
|
|
124
|
-
`google-cloud-automl`.
|
|
125
|
-
The main client is recommended because it will embody the best practices for
|
|
126
|
-
accessing the service, and may also provide more convenient interfaces or
|
|
127
|
-
tighter integration into frameworks and third-party libraries. In addition, the
|
|
128
|
-
documentation and samples published by Google will generally demonstrate use of
|
|
129
|
-
the main client.
|
|
130
|
-
|
|
131
|
-
### Why would I want to use a versioned client?
|
|
132
|
-
|
|
133
|
-
You can use a versioned client if you are content with a possibly lower-level
|
|
134
|
-
class interface, you explicitly want to avoid features provided by the main
|
|
135
|
-
client, or you want to access a specific service version not be covered by the
|
|
136
|
-
main client. You can identify versioned client gems because the service version
|
|
137
|
-
is part of the name, e.g. `google-cloud-automl-v1`.
|
|
138
|
-
|
|
139
|
-
### What about the google-apis-<name> clients?
|
|
140
|
-
|
|
141
|
-
Client library gems with names that begin with `google-apis-` are based on an
|
|
142
|
-
older code generation technology. They talk to a REST/JSON backend (whereas
|
|
143
|
-
most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
|
|
144
|
-
not offer the same performance, features, and ease of use provided by more
|
|
145
|
-
modern clients.
|
|
146
|
-
|
|
147
|
-
The `google-apis-` clients have wide coverage across Google services, so you
|
|
148
|
-
might need to use one if there is no modern client available for the service.
|
|
149
|
-
However, if a modern client is available, we generally recommend it over the
|
|
150
|
-
older `google-apis-` clients.
|
|
3
|
+
This gem is obsolete because the related Google backend is turned down.
|
|
4
|
+
For more information, see https://cloud.google.com/terms/deprecation.
|
metadata
CHANGED
|
@@ -1,65 +1,37 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google-cloud-automl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Google LLC
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - "~>"
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '1.2'
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - "~>"
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '1.2'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: google-cloud-core
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - "~>"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '1.6'
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.6'
|
|
40
|
-
description: AutoML makes the power of machine learning available to you even if you
|
|
41
|
-
have limited knowledge of machine learning. You can use AutoML to build on Google's
|
|
42
|
-
machine learning capabilities to create your own custom machine learning models
|
|
43
|
-
that are tailored to your business needs, and then integrate those models into your
|
|
44
|
-
applications and web sites.
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: This gem is obsolete because the related Google backend is turned down.
|
|
13
|
+
For more information, see https://cloud.google.com/terms/deprecation.
|
|
45
14
|
email: googleapis-packages@google.com
|
|
46
15
|
executables: []
|
|
47
16
|
extensions: []
|
|
48
17
|
extra_rdoc_files: []
|
|
49
18
|
files:
|
|
50
19
|
- ".yardopts"
|
|
51
|
-
- AUTHENTICATION.md
|
|
52
20
|
- LICENSE.md
|
|
53
|
-
- MIGRATING.md
|
|
54
21
|
- README.md
|
|
55
|
-
- lib/google-cloud-automl.rb
|
|
56
|
-
- lib/google/cloud/automl.rb
|
|
57
|
-
- lib/google/cloud/automl/helpers.rb
|
|
58
22
|
- lib/google/cloud/automl/version.rb
|
|
59
23
|
homepage: https://github.com/googleapis/google-cloud-ruby
|
|
60
24
|
licenses:
|
|
61
25
|
- Apache-2.0
|
|
62
26
|
metadata: {}
|
|
27
|
+
post_install_message: |2+
|
|
28
|
+
|
|
29
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
30
|
+
The google-cloud-automl gem is OBSOLETE.
|
|
31
|
+
For more information, see:
|
|
32
|
+
https://cloud.google.com/terms/deprecation
|
|
33
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
34
|
+
|
|
63
35
|
rdoc_options: []
|
|
64
36
|
require_paths:
|
|
65
37
|
- lib
|
|
@@ -67,7 +39,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
67
39
|
requirements:
|
|
68
40
|
- - ">="
|
|
69
41
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '3.
|
|
42
|
+
version: '3.0'
|
|
71
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
44
|
requirements:
|
|
73
45
|
- - ">="
|
|
@@ -76,5 +48,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
48
|
requirements: []
|
|
77
49
|
rubygems_version: 3.6.9
|
|
78
50
|
specification_version: 4
|
|
79
|
-
summary:
|
|
51
|
+
summary: This gem is obsolete because the related backend is turned down.
|
|
80
52
|
test_files: []
|
|
53
|
+
...
|
data/AUTHENTICATION.md
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# Authentication
|
|
2
|
-
|
|
3
|
-
The recommended way to authenticate to the google-cloud-automl library is to use
|
|
4
|
-
[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials).
|
|
5
|
-
To review all of your authentication options, see [Credentials lookup](#credential-lookup).
|
|
6
|
-
|
|
7
|
-
## Quickstart
|
|
8
|
-
|
|
9
|
-
The following example shows how to set up authentication for a local development
|
|
10
|
-
environment with your user credentials.
|
|
11
|
-
|
|
12
|
-
**NOTE:** This method is _not_ recommended for running in production. User credentials
|
|
13
|
-
should be used only during development.
|
|
14
|
-
|
|
15
|
-
1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk).
|
|
16
|
-
2. Set up a local ADC file with your user credentials:
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
gcloud auth application-default login
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
3. Write code as if already authenticated.
|
|
23
|
-
|
|
24
|
-
For more information about setting up authentication for a local development environment, see
|
|
25
|
-
[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev).
|
|
26
|
-
|
|
27
|
-
## Credential Lookup
|
|
28
|
-
|
|
29
|
-
The google-cloud-automl library provides several mechanisms to configure your system.
|
|
30
|
-
Generally, using Application Default Credentials to facilitate automatic
|
|
31
|
-
credentials discovery is the easist method. But if you need to explicitly specify
|
|
32
|
-
credentials, there are several methods available to you.
|
|
33
|
-
|
|
34
|
-
Credentials are accepted in the following ways, in the following order or precedence:
|
|
35
|
-
|
|
36
|
-
1. Credentials specified in method arguments
|
|
37
|
-
2. Credentials specified in configuration
|
|
38
|
-
3. Credentials pointed to or included in environment variables
|
|
39
|
-
4. Credentials found in local ADC file
|
|
40
|
-
5. Credentials returned by the metadata server for the attached service account (GCP)
|
|
41
|
-
|
|
42
|
-
### Configuration
|
|
43
|
-
|
|
44
|
-
You can configure a path to a JSON credentials file, either for an individual client object or
|
|
45
|
-
globally, for all client objects. The JSON file can contain credentials created for
|
|
46
|
-
[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation),
|
|
47
|
-
[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a
|
|
48
|
-
[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key).
|
|
49
|
-
|
|
50
|
-
Note: Service account keys are a security risk if not managed correctly. You should
|
|
51
|
-
[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree)
|
|
52
|
-
whenever possible.
|
|
53
|
-
|
|
54
|
-
To configure a credentials file for an individual client initialization:
|
|
55
|
-
|
|
56
|
-
```ruby
|
|
57
|
-
require "google/cloud/automl"
|
|
58
|
-
|
|
59
|
-
client = Google::Cloud::AutoML.prediction_service do |config|
|
|
60
|
-
config.credentials = "path/to/credentialfile.json"
|
|
61
|
-
end
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
To configure a credentials file globally for all clients:
|
|
65
|
-
|
|
66
|
-
```ruby
|
|
67
|
-
require "google/cloud/automl"
|
|
68
|
-
|
|
69
|
-
Google::Cloud::AutoML.configure do |config|
|
|
70
|
-
config.credentials = "path/to/credentialfile.json"
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
client = Google::Cloud::AutoML.prediction_service
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Environment Variables
|
|
77
|
-
|
|
78
|
-
You can also use an environment variable to provide a JSON credentials file.
|
|
79
|
-
The environment variable can contain a path to the credentials file or, for
|
|
80
|
-
environments such as Docker containers where writing files is not encouraged,
|
|
81
|
-
you can include the credentials file itself.
|
|
82
|
-
|
|
83
|
-
The JSON file can contain credentials created for
|
|
84
|
-
[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation),
|
|
85
|
-
[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a
|
|
86
|
-
[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key).
|
|
87
|
-
|
|
88
|
-
Note: Service account keys are a security risk if not managed correctly. You should
|
|
89
|
-
[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree)
|
|
90
|
-
whenever possible.
|
|
91
|
-
|
|
92
|
-
The environment variables that google-cloud-automl
|
|
93
|
-
checks for credentials are:
|
|
94
|
-
|
|
95
|
-
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
|
96
|
-
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
|
97
|
-
|
|
98
|
-
```ruby
|
|
99
|
-
require "google/cloud/automl"
|
|
100
|
-
|
|
101
|
-
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
|
102
|
-
|
|
103
|
-
client = Google::Cloud::AutoML.prediction_service
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Local ADC file
|
|
107
|
-
|
|
108
|
-
You can set up a local ADC file with your user credentials for authentication during
|
|
109
|
-
development. If credentials are not provided in code or in environment variables,
|
|
110
|
-
then the local ADC credentials are discovered.
|
|
111
|
-
|
|
112
|
-
Follow the steps in [Quickstart](#quickstart) to set up a local ADC file.
|
|
113
|
-
|
|
114
|
-
### Google Cloud Platform environments
|
|
115
|
-
|
|
116
|
-
When running on Google Cloud Platform (GCP), including Google Compute Engine
|
|
117
|
-
(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
|
|
118
|
-
Functions (GCF) and Cloud Run, credentials are retrieved from the attached
|
|
119
|
-
service account automatically. Code should be written as if already authenticated.
|
|
120
|
-
|
|
121
|
-
For more information, see
|
|
122
|
-
[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa).
|
data/MIGRATING.md
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
# Migrating to google-cloud-automl 1.0
|
|
2
|
-
|
|
3
|
-
The 1.0 release of the google-cloud-automl client is a significant upgrade
|
|
4
|
-
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
|
5
|
-
and includes substantial interface changes. Existing code written for earlier
|
|
6
|
-
versions of this library will likely require updates to use this version.
|
|
7
|
-
This document describes the changes that have been made, and what you need to
|
|
8
|
-
do to update your usage.
|
|
9
|
-
|
|
10
|
-
To summarize:
|
|
11
|
-
|
|
12
|
-
* The 1.0 release supports versions V1 and V1beta1 of the AutoML service, and
|
|
13
|
-
defaults to V1. Earlier releases supported only V1beta1.
|
|
14
|
-
* The library has been broken out into multiple libraries. The new gems
|
|
15
|
-
`google-cloud-automl-v1` and `google-cloud-automl-v1beta1` contain the
|
|
16
|
-
actual client classes for versions V1 and V1beta1 of the AutoML service,
|
|
17
|
-
and the gem `google-cloud-automl` now simply provides a convenience wrapper.
|
|
18
|
-
See [Library Structure](#library-structure) for more info.
|
|
19
|
-
* The library uses a new configuration mechanism giving you closer control
|
|
20
|
-
over endpoint address, network timeouts, and retry. See
|
|
21
|
-
[Client Configuration](#client-configuration) for more info. Furthermore,
|
|
22
|
-
when creating a client object, you can customize its configuration in a
|
|
23
|
-
block rather than passing arguments to the constructor. See
|
|
24
|
-
[Creating Clients](#creating-clients) for more info.
|
|
25
|
-
* Previously, positional arguments were used to indicate required arguments.
|
|
26
|
-
Now, all method arguments are keyword arguments, with documentation that
|
|
27
|
-
specifies whether they are required or optional. Additionally, you can pass
|
|
28
|
-
a proto request object instead of separate arguments. See
|
|
29
|
-
[Passing Arguments](#passing-arguments) for more info.
|
|
30
|
-
* Previously, some client classes included class methods for constructing
|
|
31
|
-
resource paths. These paths are now instance methods on the client objects,
|
|
32
|
-
and are also available in a separate paths module. See
|
|
33
|
-
[Resource Path Helpers](#resource-path-helpers) for more info.
|
|
34
|
-
* Previously, clients reported RPC errors by raising instances of
|
|
35
|
-
`Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
|
|
36
|
-
`Google::Cloud::Error` and its subclasses. See
|
|
37
|
-
[Handling Errors](#handling-errors) for more info.
|
|
38
|
-
* Some classes have moved into different namespaces. See
|
|
39
|
-
[Class Namespaces](#class-namespaces) for more info.
|
|
40
|
-
|
|
41
|
-
### Library Structure
|
|
42
|
-
|
|
43
|
-
Older 0.x releases of the `google-cloud-automl` gem were all-in-one gems
|
|
44
|
-
that included potentially multiple clients for multiple versions of the AutoML
|
|
45
|
-
service. Factory methods such as `Google::Cloud::AutoML::AutoML.new`
|
|
46
|
-
would return you instances of client classes such as
|
|
47
|
-
`Google::Cloud::AutoML::V1beta1::AutoMLClient`.
|
|
48
|
-
These classes were all defined in the same gem.
|
|
49
|
-
|
|
50
|
-
With the 1.0 release, the `google-cloud-automl` gem still provides factory
|
|
51
|
-
methods for obtaining clients. (The method signatures will have changed. See
|
|
52
|
-
[Creating Clients](#creating-clients) for details.) However, the actual client
|
|
53
|
-
classes have been moved into separate gems, one per service version. The
|
|
54
|
-
`Google::Cloud::AutoML::V1::AutoML::Client` class, along with its
|
|
55
|
-
helpers and data types, is now part of the `google-cloud-automl-v1` gem.
|
|
56
|
-
Similarly, the `Google::Cloud::AutoML::V1beta1::AutoML::Client`
|
|
57
|
-
class is part of the `google-cloud-automl-v1beta1` gem.
|
|
58
|
-
|
|
59
|
-
For normal usage, you can continue to install the `google-cloud-automl` gem
|
|
60
|
-
(which will bring in the versioned client gems as dependencies) and continue to
|
|
61
|
-
use factory methods to create clients. However, you may alternatively choose to
|
|
62
|
-
install only one of the versioned gems. For example, if you know you will only
|
|
63
|
-
use `V1` of the service, you can install `google-cloud-automl-v1` by
|
|
64
|
-
itself, and construct instances of the
|
|
65
|
-
`Google::Cloud::AutoML::V1::AutoML::Client` client class directly.
|
|
66
|
-
|
|
67
|
-
### Client Configuration
|
|
68
|
-
|
|
69
|
-
In older releases, if you wanted to customize performance parameters or
|
|
70
|
-
low-level behavior of the client (such as credentials, timeouts, or
|
|
71
|
-
instrumentation), you would pass a variety of keyword arguments to the client
|
|
72
|
-
constructor. It was also extremely difficult to customize the default settings.
|
|
73
|
-
|
|
74
|
-
With the 1.0 release, a configuration interface provides control over these
|
|
75
|
-
parameters, including defaults for all instances of a client, and settings for
|
|
76
|
-
each specific client instance. For example, to set default credentials and
|
|
77
|
-
timeout for all AutoML V1 clients:
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
Google::Cloud::AutoML::V1::AutoML::Client.configure do |config|
|
|
81
|
-
config.credentials = "/path/to/credentials.json"
|
|
82
|
-
config.timeout = 10.0
|
|
83
|
-
end
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Individual RPCs can also be configured independently. For example, to set the
|
|
87
|
-
timeout for the `create_dataset` call:
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
Google::Cloud::AutoML::V1::AutoML::Client.configure do |config|
|
|
91
|
-
config.rpcs.create_dataset.timeout = 20.0
|
|
92
|
-
end
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Defaults for certain configurations can be set for all AutoML versions and
|
|
96
|
-
services globally:
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
Google::Cloud::AutoML.configure do |config|
|
|
100
|
-
config.credentials = "/path/to/credentials.json"
|
|
101
|
-
config.timeout = 10.0
|
|
102
|
-
end
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Finally, you can override the configuration for each client instance. See the
|
|
106
|
-
next section on [Creating Clients](#creating-clients) for details.
|
|
107
|
-
|
|
108
|
-
### Creating Clients
|
|
109
|
-
|
|
110
|
-
In older releases, to create a client object, you would use the `new` method
|
|
111
|
-
of modules under `Google::Cloud::AutoML`. For example, you might call
|
|
112
|
-
`Google::Cloud::AutoML::AutoML.new`. Keyword arguments were available to
|
|
113
|
-
select a service version and to configure parameters such as credentials and
|
|
114
|
-
timeouts.
|
|
115
|
-
|
|
116
|
-
With the 1.0 release, use named class methods of `Google::Cloud::AutoML` to
|
|
117
|
-
create a client object. For example, `Google::Cloud::AutoML.auto_ml`.
|
|
118
|
-
You may select a service version using the `:version` keyword argument.
|
|
119
|
-
However, other configuration parameters should be set in a configuration block
|
|
120
|
-
when you create the client.
|
|
121
|
-
|
|
122
|
-
Old:
|
|
123
|
-
```
|
|
124
|
-
client = Google::Cloud::AutoML::AutoML.new credentials: "/path/to/credentials.json"
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
New:
|
|
128
|
-
```
|
|
129
|
-
client = Google::Cloud::AutoML.auto_ml do |config|
|
|
130
|
-
config.credentials = "/path/to/credentials.json"
|
|
131
|
-
end
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
The configuration block is optional. If you do not provide it, or you do not
|
|
135
|
-
set some configuration parameters, then the default configuration is used. See
|
|
136
|
-
[Client Configuration](#client-configuration).
|
|
137
|
-
|
|
138
|
-
### Passing Arguments
|
|
139
|
-
|
|
140
|
-
In older releases, required arguments would be passed as positional method
|
|
141
|
-
arguments, while most optional arguments would be passed as keyword arguments.
|
|
142
|
-
|
|
143
|
-
With the 1.0 release, all RPC arguments are passed as keyword arguments,
|
|
144
|
-
regardless of whether they are required or optional. For example:
|
|
145
|
-
|
|
146
|
-
Old:
|
|
147
|
-
```
|
|
148
|
-
client = Google::Cloud::AutoML::AutoML.new
|
|
149
|
-
|
|
150
|
-
parent = "projects/my-project/locations/my-location"
|
|
151
|
-
|
|
152
|
-
# parent is a positional argument, but page_size is a keyword argument.
|
|
153
|
-
response = client.list_datasets parent, page_size: 10
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
New:
|
|
157
|
-
```
|
|
158
|
-
client = Google::Cloud::AutoML.auto_ml
|
|
159
|
-
|
|
160
|
-
parent = "projects/my-project/locations/my-location"
|
|
161
|
-
|
|
162
|
-
# requests is a keyword argument
|
|
163
|
-
response = client.list_datasets parent: parent, page_size: 10
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
In the 1.0 release, it is also possible to pass a request object, either
|
|
167
|
-
as a hash or as a protocol buffer.
|
|
168
|
-
|
|
169
|
-
New:
|
|
170
|
-
```
|
|
171
|
-
client = Google::Cloud::AutoML.auto_ml
|
|
172
|
-
|
|
173
|
-
request = Google::Cloud::AutoML::V1::ListDatasetsRequest.new(
|
|
174
|
-
parent: "projects/my-project/locations/my-location",
|
|
175
|
-
page_size: 10
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
# Pass a request object as a positional argument:
|
|
179
|
-
response = client.list_datasets request
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Finally, in older releases, to provide call options, you would pass a
|
|
183
|
-
`Google::Gax::CallOptions` object with the `:options` keyword argument. In the
|
|
184
|
-
1.0 release, pass call options using a _second set_ of keyword arguments.
|
|
185
|
-
|
|
186
|
-
Old:
|
|
187
|
-
```
|
|
188
|
-
client = Google::Cloud::AutoML::AutoML.new
|
|
189
|
-
|
|
190
|
-
parent = "projects/my-project/locations/my-location"
|
|
191
|
-
|
|
192
|
-
options = Google::Gax::CallOptions.new timeout: 10.0
|
|
193
|
-
|
|
194
|
-
response = client.list_datasets parent, page_size: 10, options: options
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
New:
|
|
198
|
-
```
|
|
199
|
-
client = Google::Cloud::AutoML.auto_ml
|
|
200
|
-
|
|
201
|
-
parent = "projects/my-project/locations/my-location"
|
|
202
|
-
|
|
203
|
-
# Use a hash to wrap the normal call arguments (or pass a request object), and
|
|
204
|
-
# then add further keyword arguments for the call options.
|
|
205
|
-
response = client.batch_annotate_images(
|
|
206
|
-
{ parent: parent, page_size: 10 },
|
|
207
|
-
timeout: 10.0
|
|
208
|
-
)
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Resource Path Helpers
|
|
212
|
-
|
|
213
|
-
The client library includes helper methods for generating the resource path
|
|
214
|
-
strings passed to many calls. These helpers have changed in two ways:
|
|
215
|
-
|
|
216
|
-
* In older releases, they are _class_ methods on the client class. In the 1.0
|
|
217
|
-
release, they are _instance_ methods on the client. They are also available
|
|
218
|
-
on a separate paths module that you can include elsewhere for convenience.
|
|
219
|
-
* In older releases, arguments to a resource path helper are passed as
|
|
220
|
-
_positional_ arguments. In the 1.0 release, they are passed as named _keyword_
|
|
221
|
-
arguments.
|
|
222
|
-
|
|
223
|
-
Following is an example involving using a resource path helper.
|
|
224
|
-
|
|
225
|
-
Old:
|
|
226
|
-
```
|
|
227
|
-
client = Google::Cloud::AutoML::AutoML.new
|
|
228
|
-
|
|
229
|
-
# Call the helper on the client class
|
|
230
|
-
parent = Google::Cloud::AutoML::V1::AutoMLClient.location_path(
|
|
231
|
-
"my-project", "my-location"
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
response = client.list_datasets parent
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
New:
|
|
238
|
-
```
|
|
239
|
-
client = Google::Cloud::AutoML.auto_ml
|
|
240
|
-
|
|
241
|
-
# Call the helper on the client instance, and use keyword arguments
|
|
242
|
-
parent = client.location_path project: "my-project", location: "my-location"
|
|
243
|
-
|
|
244
|
-
response = client.list_datasets parent: parent
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
In the 1.0 client, you can also use the paths module as a convenience module.
|
|
248
|
-
|
|
249
|
-
New:
|
|
250
|
-
```
|
|
251
|
-
# Bring the path helper methods into the current class
|
|
252
|
-
include Google::Cloud::AutoML::V1::AutoML::Paths
|
|
253
|
-
|
|
254
|
-
def foo
|
|
255
|
-
client = Google::Cloud::AutoML.auto_ml
|
|
256
|
-
|
|
257
|
-
# Call the included helper method
|
|
258
|
-
parent = location_path project: "my-project", location: "my-location"
|
|
259
|
-
|
|
260
|
-
response = client.list_datasets parent: parent
|
|
261
|
-
|
|
262
|
-
# Do something with response...
|
|
263
|
-
end
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### Handling Errors
|
|
267
|
-
|
|
268
|
-
The client reports standard
|
|
269
|
-
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
|
270
|
-
by raising exceptions. In older releases, these exceptions were located in the
|
|
271
|
-
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
|
272
|
-
exception class, defined in the `google-gax` gem. However, these classes were
|
|
273
|
-
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
|
274
|
-
thrown by other client libraries such as `google-cloud-storage`.
|
|
275
|
-
|
|
276
|
-
The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
|
|
277
|
-
for consistency across all the Google Cloud client libraries. In general, these
|
|
278
|
-
exceptions have the same name as their counterparts from older releases, but
|
|
279
|
-
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
|
280
|
-
namespace.
|
|
281
|
-
|
|
282
|
-
Old:
|
|
283
|
-
```
|
|
284
|
-
client = Google::Cloud::AutoML::AutoML.new
|
|
285
|
-
|
|
286
|
-
parent = "projects/my-project/locations/my-location"
|
|
287
|
-
|
|
288
|
-
begin
|
|
289
|
-
response = client.list_datasets parent, page_size: 10
|
|
290
|
-
rescue Google::Gax::Error => e
|
|
291
|
-
# Handle exceptions that subclass Google::Gax::Error
|
|
292
|
-
end
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
New:
|
|
296
|
-
```
|
|
297
|
-
client = Google::Cloud::AutoML.auto_ml
|
|
298
|
-
|
|
299
|
-
parent = "projects/my-project/locations/my-location"
|
|
300
|
-
|
|
301
|
-
begin
|
|
302
|
-
response = client.list_datasets parent: parent, page_size: 10
|
|
303
|
-
rescue Google::Cloud::Error => e
|
|
304
|
-
# Handle exceptions that subclass Google::Cloud::Error
|
|
305
|
-
end
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### Class Namespaces
|
|
309
|
-
|
|
310
|
-
In older releases, the client object was of classes with names like:
|
|
311
|
-
`Google::Cloud::AutoML::V1::AutoMLClient`.
|
|
312
|
-
In the 1.0 release, the client object is of a different class:
|
|
313
|
-
`Google::Cloud::AutoML::V1::AutoML::Client`.
|
|
314
|
-
Note that most users will use the factory methods such as
|
|
315
|
-
`Google::Cloud::AutoML.auto_ml` to create instances of the client object,
|
|
316
|
-
so you may not need to reference the actual class directly.
|
|
317
|
-
See [Creating Clients](#creating-clients).
|
|
318
|
-
|
|
319
|
-
In older releases, the credentials object was of class
|
|
320
|
-
`Google::Cloud::AutoML::V1::Credentials`.
|
|
321
|
-
In the 1.0 release, each service has its own credentials class, e.g.
|
|
322
|
-
`Google::Cloud::AutoML::V1::AutoML::Credentials`.
|
|
323
|
-
Again, most users will not need to reference this class directly.
|
|
324
|
-
See [Client Configuration](#client-configuration).
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Copyright 2023 Google LLC
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
module Google
|
|
19
|
-
module Cloud
|
|
20
|
-
module AutoML
|
|
21
|
-
class << self
|
|
22
|
-
# Backwards-compatibility hack: Define "auto_ml" as an alternative name
|
|
23
|
-
# for the "automl" method. The generator changed this name due to
|
|
24
|
-
# https://github.com/googleapis/gapic-generator-ruby/pull/935.
|
|
25
|
-
if public_method_defined?(:automl) && !public_method_defined?(:auto_ml)
|
|
26
|
-
alias auto_ml automl
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
data/lib/google/cloud/automl.rb
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Copyright 2026 Google LLC
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
-
|
|
19
|
-
# Require this file early so that the version constant gets defined before
|
|
20
|
-
# requiring "google/cloud". This is because google-cloud-core will load the
|
|
21
|
-
# entrypoint (gem name) file, which in turn re-requires this file (hence
|
|
22
|
-
# causing a require cycle) unless the version constant is already defined.
|
|
23
|
-
require "google/cloud/automl/version"
|
|
24
|
-
|
|
25
|
-
require "googleauth"
|
|
26
|
-
gem "google-cloud-core"
|
|
27
|
-
require "google/cloud" unless defined? ::Google::Cloud.new
|
|
28
|
-
require "google/cloud/config"
|
|
29
|
-
|
|
30
|
-
# Set the default configuration
|
|
31
|
-
::Google::Cloud.configure.add_config! :automl do |config|
|
|
32
|
-
config.add_field! :endpoint, nil, match: ::String
|
|
33
|
-
config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
|
|
34
|
-
config.add_field! :scope, nil, match: [::Array, ::String]
|
|
35
|
-
config.add_field! :lib_name, nil, match: ::String
|
|
36
|
-
config.add_field! :lib_version, nil, match: ::String
|
|
37
|
-
config.add_field! :interceptors, nil, match: ::Array
|
|
38
|
-
config.add_field! :timeout, nil, match: ::Numeric
|
|
39
|
-
config.add_field! :metadata, nil, match: ::Hash
|
|
40
|
-
config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
|
|
41
|
-
config.add_field! :quota_project, nil, match: ::String
|
|
42
|
-
config.add_field! :universe_domain, nil, match: ::String
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
module Google
|
|
46
|
-
module Cloud
|
|
47
|
-
module AutoML
|
|
48
|
-
##
|
|
49
|
-
# Create a new client object for PredictionService.
|
|
50
|
-
#
|
|
51
|
-
# By default, this returns an instance of
|
|
52
|
-
# [Google::Cloud::AutoML::V1::PredictionService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-automl-v1/latest/Google-Cloud-AutoML-V1-PredictionService-Client)
|
|
53
|
-
# for a gRPC client for version V1 of the API.
|
|
54
|
-
# However, you can specify a different API version by passing it in the
|
|
55
|
-
# `version` parameter. If the PredictionService service is
|
|
56
|
-
# supported by that API version, and the corresponding gem is available, the
|
|
57
|
-
# appropriate versioned client will be returned.
|
|
58
|
-
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
|
59
|
-
# the `transport` parameter.
|
|
60
|
-
#
|
|
61
|
-
# Raises an exception if the currently installed versioned client gem for the
|
|
62
|
-
# given API version does not support the given transport of the PredictionService service.
|
|
63
|
-
# You can determine whether the method will succeed by calling
|
|
64
|
-
# {Google::Cloud::AutoML.prediction_service_available?}.
|
|
65
|
-
#
|
|
66
|
-
# ## About PredictionService
|
|
67
|
-
#
|
|
68
|
-
# AutoML Prediction API.
|
|
69
|
-
#
|
|
70
|
-
# On any input that is documented to expect a string parameter in
|
|
71
|
-
# snake_case or dash-case, either of those cases is accepted.
|
|
72
|
-
#
|
|
73
|
-
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
74
|
-
# Defaults to `:v1`.
|
|
75
|
-
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
76
|
-
# @return [::Object] A client object for the specified version.
|
|
77
|
-
#
|
|
78
|
-
def self.prediction_service version: :v1, transport: :grpc, &block
|
|
79
|
-
require "google/cloud/automl/#{version.to_s.downcase}"
|
|
80
|
-
|
|
81
|
-
package_name = Google::Cloud::AutoML
|
|
82
|
-
.constants
|
|
83
|
-
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
84
|
-
.first
|
|
85
|
-
service_module = Google::Cloud::AutoML.const_get(package_name).const_get(:PredictionService)
|
|
86
|
-
service_module = service_module.const_get(:Rest) if transport == :rest
|
|
87
|
-
service_module.const_get(:Client).new(&block)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
##
|
|
91
|
-
# Determines whether the PredictionService service is supported by the current client.
|
|
92
|
-
# If true, you can retrieve a client object by calling {Google::Cloud::AutoML.prediction_service}.
|
|
93
|
-
# If false, that method will raise an exception. This could happen if the given
|
|
94
|
-
# API version does not exist or does not support the PredictionService service,
|
|
95
|
-
# or if the versioned client gem needs an update to support the PredictionService service.
|
|
96
|
-
#
|
|
97
|
-
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
98
|
-
# Defaults to `:v1`.
|
|
99
|
-
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
100
|
-
# @return [boolean] Whether the service is available.
|
|
101
|
-
#
|
|
102
|
-
def self.prediction_service_available? version: :v1, transport: :grpc
|
|
103
|
-
require "google/cloud/automl/#{version.to_s.downcase}"
|
|
104
|
-
package_name = Google::Cloud::AutoML
|
|
105
|
-
.constants
|
|
106
|
-
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
107
|
-
.first
|
|
108
|
-
return false unless package_name
|
|
109
|
-
service_module = Google::Cloud::AutoML.const_get package_name
|
|
110
|
-
return false unless service_module.const_defined? :PredictionService
|
|
111
|
-
service_module = service_module.const_get :PredictionService
|
|
112
|
-
if transport == :rest
|
|
113
|
-
return false unless service_module.const_defined? :Rest
|
|
114
|
-
service_module = service_module.const_get :Rest
|
|
115
|
-
end
|
|
116
|
-
service_module.const_defined? :Client
|
|
117
|
-
rescue ::LoadError
|
|
118
|
-
false
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
##
|
|
122
|
-
# Create a new client object for AutoML.
|
|
123
|
-
#
|
|
124
|
-
# By default, this returns an instance of
|
|
125
|
-
# [Google::Cloud::AutoML::V1::AutoML::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-automl-v1/latest/Google-Cloud-AutoML-V1-AutoML-Client)
|
|
126
|
-
# for a gRPC client for version V1 of the API.
|
|
127
|
-
# However, you can specify a different API version by passing it in the
|
|
128
|
-
# `version` parameter. If the AutoML service is
|
|
129
|
-
# supported by that API version, and the corresponding gem is available, the
|
|
130
|
-
# appropriate versioned client will be returned.
|
|
131
|
-
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
|
132
|
-
# the `transport` parameter.
|
|
133
|
-
#
|
|
134
|
-
# Raises an exception if the currently installed versioned client gem for the
|
|
135
|
-
# given API version does not support the given transport of the AutoML service.
|
|
136
|
-
# You can determine whether the method will succeed by calling
|
|
137
|
-
# {Google::Cloud::AutoML.automl_available?}.
|
|
138
|
-
#
|
|
139
|
-
# ## About AutoML
|
|
140
|
-
#
|
|
141
|
-
# AutoML Server API.
|
|
142
|
-
#
|
|
143
|
-
# The resource names are assigned by the server.
|
|
144
|
-
# The server never reuses names that it has created after the resources with
|
|
145
|
-
# those names are deleted.
|
|
146
|
-
#
|
|
147
|
-
# An ID of a resource is the last element of the item's resource name. For
|
|
148
|
-
# `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then
|
|
149
|
-
# the id for the item is `{dataset_id}`.
|
|
150
|
-
#
|
|
151
|
-
# Currently the only supported `location_id` is "us-central1".
|
|
152
|
-
#
|
|
153
|
-
# On any input that is documented to expect a string parameter in
|
|
154
|
-
# snake_case or dash-case, either of those cases is accepted.
|
|
155
|
-
#
|
|
156
|
-
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
157
|
-
# Defaults to `:v1`.
|
|
158
|
-
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
159
|
-
# @return [::Object] A client object for the specified version.
|
|
160
|
-
#
|
|
161
|
-
def self.automl version: :v1, transport: :grpc, &block
|
|
162
|
-
require "google/cloud/automl/#{version.to_s.downcase}"
|
|
163
|
-
|
|
164
|
-
package_name = Google::Cloud::AutoML
|
|
165
|
-
.constants
|
|
166
|
-
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
167
|
-
.first
|
|
168
|
-
service_module = Google::Cloud::AutoML.const_get(package_name).const_get(:AutoML)
|
|
169
|
-
service_module = service_module.const_get(:Rest) if transport == :rest
|
|
170
|
-
service_module.const_get(:Client).new(&block)
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
##
|
|
174
|
-
# Determines whether the AutoML service is supported by the current client.
|
|
175
|
-
# If true, you can retrieve a client object by calling {Google::Cloud::AutoML.automl}.
|
|
176
|
-
# If false, that method will raise an exception. This could happen if the given
|
|
177
|
-
# API version does not exist or does not support the AutoML service,
|
|
178
|
-
# or if the versioned client gem needs an update to support the AutoML service.
|
|
179
|
-
#
|
|
180
|
-
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
181
|
-
# Defaults to `:v1`.
|
|
182
|
-
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
183
|
-
# @return [boolean] Whether the service is available.
|
|
184
|
-
#
|
|
185
|
-
def self.automl_available? version: :v1, transport: :grpc
|
|
186
|
-
require "google/cloud/automl/#{version.to_s.downcase}"
|
|
187
|
-
package_name = Google::Cloud::AutoML
|
|
188
|
-
.constants
|
|
189
|
-
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
190
|
-
.first
|
|
191
|
-
return false unless package_name
|
|
192
|
-
service_module = Google::Cloud::AutoML.const_get package_name
|
|
193
|
-
return false unless service_module.const_defined? :AutoML
|
|
194
|
-
service_module = service_module.const_get :AutoML
|
|
195
|
-
if transport == :rest
|
|
196
|
-
return false unless service_module.const_defined? :Rest
|
|
197
|
-
service_module = service_module.const_get :Rest
|
|
198
|
-
end
|
|
199
|
-
service_module.const_defined? :Client
|
|
200
|
-
rescue ::LoadError
|
|
201
|
-
false
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
##
|
|
205
|
-
# Configure the google-cloud-automl library.
|
|
206
|
-
#
|
|
207
|
-
# The following configuration parameters are supported:
|
|
208
|
-
#
|
|
209
|
-
# * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
|
|
210
|
-
# The path to the keyfile as a String, the contents of the keyfile as a
|
|
211
|
-
# Hash, or a Google::Auth::Credentials object.
|
|
212
|
-
# * `lib_name` (*type:* `String`) -
|
|
213
|
-
# The library name as recorded in instrumentation and logging.
|
|
214
|
-
# * `lib_version` (*type:* `String`) -
|
|
215
|
-
# The library version as recorded in instrumentation and logging.
|
|
216
|
-
# * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
|
|
217
|
-
# An array of interceptors that are run before calls are executed.
|
|
218
|
-
# * `timeout` (*type:* `Numeric`) -
|
|
219
|
-
# Default timeout in seconds.
|
|
220
|
-
# * `metadata` (*type:* `Hash{Symbol=>String}`) -
|
|
221
|
-
# Additional headers to be sent with the call.
|
|
222
|
-
# * `retry_policy` (*type:* `Hash`) -
|
|
223
|
-
# The retry policy. The value is a hash with the following keys:
|
|
224
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
225
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
226
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
227
|
-
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
228
|
-
# * `:retry_codes` (*type:* `Array<String>`) -
|
|
229
|
-
# The error codes that should trigger a retry.
|
|
230
|
-
#
|
|
231
|
-
# @return [::Google::Cloud::Config] The default configuration used by this library
|
|
232
|
-
#
|
|
233
|
-
def self.configure
|
|
234
|
-
yield ::Google::Cloud.configure.automl if block_given?
|
|
235
|
-
|
|
236
|
-
::Google::Cloud.configure.automl
|
|
237
|
-
end
|
|
238
|
-
end
|
|
239
|
-
end
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
helper_path = ::File.join __dir__, "automl", "helpers.rb"
|
|
243
|
-
require "google/cloud/automl/helpers" if ::File.file? helper_path
|
data/lib/google-cloud-automl.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Copyright 2026 Google LLC
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
-
|
|
19
|
-
require "google/cloud/automl" unless defined? Google::Cloud::AutoML::VERSION
|