google-cloud-firestore-admin-v1 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,3 +35,6 @@ module Google
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
40
+ require "google/cloud/firestore/admin/v1/_helpers" if ::File.file? helper_path
@@ -62,7 +62,7 @@ module Google
62
62
  parent_config = while namespace.any?
63
63
  parent_name = namespace.join "::"
64
64
  parent_const = const_get parent_name
65
- break parent_const.configure if parent_const&.respond_to? :configure
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
66
  namespace.pop
67
67
  end
68
68
  default_config = Client::Configuration.new parent_config
@@ -72,33 +72,33 @@ module Google
72
72
  default_config.rpcs.list_indexes.timeout = 60.0
73
73
  default_config.rpcs.list_indexes.retry_policy = {
74
74
  initial_delay: 0.1,
75
- max_delay: 60.0,
76
- multiplier: 1.3,
77
- retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
75
+ max_delay: 60.0,
76
+ multiplier: 1.3,
77
+ retry_codes: [14, 13, 4]
78
78
  }
79
79
 
80
80
  default_config.rpcs.get_index.timeout = 60.0
81
81
  default_config.rpcs.get_index.retry_policy = {
82
82
  initial_delay: 0.1,
83
- max_delay: 60.0,
84
- multiplier: 1.3,
85
- retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
83
+ max_delay: 60.0,
84
+ multiplier: 1.3,
85
+ retry_codes: [14, 13, 4]
86
86
  }
87
87
 
88
88
  default_config.rpcs.delete_index.timeout = 60.0
89
89
  default_config.rpcs.delete_index.retry_policy = {
90
90
  initial_delay: 0.1,
91
- max_delay: 60.0,
92
- multiplier: 1.3,
93
- retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
91
+ max_delay: 60.0,
92
+ multiplier: 1.3,
93
+ retry_codes: [14, 13, 4]
94
94
  }
95
95
 
96
96
  default_config.rpcs.get_field.timeout = 60.0
97
97
  default_config.rpcs.get_field.retry_policy = {
98
98
  initial_delay: 0.1,
99
- max_delay: 60.0,
100
- multiplier: 1.3,
101
- retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
99
+ max_delay: 60.0,
100
+ multiplier: 1.3,
101
+ retry_codes: [14, 13, 4]
102
102
  }
103
103
 
104
104
  default_config.rpcs.update_field.timeout = 60.0
@@ -106,9 +106,9 @@ module Google
106
106
  default_config.rpcs.list_fields.timeout = 60.0
107
107
  default_config.rpcs.list_fields.retry_policy = {
108
108
  initial_delay: 0.1,
109
- max_delay: 60.0,
110
- multiplier: 1.3,
111
- retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
109
+ max_delay: 60.0,
110
+ multiplier: 1.3,
111
+ retry_codes: [14, 13, 4]
112
112
  }
113
113
 
114
114
  default_config.rpcs.export_documents.timeout = 60.0
@@ -176,7 +176,13 @@ module Google
176
176
 
177
177
  # Create credentials
178
178
  credentials = @config.credentials
179
- credentials ||= Credentials.default scope: @config.scope
179
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
180
+ # but only if the default endpoint does not have a region prefix.
181
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
182
+ @config.endpoint == Client.configure.endpoint &&
183
+ !@config.endpoint.split(".").first.include?("-")
184
+ credentials ||= Credentials.default scope: @config.scope,
185
+ enable_self_signed_jwt: enable_self_signed_jwt
180
186
  if credentials.is_a?(String) || credentials.is_a?(Hash)
181
187
  credentials = Credentials.new credentials, scope: @config.scope
182
188
  end
@@ -974,14 +980,14 @@ module Google
974
980
 
975
981
  config_attr :endpoint, "firestore.googleapis.com", ::String
976
982
  config_attr :credentials, nil do |value|
977
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
983
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
978
984
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
979
985
  allowed.any? { |klass| klass === value }
980
986
  end
981
987
  config_attr :scope, nil, ::String, ::Array, nil
982
988
  config_attr :lib_name, nil, ::String, nil
983
989
  config_attr :lib_version, nil, ::String, nil
984
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
990
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
985
991
  config_attr :interceptors, nil, ::Array, nil
986
992
  config_attr :timeout, nil, ::Numeric, nil
987
993
  config_attr :metadata, nil, ::Hash, nil
@@ -1002,7 +1008,7 @@ module Google
1002
1008
  def rpcs
1003
1009
  @rpcs ||= begin
1004
1010
  parent_rpcs = nil
