Module: Google::Cloud::Chronicle

Defined in:
lib/google/cloud/chronicle.rb,
lib/google/cloud/chronicle/version.rb

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.configure {|::Google::Cloud.configure.chronicle| ... } ⇒ ::Google::Cloud::Config

Configure the google-cloud-chronicle library.

The following configuration parameters are supported:

  • credentials (type: String, Hash, Google::Auth::Credentials) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.
  • lib_name (type: String) - The library name as recorded in instrumentation and logging.
  • lib_version (type: String) - The library version as recorded in instrumentation and logging.
  • interceptors (type: Array<GRPC::ClientInterceptor>) - An array of interceptors that are run before calls are executed.
  • timeout (type: Numeric) - Default timeout in seconds.
  • metadata (type: Hash{Symbol=>String}) - Additional headers to be sent with the call.
  • retry_policy (type: Hash) - The retry policy. The value is a hash with the following keys:
    • :initial_delay (type: Numeric) - The initial delay in seconds.
    • :max_delay (type: Numeric) - The max delay in seconds.
    • :multiplier (type: Numeric) - The incremental backoff multiplier.
    • :retry_codes (type: Array<String>) - The error codes that should trigger a retry.

Yields:

Returns:

  • (::Google::Cloud::Config)

    The default configuration used by this library



497
498
499
500
501
# File 'lib/google/cloud/chronicle.rb', line 497

def self.configure
  yield ::Google::Cloud.configure.chronicle if block_given?

  ::Google::Cloud.configure.chronicle
end

.data_access_control_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for DataAccessControlService.

By default, this returns an instance of Google::Cloud::Chronicle::V1::DataAccessControlService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the DataAccessControlService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the DataAccessControlService service. You can determine whether the method will succeed by calling data_access_control_service_available?.

About DataAccessControlService

DataAccessControlService exposes resources and endpoints related to data access control.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/google/cloud/chronicle.rb', line 76

def self.data_access_control_service version: :v1, transport: :grpc, &block
  require "google/cloud/chronicle/#{version.to_s.downcase}"

  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:DataAccessControlService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.data_access_control_service_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the DataAccessControlService service is supported by the current client. If true, you can retrieve a client object by calling data_access_control_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the DataAccessControlService service, or if the versioned client gem needs an update to support the DataAccessControlService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/google/cloud/chronicle.rb', line 100

def self.data_access_control_service_available? version: :v1, transport: :grpc
  require "google/cloud/chronicle/#{version.to_s.downcase}"
  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Chronicle.const_get package_name
  return false unless service_module.const_defined? :DataAccessControlService
  service_module = service_module.const_get :DataAccessControlService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.data_table_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for DataTableService.

By default, this returns an instance of Google::Cloud::Chronicle::V1::DataTableService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the DataTableService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the DataTableService service. You can determine whether the method will succeed by calling data_table_service_available?.

About DataTableService

DataTableManager provides an interface for managing data tables.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



146
147
148
149
150
151
152
153
154
155
156
# File 'lib/google/cloud/chronicle.rb', line 146

def self.data_table_service version: :v1, transport: :grpc, &block
  require "google/cloud/chronicle/#{version.to_s.downcase}"

  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:DataTableService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.data_table_service_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the DataTableService service is supported by the current client. If true, you can retrieve a client object by calling data_table_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the DataTableService service, or if the versioned client gem needs an update to support the DataTableService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/google/cloud/chronicle.rb', line 170

def self.data_table_service_available? version: :v1, transport: :grpc
  require "google/cloud/chronicle/#{version.to_s.downcase}"
  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Chronicle.const_get package_name
  return false unless service_module.const_defined? :DataTableService
  service_module = service_module.const_get :DataTableService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.entity_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for EntityService.

By default, this returns an instance of Google::Cloud::Chronicle::V1::EntityService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the EntityService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the EntityService service. You can determine whether the method will succeed by calling entity_service_available?.

About EntityService

EntityService contains apis for finding entities.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



