class Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext::LogList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the LogList
@param [Version] version Version
that contains the resource @param [String] service_sid The SID of the Service that the Log resource is
associated with.
@param [String] environment_sid The SID of the environment in which the log
occurred.
@return [LogList] LogList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb 26 def initialize(version, service_sid: nil, environment_sid: nil) 27 super(version) 28 29 # Path Solution 30 @solution = {service_sid: service_sid, environment_sid: environment_sid} 31 @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Logs" 32 end
Public Instance Methods
When passed a block, yields LogInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb 95 def each 96 limits = @version.read_limits 97 98 page = self.page(page_size: limits[:page_size], ) 99 100 @version.stream(page, 101 limit: limits[:limit], 102 page_limit: limits[:page_limit]).each {|x| yield x} 103 end
Retrieve a single page of LogInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of LogInstance
# File lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb 138 def get_page(target_url) 139 response = @version.domain.request( 140 'GET', 141 target_url 142 ) 143 LogPage.new(@version, response, @solution) 144 end
Lists LogInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] function_sid The SID of the function whose invocation produced
the Log resources to read.
@param [Time] start_date The date/time (in GMT, ISO 8601) after which the Log
resources must have been created. Defaults to 1 day prior to current date/time.
@param [Time] end_date The date/time (in GMT, ISO 8601) before which the Log
resources must have been created. Defaults to current date/time.
@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/serverless/v1/service/environment/log.rb 51 def list(function_sid: :unset, start_date: :unset, end_date: :unset, limit: nil, page_size: nil) 52 self.stream( 53 function_sid: function_sid, 54 start_date: start_date, 55 end_date: end_date, 56 limit: limit, 57 page_size: page_size 58 ).entries 59 end
Retrieve a single page of LogInstance
records from the API. Request
is executed immediately. @param [String] function_sid The SID of the function whose invocation produced
the Log resources to read.
@param [Time] start_date The date/time (in GMT, ISO 8601) after which the Log
resources must have been created. Defaults to 1 day prior to current date/time.
@param [Time] end_date The date/time (in GMT, ISO 8601) before which the Log
resources must have been created. Defaults to current date/time.
@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 LogInstance
# File lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb 118 def page(function_sid: :unset, start_date: :unset, end_date: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 119 params = Twilio::Values.of({ 120 'FunctionSid' => function_sid, 121 'StartDate' => Twilio.serialize_iso8601_datetime(start_date), 122 'EndDate' => Twilio.serialize_iso8601_datetime(end_date), 123 'PageToken' => page_token, 124 'Page' => page_number, 125 'PageSize' => page_size, 126 }) 127 128 response = @version.page('GET', @uri, params: params) 129 130 LogPage.new(@version, response, @solution) 131 end
Streams LogInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] function_sid The SID of the function whose invocation produced
the Log resources to read.
@param [Time] start_date The date/time (in GMT, ISO 8601) after which the Log
resources must have been created. Defaults to 1 day prior to current date/time.
@param [Time] end_date The date/time (in GMT, ISO 8601) before which the Log
resources must have been created. Defaults to current date/time.
@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/serverless/v1/service/environment/log.rb 78 def stream(function_sid: :unset, start_date: :unset, end_date: :unset, limit: nil, page_size: nil) 79 limits = @version.read_limits(limit, page_size) 80 81 page = self.page( 82 function_sid: function_sid, 83 start_date: start_date, 84 end_date: end_date, 85 page_size: limits[:page_size], 86 ) 87 88 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 89 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb 148 def to_s 149 '#<Twilio.Serverless.V1.LogList>' 150 end