1005
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1011
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1006
1012
  Rpcs.new parent_rpcs
1007
1013
  end
1008
1014
  end
@@ -1014,7 +1020,7 @@ module Google
1014
1020
  # Each configuration object is of type `Gapic::Config::Method` and includes
1015
1021
  # the following configuration fields:
1016
1022
  #
1017
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1023
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1018
1024
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1019
1025
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1020
1026
  # include the following keys:
@@ -1073,23 +1079,23 @@ module Google
1073
1079
 
1074
1080
  # @private
1075
1081
  def initialize parent_rpcs = nil
1076
- create_index_config = parent_rpcs&.create_index if parent_rpcs&.respond_to? :create_index
1082
+ create_index_config = parent_rpcs.create_index if parent_rpcs.respond_to? :create_index
1077
1083
  @create_index = ::Gapic::Config::Method.new create_index_config
1078
- list_indexes_config = parent_rpcs&.list_indexes if parent_rpcs&.respond_to? :list_indexes
1084
+ list_indexes_config = parent_rpcs.list_indexes if parent_rpcs.respond_to? :list_indexes
1079
1085
  @list_indexes = ::Gapic::Config::Method.new list_indexes_config
1080
- get_index_config = parent_rpcs&.get_index if parent_rpcs&.respond_to? :get_index
1086
+ get_index_config = parent_rpcs.get_index if parent_rpcs.respond_to? :get_index
1081
1087
  @get_index = ::Gapic::Config::Method.new get_index_config
1082
- delete_index_config = parent_rpcs&.delete_index if parent_rpcs&.respond_to? :delete_index
1088
+ delete_index_config = parent_rpcs.delete_index if parent_rpcs.respond_to? :delete_index
1083
1089
  @delete_index = ::Gapic::Config::Method.new delete_index_config
1084
- get_field_config = parent_rpcs&.get_field if parent_rpcs&.respond_to? :get_field
1090
+ get_field_config = parent_rpcs.get_field if parent_rpcs.respond_to? :get_field
1085
1091
  @get_field = ::Gapic::Config::Method.new get_field_config
1086
- update_field_config = parent_rpcs&.update_field if parent_rpcs&.respond_to? :update_field
1092
+ update_field_config = parent_rpcs.update_field if parent_rpcs.respond_to? :update_field
1087
1093
  @update_field = ::Gapic::Config::Method.new update_field_config
1088
- list_fields_config = parent_rpcs&.list_fields if parent_rpcs&.respond_to? :list_fields
1094
+ list_fields_config = parent_rpcs.list_fields if parent_rpcs.respond_to? :list_fields
1089
1095
  @list_fields = ::Gapic::Config::Method.new list_fields_config
1090
- export_documents_config = parent_rpcs&.export_documents if parent_rpcs&.respond_to? :export_documents
1096
+ export_documents_config = parent_rpcs.export_documents if parent_rpcs.respond_to? :export_documents
1091
1097
  @export_documents = ::Gapic::Config::Method.new export_documents_config
1092
- import_documents_config = parent_rpcs&.import_documents if parent_rpcs&.respond_to? :import_documents
1098
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
1093
1099
  @import_documents = ::Gapic::Config::Method.new import_documents_config
1094
1100
 
1095
1101
  yield self if block_given?
@@ -104,8 +104,13 @@ module Google
104
104
  # Lists operations that match the specified filter in the request. If the
105
105
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
106
106
  #
107
- # NOTE: the `name` binding below allows API services to override the binding
108
- # to use different resource name schemes, such as `users/*/operations`.
107
+ # NOTE: the `name` binding allows API services to override the binding
108
+ # to use different resource name schemes, such as `users/*/operations`. To
109
+ # override the binding, API services can add a binding such as
110
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
111
+ # For backwards compatibility, the default name includes the operations
112
+ # collection id, however overriding users must ensure the name binding
113
+ # is the parent resource, without the operations collection id.
109
114
  #
110
115
  # @overload list_operations(request, options = nil)
111
116
  # Pass arguments to `list_operations` via a request object, either of type
@@ -123,7 +128,7 @@ module Google
123
128
  # the default parameter values, pass an empty Hash as a request object (see above).
124
129
  #
125
130
  # @param name [::String]
126
- # The name of the operation collection.
131
+ # The name of the operation's parent resource.
127
132
  # @param filter [::String]
128
133
  # The standard list filter.
129
134
  # @param page_size [::Integer]
@@ -391,6 +396,79 @@ module Google
391
396
  raise ::Google::Cloud::Error.from_error(e)
392
397
  end
393
398
 
