google-cloud-talent 0.8.1 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +347 -0
  6. data/README.md +35 -25
  7. data/lib/{google/cloud/talent/v4beta1/doc/google/protobuf/empty.rb → google-cloud-talent.rb} +5 -15
  8. data/lib/google/cloud/talent.rb +254 -442
  9. data/lib/google/cloud/talent/version.rb +6 -2
  10. metadata +62 -111
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/talent/v4beta1.rb +0 -543
  13. data/lib/google/cloud/talent/v4beta1/application_pb.rb +0 -62
  14. data/lib/google/cloud/talent/v4beta1/application_service_client.rb +0 -491
  15. data/lib/google/cloud/talent/v4beta1/application_service_client_config.json +0 -51
  16. data/lib/google/cloud/talent/v4beta1/application_service_pb.rb +0 -54
  17. data/lib/google/cloud/talent/v4beta1/application_service_services_pb.rb +0 -56
  18. data/lib/google/cloud/talent/v4beta1/batch_pb.rb +0 -18
  19. data/lib/google/cloud/talent/v4beta1/common_pb.rb +0 -341
  20. data/lib/google/cloud/talent/v4beta1/company_pb.rb +0 -40
  21. data/lib/google/cloud/talent/v4beta1/company_service_client.rb +0 -535
  22. data/lib/google/cloud/talent/v4beta1/company_service_client_config.json +0 -51
  23. data/lib/google/cloud/talent/v4beta1/company_service_pb.rb +0 -55
  24. data/lib/google/cloud/talent/v4beta1/company_service_services_pb.rb +0 -56
  25. data/lib/google/cloud/talent/v4beta1/completion_client.rb +0 -359
  26. data/lib/google/cloud/talent/v4beta1/completion_client_config.json +0 -31
  27. data/lib/google/cloud/talent/v4beta1/completion_service_pb.rb +0 -55
  28. data/lib/google/cloud/talent/v4beta1/completion_service_services_pb.rb +0 -48
  29. data/lib/google/cloud/talent/v4beta1/credentials.rb +0 -42
  30. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/application.rb +0 -166
  31. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/application_service.rb +0 -107
  32. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/common.rb +0 -1147
  33. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/company.rb +0 -110
  34. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/company_service.rb +0 -122
  35. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/completion_service.rb +0 -141
  36. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/event.rb +0 -238
  37. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/event_service.rb +0 -36
  38. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/filters.rb +0 -847
  39. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/histogram.rb +0 -55
  40. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/job.rb +0 -363
  41. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/job_service.rb +0 -762
  42. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/profile.rb +0 -808
  43. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/profile_service.rb +0 -446
  44. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/tenant.rb +0 -74
  45. data/lib/google/cloud/talent/v4beta1/doc/google/cloud/talent/v4beta1/tenant_service.rb +0 -101
  46. data/lib/google/cloud/talent/v4beta1/doc/google/longrunning/operations.rb +0 -51
  47. data/lib/google/cloud/talent/v4beta1/doc/google/protobuf/any.rb +0 -131
  48. data/lib/google/cloud/talent/v4beta1/doc/google/protobuf/duration.rb +0 -91
  49. data/lib/google/cloud/talent/v4beta1/doc/google/protobuf/field_mask.rb +0 -222
  50. data/lib/google/cloud/talent/v4beta1/doc/google/protobuf/timestamp.rb +0 -113
  51. data/lib/google/cloud/talent/v4beta1/doc/google/protobuf/wrappers.rb +0 -34
  52. data/lib/google/cloud/talent/v4beta1/doc/google/rpc/status.rb +0 -87
  53. data/lib/google/cloud/talent/v4beta1/doc/google/type/date.rb +0 -43
  54. data/lib/google/cloud/talent/v4beta1/doc/google/type/latlng.rb +0 -31
  55. data/lib/google/cloud/talent/v4beta1/doc/google/type/money.rb +0 -36
  56. data/lib/google/cloud/talent/v4beta1/doc/google/type/postal_address.rb +0 -126
  57. data/lib/google/cloud/talent/v4beta1/doc/google/type/timeofday.rb +0 -37
  58. data/lib/google/cloud/talent/v4beta1/event_pb.rb +0 -69
  59. data/lib/google/cloud/talent/v4beta1/event_service_client.rb +0 -268
  60. data/lib/google/cloud/talent/v4beta1/event_service_client_config.json +0 -31
  61. data/lib/google/cloud/talent/v4beta1/event_service_pb.rb +0 -26
  62. data/lib/google/cloud/talent/v4beta1/event_service_services_pb.rb +0 -53
  63. data/lib/google/cloud/talent/v4beta1/filters_pb.rb +0 -187
  64. data/lib/google/cloud/talent/v4beta1/helpers.rb +0 -162
  65. data/lib/google/cloud/talent/v4beta1/histogram_pb.rb +0 -27
  66. data/lib/google/cloud/talent/v4beta1/job_pb.rb +0 -71
  67. data/lib/google/cloud/talent/v4beta1/job_service_client.rb +0 -1576
  68. data/lib/google/cloud/talent/v4beta1/job_service_client_config.json +0 -76
  69. data/lib/google/cloud/talent/v4beta1/job_service_pb.rb +0 -165
  70. data/lib/google/cloud/talent/v4beta1/job_service_services_pb.rb +0 -92
  71. data/lib/google/cloud/talent/v4beta1/profile_pb.rb +0 -212
  72. data/lib/google/cloud/talent/v4beta1/profile_service_client.rb +0 -844
  73. data/lib/google/cloud/talent/v4beta1/profile_service_client_config.json +0 -56
  74. data/lib/google/cloud/talent/v4beta1/profile_service_pb.rb +0 -88
  75. data/lib/google/cloud/talent/v4beta1/profile_service_services_pb.rb +0 -67
  76. data/lib/google/cloud/talent/v4beta1/tenant_pb.rb +0 -33
  77. data/lib/google/cloud/talent/v4beta1/tenant_service_client.rb +0 -476
  78. data/lib/google/cloud/talent/v4beta1/tenant_service_client_config.json +0 -51
  79. data/lib/google/cloud/talent/v4beta1/tenant_service_pb.rb +0 -54
  80. data/lib/google/cloud/talent/v4beta1/tenant_service_services_pb.rb +0 -55
