class Twilio::REST::Accounts::V1::CredentialList::AwsList
Public Class Methods
Initialize the AwsList
@param [Version] version Version
that contains the resource @return [AwsList] AwsList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 19 def initialize(version) 20 super(version) 21 22 # Path Solution 23 @solution = {} 24 @uri = "/Credentials/AWS" 25 end
Public Instance Methods
Create the AwsInstance
@param [String] credentials A string that contains the AWS access credentials in
the format `<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>`. For example, `AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`
@param [String] friendly_name A descriptive string that you create to describe
the resource. It can be up to 64 characters long.
@param [String] account_sid The SID of the Subaccount that this Credential
should be associated with. Must be a valid Subaccount of the account issuing the request.
@return [AwsInstance] Created AwsInstance
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 118 def create(credentials: nil, friendly_name: :unset, account_sid: :unset) 119 data = Twilio::Values.of({ 120 'Credentials' => credentials, 121 'FriendlyName' => friendly_name, 122 'AccountSid' => account_sid, 123 }) 124 125 payload = @version.create('POST', @uri, data: data) 126 127 AwsInstance.new(@version, payload, ) 128 end
When passed a block, yields AwsInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 65 def each 66 limits = @version.read_limits 67 68 page = self.page(page_size: limits[:page_size], ) 69 70 @version.stream(page, 71 limit: limits[:limit], 72 page_limit: limits[:page_limit]).each {|x| yield x} 73 end
Retrieve a single page of AwsInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of AwsInstance
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 99 def get_page(target_url) 100 response = @version.domain.request( 101 'GET', 102 target_url 103 ) 104 AwsPage.new(@version, response, @solution) 105 end
Lists AwsInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 38 def list(limit: nil, page_size: nil) 39 self.stream(limit: limit, page_size: page_size).entries 40 end
Retrieve a single page of AwsInstance
records from the API. Request
is executed immediately. @param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of AwsInstance
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 82 def page(page_token: :unset, page_number: :unset, page_size: :unset) 83 params = Twilio::Values.of({ 84 'PageToken' => page_token, 85 'Page' => page_number, 86 'PageSize' => page_size, 87 }) 88 89 response = @version.page('GET', @uri, params: params) 90 91 AwsPage.new(@version, response, @solution) 92 end
Streams AwsInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 53 def stream(limit: nil, page_size: nil) 54 limits = @version.read_limits(limit, page_size) 55 56 page = self.page(page_size: limits[:page_size], ) 57 58 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 59 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/accounts/v1/credential/aws.rb 132 def to_s 133 '#<Twilio.Accounts.V1.AwsList>' 134 end