google-cloud-logging-v2 0.1.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 434f3b91aec0a344969432dfd5704878d96ece163906d13d0271da9bf8983de1
4
- data.tar.gz: 51a7da222186ef14da93574e46bfa03c21281117b6b57c4510b4f16f46320e2f
3
+ metadata.gz: e216376c818044085c0458bd8c566405dbec48867d6f2611a46e66a27f40d392
4
+ data.tar.gz: 5c5755cb11fe32a7e951f5e8e32fc3f3e24857631b00d568862f54f94d89553c
5
5
  SHA512:
6
- metadata.gz: e05d1af6b9631aca0b14b2f6fe1eab219f432162014276de6c1103b5e8bc9909f260691c286fccdf56fa3c41bc999e6d02557265b95e6534ac1beca6b55038cb
7
- data.tar.gz: ccfb0e3f15c416296030904bc9cff50cc71dd80406c5a61b38e0defbf72789cede3aada8946cbcc67b71d7b44fbc3017678e2d56c29bbefb8f75b456569d5b62
6
+ metadata.gz: 7e09aaf05aec87edd72de4e3d7e864d80738da5a9fd7e6d6fa6536262a333446a983888697f488875e071c85243268faeca6b407ae7c066aed2fadd3690e19d8
7
+ data.tar.gz: e23702e99761b2e99dcad73869bbebcf7245d8931a9582d9482ac8e68ef5cde900e38e82ede882fbcd637b7b7bb452bdcf64d05e4976a36e22aef154650dc8f2
data/README.md CHANGED
@@ -6,6 +6,12 @@ The Cloud Logging API lets you programmatically read and write log entries, set
6
6
 
7
7
  https://github.com/googleapis/google-cloud-ruby
8
8
 
