Class: SDM::SecretStores

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/svc.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ SecretStores

Returns a new instance of SecretStores.



3780
3781
3782
3783
3784
3785
3786
3787
# File 'lib/svc.rb', line 3780

def initialize(channel, parent)
  begin
    @stub = V1::SecretStores::Stub.new(nil, nil, channel_override: channel)
  rescue => exception
    raise Plumbing::convert_error_to_porcelain(exception)
  end
  @parent = parent
end

Instance Method Details

#create(secret_store, deadline: nil) ⇒ Object



3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
# File 'lib/svc.rb', line 3789

def create(
  secret_store,
  deadline: nil
)
  req = V1::SecretStoreCreateRequest.new()

  req.secret_store = Plumbing::convert_secret_store_to_plumbing(secret_store)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.create(req, metadata: @parent.("SecretStores.Create", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = SecretStoreCreateResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.secret_store = Plumbing::convert_secret_store_to_porcelain(plumbing_response.secret_store)
  resp
end

#delete(id, deadline: nil) ⇒ Object

Delete removes a SecretStore by ID.



3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
# File 'lib/svc.rb', line 3883

def delete(
  id,
  deadline: nil
)
  req = V1::SecretStoreDeleteRequest.new()

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.delete(req, metadata: @parent.("SecretStores.Delete", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = SecretStoreDeleteResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#get(id, deadline: nil) ⇒ Object

Get reads one SecretStore by ID.



3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
# File 'lib/svc.rb', line 3819

def get(
  id,
  deadline: nil
)
  req = V1::SecretStoreGetRequest.new()
  if not @parent.snapshot_time.nil?
    req.meta = V1::GetRequestMetadata.new()
    req.meta.snapshot_at = @parent.snapshot_time
  end

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.get(req, metadata: @parent.("SecretStores.Get", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = SecretStoreGetResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.secret_store = Plumbing::convert_secret_store_to_porcelain(plumbing_response.secret_store)
  resp
end

#list(filter, *args, deadline: nil) ⇒ Object

List gets a list of SecretStores matching a given set of criteria.



3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
# File 'lib/svc.rb', line 3912

def list(
  filter,
  *args,
  deadline: nil
)
  req = V1::SecretStoreListRequest.new()
  req.meta = V1::ListRequestMetadata.new()
  if @parent.page_limit > 0
    req.meta.limit = @parent.page_limit
  end
  if not @parent.snapshot_time.nil?
    req.meta.snapshot_at = @parent.snapshot_time
  end

  req.filter = Plumbing::quote_filter_args(filter, *args)
  resp = Enumerator::Generator.new { |g|
    tries = 0
    loop do
      begin
        plumbing_response = @stub.list(req, metadata: @parent.("SecretStores.List", req), deadline: deadline)
      rescue => exception
        if (@parent.shouldRetry(tries, exception))
          tries + +@parent.jitterSleep(tries)
          next
        end
        raise Plumbing::convert_error_to_porcelain(exception)
      end
      tries = 0
      plumbing_response.secret_stores.each do |plumbing_item|
        g.yield Plumbing::convert_secret_store_to_porcelain(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end

#update(secret_store, deadline: nil) ⇒ Object

Update replaces all the fields of a SecretStore by ID.



3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
# File 'lib/svc.rb', line 3853

def update(
  secret_store,
  deadline: nil
)
  req = V1::SecretStoreUpdateRequest.new()

  req.secret_store = Plumbing::convert_secret_store_to_plumbing(secret_store)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.update(req, metadata: @parent.("SecretStores.Update", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = SecretStoreUpdateResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.secret_store = Plumbing::convert_secret_store_to_porcelain(plumbing_response.secret_store)
  resp
end