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.



4519
4520
4521
4522
4523
4524
4525
4526
# File 'lib/svc.rb', line 4519

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



4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
# File 'lib/svc.rb', line 4528

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.



4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
# File 'lib/svc.rb', line 4622

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.



4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
# File 'lib/svc.rb', line 4558

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.



4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
# File 'lib/svc.rb', line 4651

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.



4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
# File 'lib/svc.rb', line 4592

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