class Aws::InstanceProfileCredentials

def get_credentials

def get_credentials
  # Retry loading credentials a configurable number of times if
  # the instance metadata service is not responding.
  if _metadata_disabled?
    '{}'
  else
    begin
      retry_errors(NETWORK_ERRORS, max_retries: @retries) do
        open_connection do |conn|
          # attempt to fetch token to start secure flow first
          # and rescue to failover
          fetch_token(conn) unless @imds_v1_fallback
          token = @token.value if token_set?
          # disable insecure flow if we couldn't get token
          # and imds v1 is disabled
          raise TokenRetrivalError if token.nil? && @disable_imds_v1
          _get_credentials(conn, token)
        end
      end
    rescue
      '{}'
    end
  end
end