class Fastly::ServiceAuthorizationsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/fastly/api/service_authorizations_api.rb, line 17
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_service_authorization(opts = {}) click to toggle source

Create service authorization Create service authorization. @option opts [ServiceAuthorization] :service_authorization @return [ServiceAuthorizationResponse]

# File lib/fastly/api/service_authorizations_api.rb, line 24
def create_service_authorization(opts = {})
  data, _status_code, _headers = create_service_authorization_with_http_info(opts)
  data
end
create_service_authorization_with_http_info(opts = {}) click to toggle source

Create service authorization Create service authorization. @option opts [ServiceAuthorization] :service_authorization @return [Array<(ServiceAuthorizationResponse, Integer, Hash)>] ServiceAuthorizationResponse data, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 33
def create_service_authorization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.create_service_authorization ...'
  end
  # unbox the parameters from the hash
  # resource path
  local_var_path = '/service-authorizations'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'service_authorization'])

  # return_type
  return_type = opts[:debug_return_type] || 'ServiceAuthorizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.create_service_authorization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#create_service_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_service_authorization(opts = {}) click to toggle source

Delete service authorization Delete service authorization. @option opts [String] :service_authorization_id Alphanumeric string identifying a service authorization. (required) @return [nil]

# File lib/fastly/api/service_authorizations_api.rb, line 87
def delete_service_authorization(opts = {})
  delete_service_authorization_with_http_info(opts)
  nil
end
delete_service_authorization2(opts = {}) click to toggle source

Delete service authorizations Delete service authorizations. @option opts [Hash<String, Object>] :request_body @return [InlineResponse2007]

# File lib/fastly/api/service_authorizations_api.rb, line 148
def delete_service_authorization2(opts = {})
  data, _status_code, _headers = delete_service_authorization2_with_http_info(opts)
  data
end
delete_service_authorization2_with_http_info(opts = {}) click to toggle source

Delete service authorizations Delete service authorizations. @option opts [Hash<String, Object>] :request_body @return [Array<(InlineResponse2007, Integer, Hash)>] InlineResponse2007 data, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 157
def delete_service_authorization2_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.delete_service_authorization2 ...'
  end
  # unbox the parameters from the hash
  # resource path
  local_var_path = '/service-authorizations'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json; ext=bulk'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json; ext=bulk'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2007'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.delete_service_authorization2",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#delete_service_authorization2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_service_authorization_with_http_info(opts = {}) click to toggle source