9
+ This gem is a _versioned_ client. It provides basic client classes for a
10
+ specific version of the Cloud Logging V2 API. Most users should consider using
11
+ the main client gem,
12
+ [google-cloud-logging](https://rubygems.org/gems/google-cloud-logging).
13
+ See the section below titled *Which client should I use?* for more information.
14
+
9
15
  ## Installation
10
16
 
11
17
  ```
@@ -73,3 +79,61 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
73
79
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
74
80
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
75
81
  about the Ruby support schedule.
82
+
83
+ ## Which client should I use?
84
+
85
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
86
+ client library with a name such as `google-cloud-logging`,
87
+ and lower-level _versioned_ client libraries with names such as
88
+ `google-cloud-logging-v2`.
89
+ _In most cases, you should install the main client._
90
+
91
+ ### What's the difference between the main client and a versioned client?
92
+
93
+ A _versioned client_ provides a basic set of data types and client classes for
94
+ a _single version_ of a specific service. (That is, for a service with multiple
95
+ versions, there might be a separate versioned client for each service version.)
96
+ Most versioned clients are written and maintained by a code generator.
97
+
98
+ The _main client_ is designed to provide you with the _recommended_ client
99
+ interfaces for the service. There will be only one main client for any given
100
+ service, even a service with multiple versions. The main client includes
101
+ factory methods for constructing the client objects we recommend for most
102
+ users. In some cases, those will be classes provided by an underlying versioned
103
+ client; in other cases, they will be handwritten higher-level client objects
104
+ with additional capabilities, convenience methods, or best practices built in.
105
+ Generally, the main client will default to a recommended service version,
106
+ although in some cases you can override this if you need to talk to a specific
107
+ service version.
108
+
109
+ ### Why would I want to use the main client?
110
+
111
+ We recommend that most users install the main client gem for a service. You can
112
+ identify this gem as the one _without_ a version in its name, e.g.
113
+ `google-cloud-logging`.
114
+ The main client is recommended because it will embody the best practices for
115
+ accessing the service, and may also provide more convenient interfaces or
116
+ tighter integration into frameworks and third-party libraries. In addition, the
117
+ documentation and samples published by Google will generally demonstrate use of
118
+ the main client.
119
+
120
+ ### Why would I want to use a versioned client?
121
+
122
+ You can use a versioned client if you are content with a possibly lower-level
123
+ class interface, you explicitly want to avoid features provided by the main
124
+ client, or you want to access a specific service version not be covered by the
125
+ main client. You can identify versioned client gems because the service version
126
+ is part of the name, e.g. `google-cloud-logging-v2`.
127
+
128
+ ### What about the google-apis-<name> clients?
129
+
130
+ Client library gems with names that begin with `google-apis-` are based on an
131
+ older code generation technology. They talk to a REST/JSON backend (whereas
132
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
133
+ not offer the same performance, features, and ease of use provided by more
134
+ modern clients.
135
+
136
+ The `google-apis-` clients have wide coverage across Google services, so you
137
+ might need to use one if there is no modern client available for the service.
138
+ However, if a modern client is available, we generally recommend it over the
139
+ older `google-apis-` clients.
@@ -35,3 +35,6 @@ module Google
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ helper_path = ::File.join __dir__, "v2", "_helpers.rb"
40
+ require "google/cloud/logging/v2/_helpers" if ::File.file? helper_path
@@ -188,7 +188,13 @@ module Google
188
188
 
189
189
  # Create credentials
190
190
  credentials = @config.credentials
191
- credentials ||= Credentials.default scope: @config.scope
191
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
192
+ # but only if the default endpoint does not have a region prefix.
193
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
194
+ @config.endpoint == Client.configure.endpoint &&
195
+ !@config.endpoint.split(".").first.include?("-")
196
+ credentials ||= Credentials.default scope: @config.scope,
197
+ enable_self_signed_jwt: enable_self_signed_jwt
192
198
  if credentials.is_a?(String) || credentials.is_a?(Hash)
193
199
  credentials = Credentials.new credentials, scope: @config.scope
194
200
  end
@@ -207,7 +213,7 @@ module Google
207
213
  # Service calls
208
214
 
209
215
  ##
210
- # Lists buckets (Beta).
216
+ # Lists buckets.
211
217
  #
212
218
  # @overload list_buckets(request, options = nil)
213
219
  # Pass arguments to `list_buckets` via a request object, either of type
@@ -292,7 +298,7 @@ module Google
292
298
  end
293
299
 
294
300
  ##
295
- # Gets a bucket (Beta).
301
+ # Gets a bucket.
296
302
  #
297
303
  # @overload get_bucket(request, options = nil)
298
304
  # Pass arguments to `get_bucket` via a request object, either of type
@@ -365,6 +371,85 @@ module Google
365
371
  raise ::Google::Cloud::Error.from_error(e)
366
372
  end
367
373
 
374
+ ##
375
+ # Creates a bucket that can be used to store log entries. Once a bucket has
376
+ # been created, the region cannot be changed.
377
+ #
378
+ # @overload create_bucket(request, options = nil)
379
+ # Pass arguments to `create_bucket` via a request object, either of type
380
+ # {::Google::Cloud::Logging::V2::CreateBucketRequest} or an equivalent Hash.
381
+ #
382
+ # @param request [::Google::Cloud::Logging::V2::CreateBucketRequest, ::Hash]
383
+ # A request object representing the call parameters. Required. To specify no
384
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
385
+ # @param options [::Gapic::CallOptions, ::Hash]
386
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
387
+ #
388
+ # @overload create_bucket(parent: nil, bucket_id: nil, bucket: nil)
389
+ # Pass arguments to `create_bucket` via keyword arguments. Note that at
390
+ # least one keyword argument is required. To specify no parameters, or to keep all
391
+ # the default parameter values, pass an empty Hash as a request object (see above).
392
+ #
393
+ # @param parent [::String]
394
+ # Required. The resource in which to create the bucket:
395
+ #
396
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
397
+ #
398
+ # Example: `"projects/my-logging-project/locations/global"`
399
+ # @param bucket_id [::String]
400
+ # Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are
401
+ # limited to 100 characters and can include only letters, digits,
402
+ # underscores, hyphens, and periods.
403
+ # @param bucket [::Google::Cloud::Logging::V2::LogBucket, ::Hash]
404
+ # Required. The new bucket. The region specified in the new bucket must be compliant
405
+ # with any Location Restriction Org Policy. The name field in the bucket is
406
+ # ignored.
407
+ #
408
+ # @yield [response, operation] Access the result along with the RPC operation
409
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogBucket]
410
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
411
+ #
412
+ # @return [::Google::Cloud::Logging::V2::LogBucket]
413
+ #
414
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
415
+ #
416
+ def create_bucket request, options = nil
417
+ raise ::ArgumentError, "request must be provided" if request.nil?
418
+
419
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateBucketRequest
420
+
421
+ # Converts hash and nil to an options object
422
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
423
+
424
+ # Customize the options with defaults
425
+ metadata = @config.rpcs.create_bucket.metadata.to_h
426
+
427
+ # Set x-goog-api-client and x-goog-user-project headers
428
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
429
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
430
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
431
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
432
+
433
+ header_params = {
434
+ "parent" => request.parent
435
+ }
436
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
437
+ metadata[:"x-goog-request-params"] ||= request_params_header
438
+
439
+ options.apply_defaults timeout: @config.rpcs.create_bucket.timeout,
440
+ metadata: metadata,
441
+ retry_policy: @config.rpcs.create_bucket.retry_policy
442
+ options.apply_defaults metadata: @config.metadata,
443
+ retry_policy: @config.retry_policy
444
+
445
+ @config_service_stub.call_rpc :create_bucket, request, options: options do |response, operation|
446
+ yield response, operation if block_given?
447
+ return response
448
+ end
449
+ rescue ::GRPC::BadStatus => e
450
+ raise ::Google::Cloud::Error.from_error(e)
451
+ end
452
+
368
453
  ##
369
454
  # Updates a bucket. This method replaces the following fields in the
370
455
  # existing bucket with values from the new bucket: `retention_period`
@@ -376,7 +461,6 @@ module Google
376
461
  # will be returned.
377
462
  #
378
463
  # A buckets region may not be modified after it is created.
379
- # This method is in Beta.
380
464
  #
381
465
  # @overload update_bucket(request, options = nil)
382
466
  # Pass arguments to `update_bucket` via a request object, either of type
@@ -462,6 +546,537 @@ module Google
462
546
  raise ::Google::Cloud::Error.from_error(e)
463
547
  end
464
548
 
549
+ ##
550
+ # Deletes a bucket.
551
+ # Moves the bucket to the DELETE_REQUESTED state. After 7 days, the
552
+ # bucket will be purged and all logs in the bucket will be permanently
553
+ # deleted.
554
+ #
555
+ # @overload delete_bucket(request, options = nil)
556
+ # Pass arguments to `delete_bucket` via a request object, either of type
557
+ # {::Google::Cloud::Logging::V2::DeleteBucketRequest} or an equivalent Hash.
558
+ #
559
+ # @param request [::Google::Cloud::Logging::V2::DeleteBucketRequest, ::Hash]
560
+ # A request object representing the call parameters. Required. To specify no
561
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
562
+ # @param options [::Gapic::CallOptions, ::Hash]
563
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
564
+ #
565
+ # @overload delete_bucket(name: nil)
566
+ # Pass arguments to `delete_bucket` via keyword arguments. Note that at
567
+ # least one keyword argument is required. To specify no parameters, or to keep all
568
+ # the default parameter values, pass an empty Hash as a request object (see above).
569
+ #
570
+ # @param name [::String]
571
+ # Required. The full resource name of the bucket to delete.
572
+ #
573
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
574
+ # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
575
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
576
+ # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
577
+ #
578
+ # Example:
579
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`.
580
+ #
581
+ # @yield [response, operation] Access the result along with the RPC operation
582
+ # @yieldparam response [::Google::Protobuf::Empty]
583
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
584
+ #
585
+ # @return [::Google::Protobuf::Empty]
586
+ #
587
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
588
+ #
589
+ def delete_bucket request, options = nil
590
+ raise ::ArgumentError, "request must be provided" if request.nil?
591
+
592
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteBucketRequest
593
+
594
+ # Converts hash and nil to an options object
595
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
596
+
597
+ # Customize the options with defaults
598
+ metadata = @config.rpcs.delete_bucket.metadata.to_h
599
+
600
+ # Set x-goog-api-client and x-goog-user-project headers
601
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
602
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
603
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
604
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
605
+
606
+ header_params = {
607
+ "name" => request.name
608
+ }
609
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
610
+ metadata[:"x-goog-request-params"] ||= request_params_header
611
+
612
+ options.apply_defaults timeout: @config.rpcs.delete_bucket.timeout,
613
+ metadata: metadata,
614
+ retry_policy: @config.rpcs.delete_bucket.retry_policy
615
+ options.apply_defaults metadata: @config.metadata,
616
+ retry_policy: @config.retry_policy
617
+
618
+ @config_service_stub.call_rpc :delete_bucket, request, options: options do |response, operation|
619
+ yield response, operation if block_given?
620
+ return response
621
+ end
622
+ rescue ::GRPC::BadStatus => e
623
+ raise ::Google::Cloud::Error.from_error(e)
624
+ end
625
+
626
+ ##
627
+ # Undeletes a bucket. A bucket that has been deleted may be undeleted within
628
+ # the grace period of 7 days.
629
+ #
630
+ # @overload undelete_bucket(request, options = nil)
631
+ # Pass arguments to `undelete_bucket` via a request object, either of type
632
+ # {::Google::Cloud::Logging::V2::UndeleteBucketRequest} or an equivalent Hash.
633
+ #
634
+ # @param request [::Google::Cloud::Logging::V2::UndeleteBucketRequest, ::Hash]
635
+ # A request object representing the call parameters. Required. To specify no
636
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
637
+ # @param options [::Gapic::CallOptions, ::Hash]
638
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
639
+ #
640
+ # @overload undelete_bucket(name: nil)
641
+ # Pass arguments to `undelete_bucket` via keyword arguments. Note that at
642
+ # least one keyword argument is required. To specify no parameters, or to keep all
643
+ # the default parameter values, pass an empty Hash as a request object (see above).
644
+ #
645
+ # @param name [::String]
646
+ # Required. The full resource name of the bucket to undelete.
647
+ #
648
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
649
+ # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
650
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
651
+ # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
652
+ #
653
+ # Example:
654
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`.
655
+ #
656
+ # @yield [response, operation] Access the result along with the RPC operation
657
+ # @yieldparam response [::Google::Protobuf::Empty]
658
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
659
+ #
660
+ # @return [::Google::Protobuf::Empty]
661
+ #
662
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
663
+ #
664
+ def undelete_bucket request, options = nil
665
+ raise ::ArgumentError, "request must be provided" if request.nil?
666
+
667
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UndeleteBucketRequest
668
+
669
+ # Converts hash and nil to an options object
670
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
671
+
672
+ # Customize the options with defaults
673
+ metadata = @config.rpcs.undelete_bucket.metadata.to_h
674
+
675
+ # Set x-goog-api-client and x-goog-user-project headers
676
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
677
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
678
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
679
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
680
+
681
+ header_params = {
682
+ "name" => request.name
683
+ }
684
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
685
+ metadata[:"x-goog-request-params"] ||= request_params_header
686
+
687
+ options.apply_defaults timeout: @config.rpcs.undelete_bucket.timeout,
688
+ metadata: metadata,
689
+ retry_policy: @config.rpcs.undelete_bucket.retry_policy
690
+ options.apply_defaults metadata: @config.metadata,
691
+ retry_policy: @config.retry_policy
692
+
693
+ @config_service_stub.call_rpc :undelete_bucket, request, options: options do |response, operation|
694
+ yield response, operation if block_given?
695
+ return response
696
+ end
697
+ rescue ::GRPC::BadStatus => e
698
+ raise ::Google::Cloud::Error.from_error(e)
699
+ end
700
+
701
+ ##
702
+ # Lists views on a bucket.
703
+ #
704
+ # @overload list_views(request, options = nil)
705
+ # Pass arguments to `list_views` via a request object, either of type
706
+ # {::Google::Cloud::Logging::V2::ListViewsRequest} or an equivalent Hash.
707
+ #
708
+ # @param request [::Google::Cloud::Logging::V2::ListViewsRequest, ::Hash]
709
+ # A request object representing the call parameters. Required. To specify no
710
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
711
+ # @param options [::Gapic::CallOptions, ::Hash]
712
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
713
+ #
714
+ # @overload list_views(parent: nil, page_token: nil, page_size: nil)
715
+ # Pass arguments to `list_views` via keyword arguments. Note that at
716
+ # least one keyword argument is required. To specify no parameters, or to keep all
717
+ # the default parameter values, pass an empty Hash as a request object (see above).
718
+ #
719
+ # @param parent [::String]
720
+ # Required. The bucket whose views are to be listed:
721
+ #
722
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
723
+ # @param page_token [::String]
724
+ # Optional. If present, then retrieve the next batch of results from the
725
+ # preceding call to this method. `pageToken` must be the value of
726
+ # `nextPageToken` from the previous response. The values of other method
727
+ # parameters should be identical to those in the previous call.
728
+ # @param page_size [::Integer]
729
+ # Optional. The maximum number of results to return from this request.
730
+ # Non-positive values are ignored. The presence of `nextPageToken` in the
731
+ # response indicates that more results might be available.
732
+ #
733
+ # @yield [response, operation] Access the result along with the RPC operation
734
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogView>]
735
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
736
+ #
737
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogView>]
738
+ #
739
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
740
+ #
741
+ def list_views request, options = nil
742
+ raise ::ArgumentError, "request must be provided" if request.nil?
743
+
744
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListViewsRequest
745
+
746
+ # Converts hash and nil to an options object
747
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
748
+
749
+ # Customize the options with defaults
750
+ metadata = @config.rpcs.list_views.metadata.to_h
751
+
752
+ # Set x-goog-api-client and x-goog-user-project headers
753
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
754
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
755
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
756
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
757
+
758
+ header_params = {
759
+ "parent" => request.parent
760
+ }
761
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
762
+ metadata[:"x-goog-request-params"] ||= request_params_header
763
+
764
+ options.apply_defaults timeout: @config.rpcs.list_views.timeout,
765
+ metadata: metadata,
766
+ retry_policy: @config.rpcs.list_views.retry_policy
767
+ options.apply_defaults metadata: @config.metadata,
768
+ retry_policy: @config.retry_policy
769
+
770
+ @config_service_stub.call_rpc :list_views, request, options: options do |response, operation|
771
+ response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_views, request, response, operation, options
772
+ yield response, operation if block_given?
773
+ return response
774
+ end
775
+ rescue ::GRPC::BadStatus => e
776
+ raise ::Google::Cloud::Error.from_error(e)
777
+ end
778
+
779
+ ##
780
+ # Gets a view.
781
+ #
782
+ # @overload get_view(request, options = nil)
783
+ # Pass arguments to `get_view` via a request object, either of type
784
+ # {::Google::Cloud::Logging::V2::GetViewRequest} or an equivalent Hash.
785
+ #
786
+ # @param request [::Google::Cloud::Logging::V2::GetViewRequest, ::Hash]
787
+ # A request object representing the call parameters. Required. To specify no
788
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
789
+ # @param options [::Gapic::CallOptions, ::Hash]
790
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
791
+ #
792
+ # @overload get_view(name: nil)
793
+ # Pass arguments to `get_view` via keyword arguments. Note that at
794
+ # least one keyword argument is required. To specify no parameters, or to keep all
795
+ # the default parameter values, pass an empty Hash as a request object (see above).
796
+ #
797
+ # @param name [::String]
798
+ # Required. The resource name of the policy:
799
+ #
800
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
801
+ #
802
+ # Example:
803
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"`.
804
+ #
805
+ # @yield [response, operation] Access the result along with the RPC operation
806
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogView]
807
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
808
+ #
809
+ # @return [::Google::Cloud::Logging::V2::LogView]
810
+ #
811
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
812
+ #
813
+ def get_view request, options = nil
814
+ raise ::ArgumentError, "request must be provided" if request.nil?
815
+
816
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetViewRequest
817
+
818
+ # Converts hash and nil to an options object
819
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
820
+
821
+ # Customize the options with defaults
822
+ metadata = @config.rpcs.get_view.metadata.to_h
823
+
824
+ # Set x-goog-api-client and x-goog-user-project headers
825
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
826
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
827
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
828
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
829
+
830
+ header_params = {
831
+ "name" => request.name
832
+ }
833
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
834
+ metadata[:"x-goog-request-params"] ||= request_params_header
835
+
836
+ options.apply_defaults timeout: @config.rpcs.get_view.timeout,
837
+ metadata: metadata,
838
+ retry_policy: @config.rpcs.get_view.retry_policy
839
+ options.apply_defaults metadata: @config.metadata,
840
+ retry_policy: @config.retry_policy
841
+
842
+ @config_service_stub.call_rpc :get_view, request, options: options do |response, operation|
843
+ yield response, operation if block_given?
844
+ return response
845
+ end
846
+ rescue ::GRPC::BadStatus => e
847
+ raise ::Google::Cloud::Error.from_error(e)
848
+ end
849
+
850
+ ##
851
+ # Creates a view over logs in a bucket. A bucket may contain a maximum of
852
+ # 50 views.
853
+ #
854
+ # @overload create_view(request, options = nil)
855
+ # Pass arguments to `create_view` via a request object, either of type
856
+ # {::Google::Cloud::Logging::V2::CreateViewRequest} or an equivalent Hash.
857
+ #
858
+ # @param request [::Google::Cloud::Logging::V2::CreateViewRequest, ::Hash]
859
+ # A request object representing the call parameters. Required. To specify no
860
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
861
+ # @param options [::Gapic::CallOptions, ::Hash]
862
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
863
+ #
864
+ # @overload create_view(parent: nil, view_id: nil, view: nil)
865
+ # Pass arguments to `create_view` via keyword arguments. Note that at
866
+ # least one keyword argument is required. To specify no parameters, or to keep all
867
+ # the default parameter values, pass an empty Hash as a request object (see above).
868
+ #
869
+ # @param parent [::String]
870
+ # Required. The bucket in which to create the view
871
+ #
872
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
873
+ #
874
+ # Example:
875
+ # `"projects/my-logging-project/locations/my-location/buckets/my-bucket"`
876
+ # @param view_id [::String]
877
+ # Required. The id to use for this view.
878
+ # @param view [::Google::Cloud::Logging::V2::LogView, ::Hash]
879
+ # Required. The new view.
880
+ #
881
+ # @yield [response, operation] Access the result along with the RPC operation
882
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogView]
883
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
884
+ #
885
+ # @return [::Google::Cloud::Logging::V2::LogView]
886
+ #
887
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
888
+ #
889
+ def create_view request, options = nil
890
+ raise ::ArgumentError, "request must be provided" if request.nil?
891
+
892
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateViewRequest
893
+
894
+ # Converts hash and nil to an options object
895
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
896
+
897
+ # Customize the options with defaults
898
+ metadata = @config.rpcs.create_view.metadata.to_h
899
+
900
+ # Set x-goog-api-client and x-goog-user-project headers
901
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
902
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
903
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
904
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
905
+
906
+ header_params = {
907
+ "parent" => request.parent
908
+ }
909
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
910
+ metadata[:"x-goog-request-params"] ||= request_params_header
911
+
912
+ options.apply_defaults timeout: @config.rpcs.create_view.timeout,
913
+ metadata: metadata,
914
+ retry_policy: @config.rpcs.create_view.retry_policy
915
+ options.apply_defaults metadata: @config.metadata,
916
+ retry_policy: @config.retry_policy
917
+
918
+ @config_service_stub.call_rpc :create_view, request, options: options do |response, operation|
919
+ yield response, operation if block_given?
920
+ return response
921
+ end
922
+ rescue ::GRPC::BadStatus => e
923
+ raise ::Google::Cloud::Error.from_error(e)
924
+ end
925
+
926
+ ##
927
+ # Updates a view. This method replaces the following fields in the existing
928
+ # view with values from the new view: `filter`.
929
+ #
930
+ # @overload update_view(request, options = nil)
931
+ # Pass arguments to `update_view` via a request object, either of type
932
+ # {::Google::Cloud::Logging::V2::UpdateViewRequest} or an equivalent Hash.
933
+ #
934
+ # @param request [::Google::Cloud::Logging::V2::UpdateViewRequest, ::Hash]
935
+ # A request object representing the call parameters. Required. To specify no
936
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
937
+ # @param options [::Gapic::CallOptions, ::Hash]
938
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
939
+ #
940
+ # @overload update_view(name: nil, view: nil, update_mask: nil)
941
+ # Pass arguments to `update_view` via keyword arguments. Note that at
942
+ # least one keyword argument is required. To specify no parameters, or to keep all
943
+ # the default parameter values, pass an empty Hash as a request object (see above).
944
+ #
945
+ # @param name [::String]
946
+ # Required. The full resource name of the view to update
947
+ #
948
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
949
+ #
950
+ # Example:
951
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"`.
952
+ # @param view [::Google::Cloud::Logging::V2::LogView, ::Hash]
953
+ # Required. The updated view.
954
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
955
+ # Optional. Field mask that specifies the fields in `view` that need
956
+ # an update. A field will be overwritten if, and only if, it is
957
+ # in the update mask. `name` and output only fields cannot be updated.
958
+ #
959
+ # For a detailed `FieldMask` definition, see
960
+ # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
961
+ #
962
+ # Example: `updateMask=filter`.
963
+ #
964
+ # @yield [response, operation] Access the result along with the RPC operation
965
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogView]
966
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
967
+ #
968
+ # @return [::Google::Cloud::Logging::V2::LogView]
969
+ #
970
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
971
+ #
972
+ def update_view request, options = nil
973
+ raise ::ArgumentError, "request must be provided" if request.nil?
974
+
975
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateViewRequest
976
+
977
+ # Converts hash and nil to an options object
978
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
979
+
980
+ # Customize the options with defaults
981
+ metadata = @config.rpcs.update_view.metadata.to_h
982
+
983
+ # Set x-goog-api-client and x-goog-user-project headers
984
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
985
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
986
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
987
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
988
+
989
+ header_params = {
990
+ "name" => request.name
991
+ }
992
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
993
+ metadata[:"x-goog-request-params"] ||= request_params_header
994
+
995
+ options.apply_defaults timeout: @config.rpcs.update_view.timeout,
996
+ metadata: metadata,
997
+ retry_policy: @config.rpcs.update_view.retry_policy
998
+ options.apply_defaults metadata: @config.metadata,
999
+ retry_policy: @config.retry_policy
1000
+
1001
+ @config_service_stub.call_rpc :update_view, request, options: options do |response, operation|
1002
+ yield response, operation if block_given?
1003
+ return response
1004
+ end
1005
+ rescue ::GRPC::BadStatus => e
1006
+ raise ::Google::Cloud::Error.from_error(e)
1007
+ end
1008
+
1009
+ ##
1010
+ # Deletes a view from a bucket.
1011
+ #
1012
+ # @overload delete_view(request, options = nil)
1013
+ # Pass arguments to `delete_view` via a request object, either of type
1014
+ # {::Google::Cloud::Logging::V2::DeleteViewRequest} or an equivalent Hash.
1015
+ #
1016
+ # @param request [::Google::Cloud::Logging::V2::DeleteViewRequest, ::Hash]
1017
+ # A request object representing the call parameters. Required. To specify no
1018
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1019
+ # @param options [::Gapic::CallOptions, ::Hash]
1020
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1021
+ #
1022
+ # @overload delete_view(name: nil)
1023
+ # Pass arguments to `delete_view` via keyword arguments. Note that at
1024
+ # least one keyword argument is required. To specify no parameters, or to keep all
1025
+ # the default parameter values, pass an empty Hash as a request object (see above).
1026
+ #
1027
+ # @param name [::String]
1028
+ # Required. The full resource name of the view to delete:
1029
+ #
1030
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
1031
+ #
1032
+ # Example:
1033
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"`.
1034
+ #
1035
+ # @yield [response, operation] Access the result along with the RPC operation
1036
+ # @yieldparam response [::Google::Protobuf::Empty]
1037
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1038
+ #
1039
+ # @return [::Google::Protobuf::Empty]
1040
+ #
1041
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1042
+ #
1043
+ def delete_view request, options = nil
1044
+ raise ::ArgumentError, "request must be provided" if request.nil?
1045
+
1046
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteViewRequest
1047
+
1048
+ # Converts hash and nil to an options object
1049
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1050
+
1051
+ # Customize the options with defaults
1052
+ metadata = @config.rpcs.delete_view.metadata.to_h
1053
+
1054
+ # Set x-goog-api-client and x-goog-user-project headers
1055
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1056
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1057
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1058
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1059
+
1060
+ header_params = {
1061
+ "name" => request.name
1062
+ }
1063
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1064
+ metadata[:"x-goog-request-params"] ||= request_params_header
1065
+
1066
+ options.apply_defaults timeout: @config.rpcs.delete_view.timeout,
1067
+ metadata: metadata,
1068
+ retry_policy: @config.rpcs.delete_view.retry_policy
1069
+ options.apply_defaults metadata: @config.metadata,
1070
+ retry_policy: @config.retry_policy
1071
+
1072
+ @config_service_stub.call_rpc :delete_view, request, options: options do |response, operation|
1073
+ yield response, operation if block_given?
1074
+ return response
1075
+ end
1076
+ rescue ::GRPC::BadStatus => e
1077
+ raise ::Google::Cloud::Error.from_error(e)
1078
+ end
1079
+
465
1080
  ##
