google-cloud-logging-v2 0.1.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
@@ -60,7 +60,7 @@ module Google
60
60
  parent_config = while namespace.any?
61
61
  parent_name = namespace.join "::"
62
62
  parent_const = const_get parent_name
63
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
64
  namespace.pop
65
65
  end
66
66
  default_config = Client::Configuration.new parent_config
@@ -68,17 +68,17 @@ module Google
68
68
  default_config.rpcs.list_sinks.timeout = 60.0
69
69
  default_config.rpcs.list_sinks.retry_policy = {
70
70
  initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [4, 13, 14]
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [4, 13, 14]
74
74
  }
75
75
 
76
76
  default_config.rpcs.get_sink.timeout = 60.0
77
77
  default_config.rpcs.get_sink.retry_policy = {
78
78
  initial_delay: 0.1,
79
- max_delay: 60.0,
80
- multiplier: 1.3,
81
- retry_codes: [4, 13, 14]
79
+ max_delay: 60.0,
80
+ multiplier: 1.3,
81
+ retry_codes: [4, 13, 14]
82
82
  }
83
83
 
84
84
  default_config.rpcs.create_sink.timeout = 120.0
@@ -86,33 +86,33 @@ module Google
86
86
  default_config.rpcs.update_sink.timeout = 60.0
87
87
  default_config.rpcs.update_sink.retry_policy = {
88
88
  initial_delay: 0.1,
89
- max_delay: 60.0,
90
- multiplier: 1.3,
91
- retry_codes: [4, 13, 14]
89
+ max_delay: 60.0,
90
+ multiplier: 1.3,
91
+ retry_codes: [4, 13, 14]
92
92
  }
93
93
 
94
94
  default_config.rpcs.delete_sink.timeout = 60.0
95
95
  default_config.rpcs.delete_sink.retry_policy = {
96
96
  initial_delay: 0.1,
97
- max_delay: 60.0,
98
- multiplier: 1.3,
99
- retry_codes: [4, 13, 14]
97
+ max_delay: 60.0,
98
+ multiplier: 1.3,
99
+ retry_codes: [4, 13, 14]
100
100
  }
101
101
 
102
102
  default_config.rpcs.list_exclusions.timeout = 60.0
103
103
  default_config.rpcs.list_exclusions.retry_policy = {
104
104
  initial_delay: 0.1,
105
- max_delay: 60.0,
106
- multiplier: 1.3,
107
- retry_codes: [4, 13, 14]
105
+ max_delay: 60.0,
106
+ multiplier: 1.3,
107
+ retry_codes: [4, 13, 14]
108
108
  }
109
109
 
110
110
  default_config.rpcs.get_exclusion.timeout = 60.0
111
111
  default_config.rpcs.get_exclusion.retry_policy = {
112
112
  initial_delay: 0.1,
113
- max_delay: 60.0,
114
- multiplier: 1.3,
115
- retry_codes: [4, 13, 14]
113
+ max_delay: 60.0,
114
+ multiplier: 1.3,
115
+ retry_codes: [4, 13, 14]
116
116
  }
117
117
 
118
118
  default_config.rpcs.create_exclusion.timeout = 120.0
@@ -122,9 +122,9 @@ module Google
122
122
  default_config.rpcs.delete_exclusion.timeout = 60.0
123
123
  default_config.rpcs.delete_exclusion.retry_policy = {
124
124
  initial_delay: 0.1,
125
- max_delay: 60.0,
126
- multiplier: 1.3,
127
- retry_codes: [4, 13, 14]
125
+ max_delay: 60.0,
126
+ multiplier: 1.3,
127
+ retry_codes: [4, 13, 14]
128
128
  }
129
129
 
130
130
  default_config
@@ -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
  #
@@ -1561,7 +2176,7 @@ module Google
1561
2176
  config_attr :scope, nil, ::String, ::Array, nil
1562
2177
  config_attr :lib_name, nil, ::String, nil
1563
2178
  config_attr :lib_version, nil, ::String, nil
1564
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
2179
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1565
2180
  config_attr :interceptors, nil, ::Array, nil
1566
2181
  config_attr :timeout, nil, ::Numeric, nil
1567
2182
  config_attr :metadata, nil, ::Hash, nil
@@ -1582,7 +2197,7 @@ module Google
1582
2197
  def rpcs
1583
2198
  @rpcs ||= begin
1584
2199
  parent_rpcs = nil
1585
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
2200
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1586
2201
  Rpcs.new parent_rpcs
1587
2202
  end
1588
2203
  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
  #
@@ -1683,35 +2338,51 @@ module Google
1683
2338
 
1684
2339
  # @private