@@ -1,56 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.cloud.talent.v4beta1.ProfileService": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "default": {
13
- "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "ListProfiles": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "CreateProfile": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "non_idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "GetProfile": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "idempotent",
36
- "retry_params_name": "default"
37
- },
38
- "UpdateProfile": {
39
- "timeout_millis": 60000,
40
- "retry_codes_name": "non_idempotent",
41
- "retry_params_name": "default"
42
- },
43
- "DeleteProfile": {
44
- "timeout_millis": 60000,
45
- "retry_codes_name": "idempotent",
46
- "retry_params_name": "default"
47
- },
48
- "SearchProfiles": {
49
- "timeout_millis": 60000,
50
- "retry_codes_name": "non_idempotent",
51
- "retry_params_name": "default"
52
- }
53
- }
54
- }
55
- }
56
- }
@@ -1,88 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/talent/v4beta1/profile_service.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/api/client_pb'
9
- require 'google/api/field_behavior_pb'
10
- require 'google/cloud/talent/v4beta1/common_pb'
11
- require 'google/cloud/talent/v4beta1/filters_pb'
12
- require 'google/cloud/talent/v4beta1/histogram_pb'
13
- require 'google/cloud/talent/v4beta1/profile_pb'
14
- require 'google/protobuf/any_pb'
15
- require 'google/protobuf/empty_pb'
16
- require 'google/protobuf/field_mask_pb'
17
- Google::Protobuf::DescriptorPool.generated_pool.build do
18
- add_message "google.cloud.talent.v4beta1.ListProfilesRequest" do
19
- optional :parent, :string, 1
20
- optional :filter, :string, 5
21
- optional :page_token, :string, 2
22
- optional :page_size, :int32, 3
23
- optional :read_mask, :message, 4, "google.protobuf.FieldMask"
24
- end
25
- add_message "google.cloud.talent.v4beta1.ListProfilesResponse" do
26
- repeated :profiles, :message, 1, "google.cloud.talent.v4beta1.Profile"
27
- optional :next_page_token, :string, 2
28
- end
29
- add_message "google.cloud.talent.v4beta1.CreateProfileRequest" do
30
- optional :parent, :string, 1
31
- optional :profile, :message, 2, "google.cloud.talent.v4beta1.Profile"
32
- end
33
- add_message "google.cloud.talent.v4beta1.GetProfileRequest" do
34
- optional :name, :string, 1
35
- end
36
- add_message "google.cloud.talent.v4beta1.UpdateProfileRequest" do
37
- optional :profile, :message, 1, "google.cloud.talent.v4beta1.Profile"
38
- optional :update_mask, :message, 2, "google.protobuf.FieldMask"
39
- end
40
- add_message "google.cloud.talent.v4beta1.DeleteProfileRequest" do
41
- optional :name, :string, 1
42
- end
43
- add_message "google.cloud.talent.v4beta1.SearchProfilesRequest" do
44
- optional :parent, :string, 1
45
- optional :request_metadata, :message, 2, "google.cloud.talent.v4beta1.RequestMetadata"
46
- optional :profile_query, :message, 3, "google.cloud.talent.v4beta1.ProfileQuery"
47
- optional :page_size, :int32, 4
48
- optional :page_token, :string, 5
49
- optional :offset, :int32, 6
50
- optional :disable_spell_check, :bool, 7
51
- optional :order_by, :string, 8
52
- optional :case_sensitive_sort, :bool, 9
53
- repeated :histogram_queries, :message, 10, "google.cloud.talent.v4beta1.HistogramQuery"
54
- optional :result_set_id, :string, 12
55
- optional :strict_keywords_search, :bool, 13
56
- end
57
- add_message "google.cloud.talent.v4beta1.SearchProfilesResponse" do
58
- optional :estimated_total_size, :int64, 1
59
- optional :spell_correction, :message, 2, "google.cloud.talent.v4beta1.SpellingCorrection"
60
- optional :metadata, :message, 3, "google.cloud.talent.v4beta1.ResponseMetadata"
61
- optional :next_page_token, :string, 4
62
- repeated :histogram_query_results, :message, 5, "google.cloud.talent.v4beta1.HistogramQueryResult"
63
- repeated :summarized_profiles, :message, 6, "google.cloud.talent.v4beta1.SummarizedProfile"
64
- optional :result_set_id, :string, 7
65
- end
66
- add_message "google.cloud.talent.v4beta1.SummarizedProfile" do
67
- repeated :profiles, :message, 1, "google.cloud.talent.v4beta1.Profile"
68
- optional :summary, :message, 2, "google.cloud.talent.v4beta1.Profile"
69
- end
70
- end
71
-
72
- module Google
73
- module Cloud
74
- module Talent
75
- module V4beta1
76
- ListProfilesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.ListProfilesRequest").msgclass
77
- ListProfilesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.ListProfilesResponse").msgclass
78
- CreateProfileRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.CreateProfileRequest").msgclass
79
- GetProfileRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.GetProfileRequest").msgclass
80
- UpdateProfileRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.UpdateProfileRequest").msgclass
81
- DeleteProfileRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.DeleteProfileRequest").msgclass
82
- SearchProfilesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.SearchProfilesRequest").msgclass
83
- SearchProfilesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.SearchProfilesResponse").msgclass
84
- SummarizedProfile = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.SummarizedProfile").msgclass
85
- end
86
- end
87
- end
88
- end
@@ -1,67 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # Source: google/cloud/talent/v4beta1/profile_service.proto for package 'google.cloud.talent.v4beta1'
3
- # Original file comments:
4
- # Copyright 2019 Google LLC.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
- #
19
-
20
-
21
- require 'grpc'
22
- require 'google/cloud/talent/v4beta1/profile_service_pb'
23
-
24
- module Google
25
- module Cloud
26
- module Talent
27
- module V4beta1
28
- module ProfileService
29
- # A service that handles profile management, including profile CRUD,
30
- # enumeration and search.
31
- class Service
32
-
33
- include GRPC::GenericService
34
-
35
- self.marshal_class_method = :encode
36
- self.unmarshal_class_method = :decode
37
- self.service_name = 'google.cloud.talent.v4beta1.ProfileService'
38
-
39
- # Lists profiles by filter. The order is unspecified.
40
- rpc :ListProfiles, ListProfilesRequest, ListProfilesResponse
41
- # Creates and returns a new profile.
42
- rpc :CreateProfile, CreateProfileRequest, Profile
43
- # Gets the specified profile.
44
- rpc :GetProfile, GetProfileRequest, Profile
45
- # Updates the specified profile and returns the updated result.
46
- rpc :UpdateProfile, UpdateProfileRequest, Profile
47
- # Deletes the specified profile.
48
- # Prerequisite: The profile has no associated applications or assignments
49
- # associated.
50
- rpc :DeleteProfile, DeleteProfileRequest, Google::Protobuf::Empty
51
- # Searches for profiles within a tenant.
52
- #
53
- # For example, search by raw queries "software engineer in Mountain View" or
54
- # search by structured filters (location filter, education filter, etc.).
55
- #
56
- # See
57
- # [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]
58
- # for more information.
59
- rpc :SearchProfiles, SearchProfilesRequest, SearchProfilesResponse
60
- end
61
-
62
- Stub = Service.rpc_stub_class
63
- end
64
- end
65
- end
66
- end
67
- end
@@ -1,33 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/talent/v4beta1/tenant.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/api/field_behavior_pb'
9
- require 'google/protobuf/timestamp_pb'
10
- Google::Protobuf::DescriptorPool.generated_pool.build do
11
- add_message "google.cloud.talent.v4beta1.Tenant" do
12
- optional :name, :string, 1
13
- optional :external_id, :string, 2
14
- optional :usage_type, :enum, 3, "google.cloud.talent.v4beta1.Tenant.DataUsageType"
15
- repeated :keyword_searchable_profile_custom_attributes, :string, 4
16
- end
17
- add_enum "google.cloud.talent.v4beta1.Tenant.DataUsageType" do
18
- value :DATA_USAGE_TYPE_UNSPECIFIED, 0
19
- value :AGGREGATED, 1
20
- value :ISOLATED, 2
21
- end
22
- end
23
-
24
- module Google
25
- module Cloud
26
- module Talent
27
- module V4beta1
28
- Tenant = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.Tenant").msgclass
29
- Tenant::DataUsageType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.Tenant.DataUsageType").enummodule
30
- end
31
- end
32
- end
33
- end
@@ -1,476 +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/talent/v4beta1/tenant_service.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
-
28
- require "google/cloud/talent/v4beta1/tenant_service_pb"
29
- require "google/cloud/talent/v4beta1/credentials"
30
- require "google/cloud/talent/version"
31
-
32
- module Google
33
- module Cloud
34
- module Talent
35
- module V4beta1
36
- # A service that handles tenant management, including CRUD and enumeration.
37
- #
38
- # @!attribute [r] tenant_service_stub
39
- # @return [Google::Cloud::Talent::V4beta1::TenantService::Stub]
40
- class TenantServiceClient
41
- # @private
42
- attr_reader :tenant_service_stub
43
-
44
- # The default address of the service.
45
- SERVICE_ADDRESS = "jobs.googleapis.com".freeze
46
-
47
- # The default port of the service.
48
- DEFAULT_SERVICE_PORT = 443
49
-
50
- # The default set of gRPC interceptors.
51
- GRPC_INTERCEPTORS = []
52
-
53
- DEFAULT_TIMEOUT = 30
54
-
55
- PAGE_DESCRIPTORS = {
56
- "list_tenants" => Google::Gax::PageDescriptor.new(
57
- "page_token",
58
- "next_page_token",
59
- "tenants")
60
- }.freeze
61
-
62
- private_constant :PAGE_DESCRIPTORS
63
-
64
- # The scopes needed to make gRPC calls to all of the methods defined in
65
- # this service.
66
- ALL_SCOPES = [
67
- "https://www.googleapis.com/auth/cloud-platform",
68
- "https://www.googleapis.com/auth/jobs"
69
- ].freeze
70
-
71
-
72
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
73
- "projects/{project}"
74
- )
75
-
76
- private_constant :PROJECT_PATH_TEMPLATE
77
-
78
- TENANT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
79
- "projects/{project}/tenants/{tenant}"
80
- )
81
-
82
- private_constant :TENANT_PATH_TEMPLATE
83
-
84
- # Returns a fully-qualified project resource name string.
85
- # @param project [String]
86
- # @return [String]
87
- def self.project_path project
88
- PROJECT_PATH_TEMPLATE.render(
89
- :"project" => project
90
- )
91
- end
92
-
93
- # Returns a fully-qualified tenant resource name string.
94
- # @param project [String]
95
- # @param tenant [String]
96
- # @return [String]
97
- def self.tenant_path project, tenant
98
- TENANT_PATH_TEMPLATE.render(
99
- :"project" => project,
100
- :"tenant" => tenant
101
- )
102
- end
103
-
104
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
105
- # Provides the means for authenticating requests made by the client. This parameter can
106
- # be many types.
107
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
108
- # authenticating requests made by this client.
109
- # A `String` will be treated as the path to the keyfile to be used for the construction of
110
- # credentials for this client.
111
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
112
- # credentials for this client.
113
- # A `GRPC::Core::Channel` will be used to make calls through.
114
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
115
- # should already be composed with a `GRPC::Core::CallCredentials` object.
116
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
117
- # metadata for requests, generally, to give OAuth credentials.
118
- # @param scopes [Array<String>]
119
- # The OAuth scopes for this service. This parameter is ignored if
120
- # an updater_proc is supplied.
121
- # @param client_config [Hash]
122
- # A Hash for call options for each method. See
123
- # Google::Gax#construct_settings for the structure of
124
- # this data. Falls back to the default config if not specified
125
- # or the specified config is missing data points.
126
- # @param timeout [Numeric]
127
- # The default timeout, in seconds, for calls made through this client.
128
- # @param metadata [Hash]
129
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
130
- # @param service_address [String]
131
- # Override for the service hostname, or `nil` to leave as the default.
132
- # @param service_port [Integer]
133
- # Override for the service port, or `nil` to leave as the default.
134
- # @param exception_transformer [Proc]
135
- # An optional proc that intercepts any exceptions raised during an API call to inject
136
- # custom error handling.
137
- def initialize \
138
- credentials: nil,
139
- scopes: ALL_SCOPES,
140
- client_config: {},
141
- timeout: DEFAULT_TIMEOUT,
142
- metadata: nil,
143
- service_address: nil,
144
- service_port: nil,
145
- exception_transformer: nil,
146
- lib_name: nil,
147
- lib_version: ""
148
- # These require statements are intentionally placed here to initialize
149
- # the gRPC module only when it's required.
150
- # See https://github.com/googleapis/toolkit/issues/446
151
- require "google/gax/grpc"
152
- require "google/cloud/talent/v4beta1/tenant_service_services_pb"
153
-
154
- credentials ||= Google::Cloud::Talent::V4beta1::Credentials.default
155
-
156
- if credentials.is_a?(String) || credentials.is_a?(Hash)
157
- updater_proc = Google::Cloud::Talent::V4beta1::Credentials.new(credentials).updater_proc
158
- end
159
- if credentials.is_a?(GRPC::Core::Channel)
160
- channel = credentials
161
- end
162
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
163
- chan_creds = credentials
164
- end
165
- if credentials.is_a?(Proc)
166
- updater_proc = credentials
167
- end
168
- if credentials.is_a?(Google::Auth::Credentials)
169
- updater_proc = credentials.updater_proc
170
- end
171
-
172
- package_version = Google::Cloud::Talent::VERSION
173
-
174
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
175
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
176
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
177
- google_api_client << " grpc/#{GRPC::VERSION}"
178
- google_api_client.freeze
179
-
180
- headers = { :"x-goog-api-client" => google_api_client }
181
- headers.merge!(metadata) unless metadata.nil?
182
- client_config_file = Pathname.new(__dir__).join(
183
- "tenant_service_client_config.json"
184
- )
185
- defaults = client_config_file.open do |f|
186
- Google::Gax.construct_settings(
187
- "google.cloud.talent.v4beta1.TenantService",
188
- JSON.parse(f.read),
189
- client_config,
190
- Google::Gax::Grpc::STATUS_CODE_NAMES,
191
- timeout,
192
- page_descriptors: PAGE_DESCRIPTORS,
193
- errors: Google::Gax::Grpc::API_ERRORS,
194
- metadata: headers
195
- )
196
- end
197
-
198
- # Allow overriding the service path/port in subclasses.
199
- service_path = service_address || self.class::SERVICE_ADDRESS
200
- port = service_port || self.class::DEFAULT_SERVICE_PORT
201
- interceptors = self.class::GRPC_INTERCEPTORS
202
- @tenant_service_stub = Google::Gax::Grpc.create_stub(
203
- service_path,
204
- port,
205
- chan_creds: chan_creds,
206
- channel: channel,
207
- updater_proc: updater_proc,
208
- scopes: scopes,
209
- interceptors: interceptors,
210
- &Google::Cloud::Talent::V4beta1::TenantService::Stub.method(:new)
211
- )
212
-
213
- @create_tenant = Google::Gax.create_api_call(
214
- @tenant_service_stub.method(:create_tenant),
215
- defaults["create_tenant"],
216
- exception_transformer: exception_transformer,
217
- params_extractor: proc do |request|
218
- {'parent' => request.parent}
219
- end
220
- )
221
- @get_tenant = Google::Gax.create_api_call(
222
- @tenant_service_stub.method(:get_tenant),
223
- defaults["get_tenant"],
224
- exception_transformer: exception_transformer,
225
- params_extractor: proc do |request|
226
- {'name' => request.name}
227
- end
228
- )
229
- @update_tenant = Google::Gax.create_api_call(
230
- @tenant_service_stub.method(:update_tenant),
231
- defaults["update_tenant"],
232
- exception_transformer: exception_transformer,
233
- params_extractor: proc do |request|
234
- {'tenant.name' => request.tenant.name}
235
- end
236
- )
237
- @delete_tenant = Google::Gax.create_api_call(
238
- @tenant_service_stub.method(:delete_tenant),
239
- defaults["delete_tenant"],
240
- exception_transformer: exception_transformer,
241
- params_extractor: proc do |request|
242
- {'name' => request.name}
243
- end
244
- )
245
- @list_tenants = Google::Gax.create_api_call(
246
- @tenant_service_stub.method(:list_tenants),
247
- defaults["list_tenants"],
248
- exception_transformer: exception_transformer,
249
- params_extractor: proc do |request|
250
- {'parent' => request.parent}
251
- end
252
- )
253
- end
254
-
255
- # Service calls
256
-
257
- # Creates a new tenant entity.
258
- #
259
- # @param parent [String]
260
- # Required. Resource name of the project under which the tenant is created.
261
- #
262
- # The format is "projects/{project_id}", for example,
263
- # "projects/foo".
264
- # @param tenant [Google::Cloud::Talent::V4beta1::Tenant | Hash]
265
- # Required. The tenant to be created.
266
- # A hash of the same form as `Google::Cloud::Talent::V4beta1::Tenant`
267
- # can also be provided.
268
- # @param options [Google::Gax::CallOptions]
269
- # Overrides the default settings for this call, e.g, timeout,
270
- # retries, etc.
271
- # @yield [result, operation] Access the result along with the RPC operation
272
- # @yieldparam result [Google::Cloud::Talent::V4beta1::Tenant]
273
- # @yieldparam operation [GRPC::ActiveCall::Operation]
274
- # @return [Google::Cloud::Talent::V4beta1::Tenant]
275
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
276
- # @example
277
- # require "google/cloud/talent"
278
- #
279
- # tenant_client = Google::Cloud::Talent::TenantService.new(version: :v4beta1)
280
- # formatted_parent = Google::Cloud::Talent::V4beta1::TenantServiceClient.project_path("[PROJECT]")
281
- #
282
- # # TODO: Initialize `tenant`:
283
- # tenant = {}
284
- # response = tenant_client.create_tenant(formatted_parent, tenant)
285
-
286
- def create_tenant \
287
- parent,
288
- tenant,
289
- options: nil,
290
- &block
291
- req = {
292
- parent: parent,
293
- tenant: tenant
294
- }.delete_if { |_, v| v.nil? }
295
- req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::CreateTenantRequest)
296
- @create_tenant.call(req, options, &block)
297
- end
298
-
299
- # Retrieves specified tenant.
300
- #
301
- # @param name [String]
302
- # Required. The resource name of the tenant to be retrieved.
303
- #
304
- # The format is "projects/{project_id}/tenants/{tenant_id}", for example,
305
- # "projects/foo/tenants/bar".
306
- # @param options [Google::Gax::CallOptions]
307
- # Overrides the default settings for this call, e.g, timeout,
308
- # retries, etc.
309
- # @yield [result, operation] Access the result along with the RPC operation
310
- # @yieldparam result [Google::Cloud::Talent::V4beta1::Tenant]
311
- # @yieldparam operation [GRPC::ActiveCall::Operation]
312
- # @return [Google::Cloud::Talent::V4beta1::Tenant]
313
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
314
- # @example
315
- # require "google/cloud/talent"
316
- #
317
- # tenant_client = Google::Cloud::Talent::TenantService.new(version: :v4beta1)
318
- # formatted_name = Google::Cloud::Talent::V4beta1::TenantServiceClient.tenant_path("[PROJECT]", "[TENANT]")
319
- # response = tenant_client.get_tenant(formatted_name)
320
-
321
- def get_tenant \
322
- name,
323
- options: nil,
324
- &block
325
- req = {
326
- name: name
327
- }.delete_if { |_, v| v.nil? }
328
- req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::GetTenantRequest)
329
- @get_tenant.call(req, options, &block)
330
- end
331
-
332
- # Updates specified tenant.
333
- #
334
- # @param tenant [Google::Cloud::Talent::V4beta1::Tenant | Hash]
335
- # Required. The tenant resource to replace the current resource in the
336
- # system.
337
- # A hash of the same form as `Google::Cloud::Talent::V4beta1::Tenant`
338
- # can also be provided.
339
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
340
- # Strongly recommended for the best service experience.
341
- #
342
- # If
343
- # {Google::Cloud::Talent::V4beta1::UpdateTenantRequest#update_mask update_mask}
344
- # is provided, only the specified fields in
345
- # {Google::Cloud::Talent::V4beta1::UpdateTenantRequest#tenant tenant} are
346
- # updated. Otherwise all the fields are updated.
347
- #
348
- # A field mask to specify the tenant fields to be updated. Only
349
- # top level fields of {Google::Cloud::Talent::V4beta1::Tenant Tenant} are
350
- # supported.
351
- # A hash of the same form as `Google::Protobuf::FieldMask`
352
- # can also be provided.
353
- # @param options [Google::Gax::CallOptions]
354
- # Overrides the default settings for this call, e.g, timeout,
355
- # retries, etc.
356
- # @yield [result, operation] Access the result along with the RPC operation
357
- # @yieldparam result [Google::Cloud::Talent::V4beta1::Tenant]
358
- # @yieldparam operation [GRPC::ActiveCall::Operation]
359
- # @return [Google::Cloud::Talent::V4beta1::Tenant]
360
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
361
- # @example
362
- # require "google/cloud/talent"
363
- #
364
- # tenant_client = Google::Cloud::Talent::TenantService.new(version: :v4beta1)
365
- #
366
- # # TODO: Initialize `tenant`:
367
- # tenant = {}
368
- # response = tenant_client.update_tenant(tenant)
369
-
370
- def update_tenant \
371
- tenant,
372
- update_mask: nil,
373
- options: nil,
374
- &block
375
- req = {
376
- tenant: tenant,
377
- update_mask: update_mask
378
- }.delete_if { |_, v| v.nil? }
379
- req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::UpdateTenantRequest)
380
- @update_tenant.call(req, options, &block)
381
- end
382
-
383
- # Deletes specified tenant.
384
- #
385
- # @param name [String]
386
- # Required. The resource name of the tenant to be deleted.
387
- #
388
- # The format is "projects/{project_id}/tenants/{tenant_id}", for example,
389
- # "projects/foo/tenants/bar".
390
- # @param options [Google::Gax::CallOptions]
391
- # Overrides the default settings for this call, e.g, timeout,
392
- # retries, etc.
393
- # @yield [result, operation] Access the result along with the RPC operation
394
- # @yieldparam result []
395
- # @yieldparam operation [GRPC::ActiveCall::Operation]
396
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
397
- # @example
398
- # require "google/cloud/talent"
399
- #
400
- # tenant_client = Google::Cloud::Talent::TenantService.new(version: :v4beta1)
401
- # formatted_name = Google::Cloud::Talent::V4beta1::TenantServiceClient.tenant_path("[PROJECT]", "[TENANT]")
402
- # tenant_client.delete_tenant(formatted_name)
403
-
404
- def delete_tenant \
405
- name,
406
- options: nil,
407
- &block
408
- req = {
409
- name: name
410
- }.delete_if { |_, v| v.nil? }
411
- req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::DeleteTenantRequest)
412
- @delete_tenant.call(req, options, &block)
413
- nil
414
- end
415
-
416
- # Lists all tenants associated with the project.
417
- #
418
- # @param parent [String]
419
- # Required. Resource name of the project under which the tenant is created.
420
- #
421
- # The format is "projects/{project_id}", for example,
422
- # "projects/foo".
423
- # @param page_size [Integer]
424
- # The maximum number of resources contained in the underlying API
425
- # response. If page streaming is performed per-resource, this
426
- # parameter does not affect the return value. If page streaming is
427
- # performed per-page, this determines the maximum number of
428
- # resources in a page.
429
- # @param options [Google::Gax::CallOptions]
430
- # Overrides the default settings for this call, e.g, timeout,
431
- # retries, etc.
432
- # @yield [result, operation] Access the result along with the RPC operation
433
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::Tenant>]
434
- # @yieldparam operation [GRPC::ActiveCall::Operation]
435
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::Tenant>]
436
- # An enumerable of Google::Cloud::Talent::V4beta1::Tenant instances.
437
- # See Google::Gax::PagedEnumerable documentation for other
438
- # operations such as per-page iteration or access to the response
439
- # object.
440
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
441
- # @example
442
- # require "google/cloud/talent"
443
- #
444
- # tenant_client = Google::Cloud::Talent::TenantService.new(version: :v4beta1)
445
- # formatted_parent = Google::Cloud::Talent::V4beta1::TenantServiceClient.project_path("[PROJECT]")
446
- #
447
- # # Iterate over all results.
448
- # tenant_client.list_tenants(formatted_parent).each do |element|
449
- # # Process element.
450
- # end
451
- #
452
- # # Or iterate over results one page at a time.
453
- # tenant_client.list_tenants(formatted_parent).each_page do |page|
454
- # # Process each page at a time.
455
- # page.each do |element|
456
- # # Process element.
457
- # end
458
- # end
459
-
460
- def list_tenants \
461
- parent,
462
- page_size: nil,
463
- options: nil,
464
- &block
465
- req = {
466
- parent: parent,
467
- page_size: page_size
468
- }.delete_if { |_, v| v.nil? }
469
- req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::ListTenantsRequest)
470
- @list_tenants.call(req, options, &block)
471
- end
472
- end
473
- end
474
- end
475
- end
476
- end