466
1081
  # Lists sinks.
467
1082
  #
@@ -1554,7 +2169,7 @@ module Google
1554
2169
 
1555
2170
  config_attr :endpoint, "logging.googleapis.com", ::String
1556
2171
  config_attr :credentials, nil do |value|
1557
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2172
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1558
2173
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1559
2174
  allowed.any? { |klass| klass === value }
1560
2175
  end
@@ -1594,7 +2209,7 @@ module Google
1594
2209
  # Each configuration object is of type `Gapic::Config::Method` and includes
1595
2210
  # the following configuration fields:
1596
2211
  #
1597
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2212
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1598
2213
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1599
2214
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1600
2215
  # include the following keys:
@@ -1616,11 +2231,51 @@ module Google
1616
2231
  #
1617
2232
  attr_reader :get_bucket
1618
2233
  ##
2234
+ # RPC-specific configuration for `create_bucket`
2235
+ # @return [::Gapic::Config::Method]
2236
+ #
2237
+ attr_reader :create_bucket
2238
+ ##
1619
2239
  # RPC-specific configuration for `update_bucket`
1620
2240
  # @return [::Gapic::Config::Method]
1621
2241
  #
1622
2242
  attr_reader :update_bucket
1623
2243
  ##
2244
+ # RPC-specific configuration for `delete_bucket`
2245
+ # @return [::Gapic::Config::Method]
2246
+ #
2247
+ attr_reader :delete_bucket
2248
+ ##
2249
+ # RPC-specific configuration for `undelete_bucket`
2250
+ # @return [::Gapic::Config::Method]
2251
+ #
2252
+ attr_reader :undelete_bucket
2253
+ ##
2254
+ # RPC-specific configuration for `list_views`
2255
+ # @return [::Gapic::Config::Method]
2256
+ #
2257
+ attr_reader :list_views
2258
+ ##
2259
+ # RPC-specific configuration for `get_view`
2260
+ # @return [::Gapic::Config::Method]
2261
+ #
2262
+ attr_reader :get_view
2263
+ ##
2264
+ # RPC-specific configuration for `create_view`
2265
+ # @return [::Gapic::Config::Method]
2266
+ #
2267
+ attr_reader :create_view
2268
+ ##
2269
+ # RPC-specific configuration for `update_view`
2270
+ # @return [::Gapic::Config::Method]
2271
+ #
2272
+ attr_reader :update_view
2273
+ ##
2274
+ # RPC-specific configuration for `delete_view`
2275
+ # @return [::Gapic::Config::Method]
2276
+ #
2277
+ attr_reader :delete_view
2278
+ ##
1624
2279
  # RPC-specific configuration for `list_sinks`