399
+ ##
400
+ # Waits for the specified long-running operation until it is done or reaches
401
+ # at most a specified timeout, returning the latest state. If the operation
402
+ # is already done, the latest state is immediately returned. If the timeout
403
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
404
+ # timeout is used. If the server does not support this method, it returns
405
+ # `google.rpc.Code.UNIMPLEMENTED`.
406
+ # Note that this method is on a best-effort basis. It may return the latest
407
+ # state before the specified timeout (including immediately), meaning even an
408
+ # immediate response is no guarantee that the operation is done.
409
+ #
410
+ # @overload wait_operation(request, options = nil)
411
+ # Pass arguments to `wait_operation` via a request object, either of type
412
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
419
+ #
420
+ # @overload wait_operation(name: nil, timeout: nil)
421
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param name [::String]
426
+ # The name of the operation resource to wait on.
427
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
428
+ # The maximum duration to wait before timing out. If left blank, the wait
429
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
430
+ # If RPC context deadline is also specified, the shorter one will be used.
431
+ #
432
+ # @yield [response, operation] Access the result along with the RPC operation
433
+ # @yieldparam response [::Gapic::Operation]
434
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
435
+ #
436
+ # @return [::Gapic::Operation]
437
+ #
438
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
439
+ #
440
+ def wait_operation request, options = nil
441
+ raise ::ArgumentError, "request must be provided" if request.nil?
442
+
443
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
444
+
445
+ # Converts hash and nil to an options object
446
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
447
+
448
+ # Customize the options with defaults
449
+ metadata = @config.rpcs.wait_operation.metadata.to_h
450
+
451
+ # Set x-goog-api-client and x-goog-user-project headers
452
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
453
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
454
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
455
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
458
+ metadata: metadata,
459
+ retry_policy: @config.rpcs.wait_operation.retry_policy
460
+ options.apply_defaults metadata: @config.metadata,
461
+ retry_policy: @config.retry_policy
462
+
463
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
464
+ response = ::Gapic::Operation.new response, @operations_client, options: options
465
+ yield response, operation if block_given?
466
+ return response
467
+ end
468
+ rescue ::GRPC::BadStatus => e
469
+ raise ::Google::Cloud::Error.from_error(e)
470
+ end
471
+
394
472
  ##
395
473
  # Configuration class for the Operations API.
396
474
  #
@@ -476,14 +554,14 @@ module Google
476
554
 
477
555
  config_attr :endpoint, "firestore.googleapis.com", ::String
478
556
  config_attr :credentials, nil do |value|
479
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
557
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
480
558
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
481
559
  allowed.any? { |klass| klass === value }
482
560
  end
483
561
  config_attr :scope, nil, ::String, ::Array, nil
484
562
  config_attr :lib_name, nil, ::String, nil
485
563
  config_attr :lib_version, nil, ::String, nil
486
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
564
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
487
565
  config_attr :interceptors, nil, ::Array, nil
488
566
  config_attr :timeout, nil, ::Numeric, nil
489
567
  config_attr :metadata, nil, ::Hash, nil
@@ -504,7 +582,7 @@ module Google
504
582
  def rpcs
505
583
  @rpcs ||= begin
506
584
  parent_rpcs = nil
507
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
585
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
508
586
  Rpcs.new parent_rpcs
509
587
  end
510
588
  end
@@ -516,7 +594,7 @@ module Google
516
594
  # Each configuration object is of type `Gapic::Config::Method` and includes
517
595
  # the following configuration fields:
518
596
  #
519
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
597
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
520
598
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
521
599
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
522
600
  # include the following keys:
@@ -547,17 +625,24 @@ module Google
547
625
  # @return [::Gapic::Config::Method]
548
626
  #
549
627
  attr_reader :cancel_operation
628
+ ##
629
+ # RPC-specific configuration for `wait_operation`
630
+ # @return [::Gapic::Config::Method]
631
+ #
632
+ attr_reader :wait_operation
550
633
 
551
634
  # @private
552
635
  def initialize parent_rpcs = nil
553
- list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
636
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
554
637
  @list_operations = ::Gapic::Config::Method.new list_operations_config
555
- get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
638
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
556
639
  @get_operation = ::Gapic::Config::Method.new get_operation_config
557
- delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
640
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
558
641
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
559
- cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
642
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
560
643
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
644
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
645
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
561
646
 
562
647
  yield self if block_given?
563
648
  end
@@ -22,7 +22,7 @@ module Google
22
22
  module Firestore
23
23
  module Admin
24
24
  module V1