Delete service authorization Delete service authorization. @option opts [String] :service_authorization_id Alphanumeric string identifying a service authorization. (required) @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 96
def delete_service_authorization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.delete_service_authorization ...'
  end
  # unbox the parameters from the hash
  service_authorization_id = opts[:'service_authorization_id']
  # verify the required parameter 'service_authorization_id' is set
  if @api_client.config.client_side_validation && service_authorization_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_authorization_id' when calling ServiceAuthorizationsApi.delete_service_authorization"
  end
  # resource path
  local_var_path = '/service-authorizations/{service_authorization_id}'.sub('{' + 'service_authorization_id' + '}', CGI.escape(service_authorization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.delete_service_authorization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#delete_service_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_service_authorization(opts = {}) click to toggle source

List service authorizations List service authorizations. @option opts [Integer] :page_number Current page. @option opts [Integer] :page_size Number of records per page. (default to 20) @return [ServiceAuthorizationsResponse]

# File lib/fastly/api/service_authorizations_api.rb, line 212
def list_service_authorization(opts = {})
  data, _status_code, _headers = list_service_authorization_with_http_info(opts)
  data
end
list_service_authorization_with_http_info(opts = {}) click to toggle source

List service authorizations List service authorizations. @option opts [Integer] :page_number Current page. @option opts [Integer] :page_size Number of records per page. (default to 20) @return [Array<(ServiceAuthorizationsResponse, Integer, Hash)>] ServiceAuthorizationsResponse data, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 222
def list_service_authorization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.list_service_authorization ...'
  end
  # unbox the parameters from the hash
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ServiceAuthorizationsApi.list_service_authorization, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ServiceAuthorizationsApi.list_service_authorization, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/service-authorizations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ServiceAuthorizationsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.list_service_authorization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#list_service_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
show_service_authorization(opts = {}) click to toggle source

Show service authorization Show service authorization. @option opts [String] :service_authorization_id Alphanumeric string identifying a service authorization. (required) @return [ServiceAuthorizationResponse]

# File lib/fastly/api/service_authorizations_api.rb, line 281
def show_service_authorization(opts = {})
  data, _status_code, _headers = show_service_authorization_with_http_info(opts)
  data
end
show_service_authorization_with_http_info(opts = {}) click to toggle source

Show service authorization Show service authorization. @option opts [String] :service_authorization_id Alphanumeric string identifying a service authorization. (required) @return [Array<(ServiceAuthorizationResponse, Integer, Hash)>] ServiceAuthorizationResponse data, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 290
def show_service_authorization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.show_service_authorization ...'
  end
  # unbox the parameters from the hash
  service_authorization_id = opts[:'service_authorization_id']
  # verify the required parameter 'service_authorization_id' is set
  if @api_client.config.client_side_validation && service_authorization_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_authorization_id' when calling ServiceAuthorizationsApi.show_service_authorization"
  end
  # resource path
  local_var_path = '/service-authorizations/{service_authorization_id}'.sub('{' + 'service_authorization_id' + '}', CGI.escape(service_authorization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ServiceAuthorizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.show_service_authorization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#show_service_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_service_authorization(opts = {}) click to toggle source

Update service authorization Update service authorization. @option opts [String] :service_authorization_id Alphanumeric string identifying a service authorization. (required) @option opts [ServiceAuthorization] :service_authorization @return [ServiceAuthorizationResponse]

# File lib/fastly/api/service_authorizations_api.rb, line 345
def update_service_authorization(opts = {})
  data, _status_code, _headers = update_service_authorization_with_http_info(opts)
  data
end
update_service_authorization2(opts = {}) click to toggle source

Update service authorizations Update service authorizations. @option opts [Hash<String, Object>] :request_body @return [ServiceAuthorizationsResponse]

# File lib/fastly/api/service_authorizations_api.rb, line 414
def update_service_authorization2(opts = {})
  data, _status_code, _headers = update_service_authorization2_with_http_info(opts)
  data
end
update_service_authorization2_with_http_info(opts = {}) click to toggle source

Update service authorizations Update service authorizations. @option opts [Hash<String, Object>] :request_body @return [Array<(ServiceAuthorizationsResponse, Integer, Hash)>] ServiceAuthorizationsResponse data, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 423
def update_service_authorization2_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.update_service_authorization2 ...'
  end
  # unbox the parameters from the hash
  # resource path
  local_var_path = '/service-authorizations'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json; ext=bulk'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json; ext=bulk'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'ServiceAuthorizationsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.update_service_authorization2",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#update_service_authorization2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_service_authorization_with_http_info(opts = {}) click to toggle source

Update service authorization Update service authorization. @option opts [String] :service_authorization_id Alphanumeric string identifying a service authorization. (required) @option opts [ServiceAuthorization] :service_authorization @return [Array<(ServiceAuthorizationResponse, Integer, Hash)>] ServiceAuthorizationResponse data, response status code and response headers

# File lib/fastly/api/service_authorizations_api.rb, line 355
def update_service_authorization_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ServiceAuthorizationsApi.update_service_authorization ...'
  end
  # unbox the parameters from the hash
  service_authorization_id = opts[:'service_authorization_id']
  # verify the required parameter 'service_authorization_id' is set
  if @api_client.config.client_side_validation && service_authorization_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_authorization_id' when calling ServiceAuthorizationsApi.update_service_authorization"
  end
  # resource path
  local_var_path = '/service-authorizations/{service_authorization_id}'.sub('{' + 'service_authorization_id' + '}', CGI.escape(service_authorization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'service_authorization'])

  # return_type
  return_type = opts[:debug_return_type] || 'ServiceAuthorizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"ServiceAuthorizationsApi.update_service_authorization",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ServiceAuthorizationsApi#update_service_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end