1685
2340
  def initialize parent_rpcs = nil
1686
- list_buckets_config = parent_rpcs&.list_buckets if parent_rpcs&.respond_to? :list_buckets
2341
+ list_buckets_config = parent_rpcs.list_buckets if parent_rpcs.respond_to? :list_buckets
1687
2342
  @list_buckets = ::Gapic::Config::Method.new list_buckets_config
1688
- get_bucket_config = parent_rpcs&.get_bucket if parent_rpcs&.respond_to? :get_bucket
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
1690
- update_bucket_config = parent_rpcs&.update_bucket if parent_rpcs&.respond_to? :update_bucket
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
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
1692
- list_sinks_config = parent_rpcs&.list_sinks if parent_rpcs&.respond_to? :list_sinks
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
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
- get_sink_config = parent_rpcs&.get_sink if parent_rpcs&.respond_to? :get_sink
2365
+ get_sink_config = parent_rpcs.get_sink if parent_rpcs.respond_to? :get_sink
1695
2366
  @get_sink = ::Gapic::Config::Method.new get_sink_config
1696
- create_sink_config = parent_rpcs&.create_sink if parent_rpcs&.respond_to? :create_sink
2367
+ create_sink_config = parent_rpcs.create_sink if parent_rpcs.respond_to? :create_sink
1697
2368
  @create_sink = ::Gapic::Config::Method.new create_sink_config
1698
- update_sink_config = parent_rpcs&.update_sink if parent_rpcs&.respond_to? :update_sink
2369
+ update_sink_config = parent_rpcs.update_sink if parent_rpcs.respond_to? :update_sink
1699
2370
  @update_sink = ::Gapic::Config::Method.new update_sink_config
1700
- delete_sink_config = parent_rpcs&.delete_sink if parent_rpcs&.respond_to? :delete_sink
2371
+ delete_sink_config = parent_rpcs.delete_sink if parent_rpcs.respond_to? :delete_sink
1701
2372
  @delete_sink = ::Gapic::Config::Method.new delete_sink_config
1702
- list_exclusions_config = parent_rpcs&.list_exclusions if parent_rpcs&.respond_to? :list_exclusions
2373
+ list_exclusions_config = parent_rpcs.list_exclusions if parent_rpcs.respond_to? :list_exclusions
1703
2374
  @list_exclusions = ::Gapic::Config::Method.new list_exclusions_config
1704
- get_exclusion_config = parent_rpcs&.get_exclusion if parent_rpcs&.respond_to? :get_exclusion
2375
+ get_exclusion_config = parent_rpcs.get_exclusion if parent_rpcs.respond_to? :get_exclusion
1705
2376
  @get_exclusion = ::Gapic::Config::Method.new get_exclusion_config
1706
- create_exclusion_config = parent_rpcs&.create_exclusion if parent_rpcs&.respond_to? :create_exclusion
2377
+ create_exclusion_config = parent_rpcs.create_exclusion if parent_rpcs.respond_to? :create_exclusion
1707
2378
  @create_exclusion = ::Gapic::Config::Method.new create_exclusion_config
1708
- update_exclusion_config = parent_rpcs&.update_exclusion if parent_rpcs&.respond_to? :update_exclusion
2379
+ update_exclusion_config = parent_rpcs.update_exclusion if parent_rpcs.respond_to? :update_exclusion
1709
2380
  @update_exclusion = ::Gapic::Config::Method.new update_exclusion_config
1710
- delete_exclusion_config = parent_rpcs&.delete_exclusion if parent_rpcs&.respond_to? :delete_exclusion
2381
+ delete_exclusion_config = parent_rpcs.delete_exclusion if parent_rpcs.respond_to? :delete_exclusion
1711
2382
  @delete_exclusion = ::Gapic::Config::Method.new delete_exclusion_config
1712
- get_cmek_settings_config = parent_rpcs&.get_cmek_settings if parent_rpcs&.respond_to? :get_cmek_settings
2383
+ get_cmek_settings_config = parent_rpcs.get_cmek_settings if parent_rpcs.respond_to? :get_cmek_settings
1713
2384
  @get_cmek_settings = ::Gapic::Config::Method.new get_cmek_settings_config
1714
- update_cmek_settings_config = parent_rpcs&.update_cmek_settings if parent_rpcs&.respond_to? :update_cmek_settings
2385
+ update_cmek_settings_config = parent_rpcs.update_cmek_settings if parent_rpcs.respond_to? :update_cmek_settings
1715
2386
  @update_cmek_settings = ::Gapic::Config::Method.new update_cmek_settings_config
1716
2387
 
1717
2388
  yield self if block_given?