Class: Aws::S3::AccessGrantsCredentialsProvider
- Inherits:
 - 
      Object
      
        
- Object
 - Aws::S3::AccessGrantsCredentialsProvider
 
 
- Defined in:
 - lib/aws-sdk-s3/access_grants_credentials_provider.rb
 
Overview
Returns Credentials class for S3 Access Grants. Accepts GetDataAccess params and other configuration as options. See Aws::S3Control::Client#get_data_access for details.
Instance Attribute Summary collapse
- 
  
    
      #s3_client  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute s3_client.
 
Instance Method Summary collapse
- #access_grants_credentials_for(options = {}) ⇒ Object
 - 
  
    
      #initialize(options = {})  ⇒ AccessGrantsCredentialsProvider 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of AccessGrantsCredentialsProvider.
 
Constructor Details
#initialize(options = {}) ⇒ AccessGrantsCredentialsProvider
Returns a new instance of AccessGrantsCredentialsProvider.
      42 43 44 45 46 47 48 49 50 51 52 53 54 55 56  | 
    
      # File 'lib/aws-sdk-s3/access_grants_credentials_provider.rb', line 42 def initialize( = {}) @s3_control_options = .delete(:s3_control_client_options) || {} @s3_client = .delete(:s3_client) @sts_client = .delete(:sts_client) @fallback = .delete(:fallback) || false @caching = .delete(:caching) != false @s3_control_clients = {} @bucket_region_cache = Aws::S3.bucket_region_cache @head_bucket_mutex = Mutex.new @head_bucket_call = false return unless @caching @credentials_cache = Aws::S3.access_grants_credentials_cache @account_id_cache = Aws::S3.access_grants_account_id_cache end  | 
  
Instance Attribute Details
#s3_client ⇒ Object
Returns the value of attribute s3_client.
      79 80 81  | 
    
      # File 'lib/aws-sdk-s3/access_grants_credentials_provider.rb', line 79 def s3_client @s3_client end  | 
  
Instance Method Details
#access_grants_credentials_for(options = {}) ⇒ Object
      58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77  | 
    
      # File 'lib/aws-sdk-s3/access_grants_credentials_provider.rb', line 58 def access_grants_credentials_for( = {}) target = target_prefix( [:bucket], [:key], [:prefix] ) credentials = s3_client.config.credentials.credentials # resolves if @caching cached_credentials_for(target, [:permission], credentials) else new_credentials_for(target, [:permission], credentials) end rescue Aws::S3Control::Errors::AccessDenied raise unless @fallback warn 'Access denied for S3 Access Grants. Falling back to ' \ 'configured credentials.' s3_client.config.credentials end  |