|
45 | 45 | module Google |
46 | 46 | module Cloud |
47 | 47 | module Chronicle |
| 48 | + ## |
| 49 | + # Create a new client object for BigQueryExportService. |
| 50 | + # |
| 51 | + # By default, this returns an instance of |
| 52 | + # [Google::Cloud::Chronicle::V1::BigQueryExportService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-chronicle-v1/latest/Google-Cloud-Chronicle-V1-BigQueryExportService-Client) |
| 53 | + # for a gRPC client for version V1 of the API. |
| 54 | + # However, you can specify a different API version by passing it in the |
| 55 | + # `version` parameter. If the BigQueryExportService service is |
| 56 | + # supported by that API version, and the corresponding gem is available, the |
| 57 | + # appropriate versioned client will be returned. |
| 58 | + # You can also specify a different transport by passing `:rest` or `:grpc` in |
| 59 | + # the `transport` parameter. |
| 60 | + # |
| 61 | + # Raises an exception if the currently installed versioned client gem for the |
| 62 | + # given API version does not support the given transport of the BigQueryExportService service. |
| 63 | + # You can determine whether the method will succeed by calling |
| 64 | + # {Google::Cloud::Chronicle.big_query_export_service_available?}. |
| 65 | + # |
| 66 | + # ## About BigQueryExportService |
| 67 | + # |
| 68 | + # Service for managing BigQuery export configurations for Chronicle instances. |
| 69 | + # |
| 70 | + # @param version [::String, ::Symbol] The API version to connect to. Optional. |
| 71 | + # Defaults to `:v1`. |
| 72 | + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. |
| 73 | + # @return [::Object] A client object for the specified version. |
| 74 | + # |
| 75 | + def self.big_query_export_service version: :v1, transport: :grpc, &block |
| 76 | + require "google/cloud/chronicle/#{version.to_s.downcase}" |
| 77 | + |
| 78 | + package_name = Google::Cloud::Chronicle |
| 79 | + .constants |
| 80 | + .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } |
| 81 | + .first |
| 82 | + service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:BigQueryExportService) |
| 83 | + service_module = service_module.const_get(:Rest) if transport == :rest |
| 84 | + service_module.const_get(:Client).new(&block) |
| 85 | + end |
| 86 | + |
| 87 | + ## |
| 88 | + # Determines whether the BigQueryExportService service is supported by the current client. |
| 89 | + # If true, you can retrieve a client object by calling {Google::Cloud::Chronicle.big_query_export_service}. |
| 90 | + # If false, that method will raise an exception. This could happen if the given |
| 91 | + # API version does not exist or does not support the BigQueryExportService service, |
| 92 | + # or if the versioned client gem needs an update to support the BigQueryExportService service. |
| 93 | + # |
| 94 | + # @param version [::String, ::Symbol] The API version to connect to. Optional. |
| 95 | + # Defaults to `:v1`. |
| 96 | + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. |
| 97 | + # @return [boolean] Whether the service is available. |
| 98 | + # |
| 99 | + def self.big_query_export_service_available? version: :v1, transport: :grpc |
| 100 | + require "google/cloud/chronicle/#{version.to_s.downcase}" |
| 101 | + package_name = Google::Cloud::Chronicle |
| 102 | + .constants |
| 103 | + .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } |
| 104 | + .first |
| 105 | + return false unless package_name |
| 106 | + service_module = Google::Cloud::Chronicle.const_get package_name |
| 107 | + return false unless service_module.const_defined? :BigQueryExportService |
| 108 | + service_module = service_module.const_get :BigQueryExportService |
| 109 | + if transport == :rest |
| 110 | + return false unless service_module.const_defined? :Rest |
| 111 | + service_module = service_module.const_get :Rest |
| 112 | + end |
| 113 | + service_module.const_defined? :Client |
| 114 | + rescue ::LoadError |
| 115 | + false |
| 116 | + end |
| 117 | + |
48 | 118 | ## |
49 | 119 | # Create a new client object for DashboardQueryService. |
50 | 120 | # |
|
0 commit comments