216
217
218
219
220
221
222
223
224
225
226
# File 'lib/google/cloud/chronicle.rb', line 216

def self.entity_service version: :v1, transport: :grpc, &block
  require "google/cloud/chronicle/#{version.to_s.downcase}"

  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:EntityService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.entity_service_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the EntityService service is supported by the current client. If true, you can retrieve a client object by calling entity_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the EntityService service, or if the versioned client gem needs an update to support the EntityService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/google/cloud/chronicle.rb', line 240

def self.entity_service_available? version: :v1, transport: :grpc
  require "google/cloud/chronicle/#{version.to_s.downcase}"
  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Chronicle.const_get package_name
  return false unless service_module.const_defined? :EntityService
  service_module = service_module.const_get :EntityService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.instance_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for InstanceService.

By default, this returns an instance of Google::Cloud::Chronicle::V1::InstanceService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the InstanceService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the InstanceService service. You can determine whether the method will succeed by calling instance_service_available?.

About InstanceService

InstanceService provides the entry interface for the Chronicle API.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



286
287
288
289
290
291
292
293
294
295
296
# File 'lib/google/cloud/chronicle.rb', line 286

def self.instance_service version: :v1, transport: :grpc, &block
  require "google/cloud/chronicle/#{version.to_s.downcase}"

  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:InstanceService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.instance_service_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the InstanceService service is supported by the current client. If true, you can retrieve a client object by calling instance_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the InstanceService service, or if the versioned client gem needs an update to support the InstanceService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/google/cloud/chronicle.rb', line 310

def self.instance_service_available? version: :v1, transport: :grpc
  require "google/cloud/chronicle/#{version.to_s.downcase}"
  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Chronicle.const_get package_name
  return false unless service_module.const_defined? :InstanceService
  service_module = service_module.const_get :InstanceService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.reference_list_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ReferenceListService.

By default, this returns an instance of Google::Cloud::Chronicle::V1::ReferenceListService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the ReferenceListService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the ReferenceListService service. You can determine whether the method will succeed by calling reference_list_service_available?.

About ReferenceListService

ReferenceListService provides an interface for managing reference lists.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



356
357
358
359
360
361
362
363
364
365
366
# File 'lib/google/cloud/chronicle.rb', line 356

def self.reference_list_service version: :v1, transport: :grpc, &block
  require "google/cloud/chronicle/#{version.to_s.downcase}"

  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:ReferenceListService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.reference_list_service_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the ReferenceListService service is supported by the current client. If true, you can retrieve a client object by calling reference_list_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the ReferenceListService service, or if the versioned client gem needs an update to support the ReferenceListService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/google/cloud/chronicle.rb', line 380

def self.reference_list_service_available? version: :v1, transport: :grpc
  require "google/cloud/chronicle/#{version.to_s.downcase}"
  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Chronicle.const_get package_name
  return false unless service_module.const_defined? :ReferenceListService
  service_module = service_module.const_get :ReferenceListService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.rule_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for RuleService.

By default, this returns an instance of Google::Cloud::Chronicle::V1::RuleService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the RuleService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the RuleService service. You can determine whether the method will succeed by calling rule_service_available?.

About RuleService

RuleService provides interface for user-created rules.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



426
427
428
429
430
431
432
433
434
435
436
# File 'lib/google/cloud/chronicle.rb', line 426

def self.rule_service version: :v1, transport: :grpc, &block
  require "google/cloud/chronicle/#{version.to_s.downcase}"

  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Chronicle.const_get(package_name).const_get(:RuleService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.rule_service_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the RuleService service is supported by the current client. If true, you can retrieve a client object by calling rule_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the RuleService service, or if the versioned client gem needs an update to support the RuleService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/google/cloud/chronicle.rb', line 450

def self.rule_service_available? version: :v1, transport: :grpc
  require "google/cloud/chronicle/#{version.to_s.downcase}"
  package_name = Google::Cloud::Chronicle
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Chronicle.const_get package_name
  return false unless service_module.const_defined? :RuleService
  service_module = service_module.const_get :RuleService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end