1625
2280
  # @return [::Gapic::Config::Method]
1626
2281
  #
@@ -1687,8 +2342,24 @@ module Google
1687
2342
  @list_buckets = ::Gapic::Config::Method.new list_buckets_config
1688
2343
  get_bucket_config = parent_rpcs&.get_bucket if parent_rpcs&.respond_to? :get_bucket
1689
2344
  @get_bucket = ::Gapic::Config::Method.new get_bucket_config
2345
+ create_bucket_config = parent_rpcs&.create_bucket if parent_rpcs&.respond_to? :create_bucket
2346
+ @create_bucket = ::Gapic::Config::Method.new create_bucket_config
1690
2347
  update_bucket_config = parent_rpcs&.update_bucket if parent_rpcs&.respond_to? :update_bucket
1691
2348
  @update_bucket = ::Gapic::Config::Method.new update_bucket_config
2349
+ delete_bucket_config = parent_rpcs&.delete_bucket if parent_rpcs&.respond_to? :delete_bucket
2350
+ @delete_bucket = ::Gapic::Config::Method.new delete_bucket_config
2351
+ undelete_bucket_config = parent_rpcs&.undelete_bucket if parent_rpcs&.respond_to? :undelete_bucket
2352
+ @undelete_bucket = ::Gapic::Config::Method.new undelete_bucket_config
2353
+ list_views_config = parent_rpcs&.list_views if parent_rpcs&.respond_to? :list_views
2354
+ @list_views = ::Gapic::Config::Method.new list_views_config
2355
+ get_view_config = parent_rpcs&.get_view if parent_rpcs&.respond_to? :get_view
2356
+ @get_view = ::Gapic::Config::Method.new get_view_config
2357
+ create_view_config = parent_rpcs&.create_view if parent_rpcs&.respond_to? :create_view
2358
+ @create_view = ::Gapic::Config::Method.new create_view_config
2359
+ update_view_config = parent_rpcs&.update_view if parent_rpcs&.respond_to? :update_view
2360
+ @update_view = ::Gapic::Config::Method.new update_view_config
2361
+ delete_view_config = parent_rpcs&.delete_view if parent_rpcs&.respond_to? :delete_view
2362
+ @delete_view = ::Gapic::Config::Method.new delete_view_config
1692
2363
  list_sinks_config = parent_rpcs&.list_sinks if parent_rpcs&.respond_to? :list_sinks
1693
2364
  @list_sinks = ::Gapic::Config::Method.new list_sinks_config
1694
2365
  get_sink_config = parent_rpcs&.get_sink if parent_rpcs&.respond_to? :get_sink