25
- VERSION = "0.1.0"
25
+ VERSION = "0.3.0"
26
26
  end
27
27
  end
28
28
  end
@@ -39,15 +39,15 @@ module Google
39
39
  # Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation]
40
40
  # which may be used to track the status of the creation. The metadata for
41
41
  # the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
42
- rpc :CreateIndex, Google::Cloud::Firestore::Admin::V1::CreateIndexRequest, Google::Longrunning::Operation
42
+ rpc :CreateIndex, ::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest, ::Google::Longrunning::Operation
43
43
  # Lists composite indexes.
44
- rpc :ListIndexes, Google::Cloud::Firestore::Admin::V1::ListIndexesRequest, Google::Cloud::Firestore::Admin::V1::ListIndexesResponse
44
+ rpc :ListIndexes, ::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest, ::Google::Cloud::Firestore::Admin::V1::ListIndexesResponse
45
45
  # Gets a composite index.
46
- rpc :GetIndex, Google::Cloud::Firestore::Admin::V1::GetIndexRequest, Google::Cloud::Firestore::Admin::V1::Index
46
+ rpc :GetIndex, ::Google::Cloud::Firestore::Admin::V1::GetIndexRequest, ::Google::Cloud::Firestore::Admin::V1::Index
47
47
  # Deletes a composite index.
48
- rpc :DeleteIndex, Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest, Google::Protobuf::Empty
48
+ rpc :DeleteIndex, ::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest, ::Google::Protobuf::Empty
49
49
  # Gets the metadata and configuration for a Field.
50
- rpc :GetField, Google::Cloud::Firestore::Admin::V1::GetFieldRequest, Google::Cloud::Firestore::Admin::V1::Field
50
+ rpc :GetField, ::Google::Cloud::Firestore::Admin::V1::GetFieldRequest, ::Google::Cloud::Firestore::Admin::V1::Field
51
51
  # Updates a field configuration. Currently, field updates apply only to
52
52
  # single field index configuration. However, calls to
53
53
  # [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should provide a field mask to avoid
@@ -61,14 +61,14 @@ module Google
61
61
  # To configure the default field settings for the database, use
62
62
  # the special `Field` with resource name:
63
63
  # `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
64
- rpc :UpdateField, Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest, Google::Longrunning::Operation
64
+ rpc :UpdateField, ::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest, ::Google::Longrunning::Operation
65
65
  # Lists the field configuration and metadata for this database.
66
66
  #
67
67
  # Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields
68
68
  # that have been explicitly overridden. To issue this query, call
69
69
  # [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the filter set to
70
70
  # `indexConfig.usesAncestorConfig:false`.
71
- rpc :ListFields, Google::Cloud::Firestore::Admin::V1::ListFieldsRequest, Google::Cloud::Firestore::Admin::V1::ListFieldsResponse
71
+ rpc :ListFields, ::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest, ::Google::Cloud::Firestore::Admin::V1::ListFieldsResponse
72
72
  # Exports a copy of all or a subset of documents from Google Cloud Firestore
73
73
  # to another storage system, such as Google Cloud Storage. Recent updates to
74
74
  # documents may not be reflected in the export. The export occurs in the
@@ -77,13 +77,13 @@ module Google
77
77
  # used once the associated operation is done. If an export operation is
78
78
  # cancelled before completion it may leave partial data behind in Google
79
79
  # Cloud Storage.
80
- rpc :ExportDocuments, Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest, Google::Longrunning::Operation
80
+ rpc :ExportDocuments, ::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest, ::Google::Longrunning::Operation
81
81
  # Imports documents into Google Cloud Firestore. Existing documents with the
82
82
  # same name are overwritten. The import occurs in the background and its
83
83
  # progress can be monitored and managed via the Operation resource that is
84
84
  # created. If an ImportDocuments operation is cancelled, it is possible
85
85
  # that a subset of the data has already been imported to Cloud Firestore.
86
- rpc :ImportDocuments, Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest, Google::Longrunning::Operation
86
+ rpc :ImportDocuments, ::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest, ::Google::Longrunning::Operation
87
87
  end
88
88
 
89
89
  Stub = Service.rpc_stub_class
@@ -54,6 +54,12 @@ module Google
54
54
  # This indicates that the field may be set once in a request to create a
55
55
  # resource, but may not be changed thereafter.
56
56
  IMMUTABLE = 5
57
+
58
+ # Denotes that a (repeated) field is an unordered list.
59
+ # This indicates that the service may provide the elements of the list
60
+ # in any arbitrary order, rather than the order the user originally
61
+ # provided. Additionally, the list's order may or may not be stable.
62
+ UNORDERED_LIST = 6
57
63
  end
