Class: Couchbase::Protostellar::RequestGenerator::Admin::Collection Private

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/protostellar/request_generator/admin/collection.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name:) ⇒ Collection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Collection.



27
28
29
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 27

def initialize(bucket_name:)
  @bucket_name = bucket_name
end

Instance Attribute Details

#clientObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 25

def client
  @client
end

Instance Method Details

#create_collection_request(scope_name, collection_name, settings, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 54

def create_collection_request(scope_name, collection_name, settings, options)
  proto_opts = {}
  proto_opts[:max_expiry_secs] = settings.max_expiry unless settings.max_expiry.nil?
  unless settings.history.nil?
    raise Couchbase::Error::FeatureNotAvailable, "The #{Protostellar::NAME} protocol does not support the history setting"
  end

  proto_req = Generated::Admin::Collection::V1::CreateCollectionRequest.new(
    bucket_name: @bucket_name,
    scope_name: scope_name,
    collection_name: collection_name,
    **proto_opts
  )
  create_request(proto_req, :create_collection, options)
end

#create_scope_request(scope_name, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
41
42
43
44
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 38

def create_scope_request(scope_name, options)
  proto_req = Generated::Admin::Collection::V1::CreateScopeRequest.new(
    bucket_name: @bucket_name,
    scope_name: scope_name
  )
  create_request(proto_req, :create_scope, options)
end

#delete_collection_request(scope_name, collection_name, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



70
71
72
73
74
75
76
77
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 70

def delete_collection_request(scope_name, collection_name, options)
  proto_req = Generated::Admin::Collection::V1::DeleteCollectionRequest.new(
    bucket_name: @bucket_name,
    scope_name: scope_name,
    collection_name: collection_name
  )
  create_request(proto_req, :delete_collection, options)
end

#delete_scope_request(scope_name, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
49
50
51
52
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 46

def delete_scope_request(scope_name, options)
  proto_req = Generated::Admin::Collection::V1::DeleteScopeRequest.new(
    bucket_name: @bucket_name,
    scope_name: scope_name
  )
  create_request(proto_req, :delete_scope, options)
end

#list_collections_request(options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
36
# File 'lib/couchbase/protostellar/request_generator/admin/collection.rb', line 31

def list_collections_request(options)
  proto_req = Generated::Admin::Collection::V1::ListCollectionsRequest.new(
    bucket_name: @bucket_name
  )
  create_request(proto_req, :list_collections, options, idempotent: true)
end