58
64
  end
59
65
  end
@@ -43,12 +43,12 @@ module Google
43
43
  #
44
44
  # The ResourceDescriptor Yaml config will look like:
45
45
  #
46
- # resources:
47
- # - type: "pubsub.googleapis.com/Topic"
48
- # name_descriptor:
49
- # - pattern: "projects/\\{project}/topics/\\{topic}"
50
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
- # parent_name_extractor: "projects/\\{project}"
46
+ # resources:
47
+ # - type: "pubsub.googleapis.com/Topic"
48
+ # name_descriptor:
49
+ # - pattern: "projects/{project}/topics/{topic}"
50
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
+ # parent_name_extractor: "projects/{project}"
52
52
  #
53
53
  # Sometimes, resources have multiple patterns, typically because they can
54
54
  # live under multiple parents.
@@ -183,15 +183,24 @@ module Google
183
183
  # }
184
184
  # @!attribute [rw] plural
185
185
  # @return [::String]
186
- # The plural name used in the resource name, such as 'projects' for
187
- # the name of 'projects/\\{project}'. It is the same concept of the `plural`
188
- # field in k8s CRD spec
186
+ # The plural name used in the resource name and permission names, such as
187
+ # 'projects' for the resource name of 'projects/\\{project}' and the permission
188
+ # name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same
189
+ # concept of the `plural` field in k8s CRD spec
189
190
  # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
191
+ #
192
+ # Note: The plural form is required even for singleton resources. See
193
+ # https://aip.dev/156
190
194
  # @!attribute [rw] singular
191
195
  # @return [::String]
192
196
  # The same concept of the `singular` field in k8s CRD spec
193
197
  # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
194
198
  # Such as "project" for the `resourcemanager.googleapis.com/Project` type.
199
+ # @!attribute [rw] style
200
+ # @return [::Array<::Google::Api::ResourceDescriptor::Style>]
201
+ # Style flag(s) for this resource.
202
+ # These indicate that a resource is expected to conform to a given
203
+ # style. See the specific style flags for additional information.
195
204
  class ResourceDescriptor
196
205
  include ::Google::Protobuf::MessageExts
197
206
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -211,6 +220,22 @@ module Google
211
220
  # that from being necessary once there are multiple patterns.)
212
221
  FUTURE_MULTI_PATTERN = 2
213
222
  end
223
+
224
+ # A flag representing a specific style that a resource claims to conform to.
225
+ module Style
226
+ # The unspecified value. Do not use.
227
+ STYLE_UNSPECIFIED = 0
228
+
229
+ # This resource is intended to be "declarative-friendly".
230
+ #
231
+ # Declarative-friendly resources must be more strictly consistent, and
232
+ # setting this to true communicates to tools that this resource should
233
+ # adhere to declarative-friendly expectations.
234
+ #
235
+ # Note: This is used by the API linter (linter.aip.dev) to enable
236
+ # additional checks.
237
+ DECLARATIVE_FRIENDLY = 1
238
+ end
214
239
  end
215
240
 
216
241
  # Defines a proto annotation that describes a string field that refers to
@@ -226,6 +251,17 @@ module Google
226
251
  # type: "pubsub.googleapis.com/Topic"
227
252
  # }];
228
253
  # }
254
+ #
255
+ # Occasionally, a field may reference an arbitrary resource. In this case,
256
+ # APIs use the special value * in their resource reference.
257
+ #
258
+ # Example:
259
+ #
260
+ # message GetIamPolicyRequest {
261
+ # string resource = 2 [(google.api.resource_reference) = {
262
+ # type: "*"
263
+ # }];
264
+ # }
229
265
  # @!attribute [rw] child_type
230
266
  # @return [::String]
231
267
  # The resource type of a child collection that the annotated field
@@ -234,11 +270,11 @@ module Google
234
270
  #
235
271
  # Example:
236
272
  #
237
- # message ListLogEntriesRequest {
238
- # string parent = 1 [(google.api.resource_reference) = {
239
- # child_type: "logging.googleapis.com/LogEntry"
240
- # };
241
- # }
273
+ # message ListLogEntriesRequest {
274
+ # string parent = 1 [(google.api.resource_reference) = {
275
+ # child_type: "logging.googleapis.com/LogEntry"
276
+ # };
277
+ # }
242
278
  class ResourceReference
243
279
  include ::Google::Protobuf::MessageExts
244
280
  extend ::Google::Protobuf::MessageExts::ClassMethods