View Source SCF - Tencent Cloud SCF Elixir SDK

installation

Installation

The package can be installed by adding tencent_cloud_scf to your list of dependencies in mix.exs:

def deps do
  [
    {:tencent_cloud_scf, "~> 0.1.0"}
  ]
end

configuration

Configuration

config :tencent_cloud_scf,
  secret_id: "secret_id",
  secret_key: "secret_key",
  region: "your-region",
  # Optional
  http_client: [adapter: Tesla.Hackney],
  language: "your-language",
  api_host: "your-api_host"

request-api

Request API

Take this api ListFunctions as an example. There are 3 ways to request it.

1-shortcut-functions

1. shortcut functions

There are 3 shortcut functions:

If the api has required parameters other than the common parameters, the shortcut function with /0 is invalid.

2-scf-http-auth_post-parameters-opts

2. SCF.HTTP.auth_post(parameters, opts \\ [])

Build the parameters by referring the document. opts is http client options.

# don't add "X-TC-" prefix to common parameters
params = %{"Action" => "ListFunctions"}

SCF.HTTP.auth_post(params)

Build parameters and headers manually.

headers = [{"X-TC-Action", "ListFunctions"}]

SCF.HTTP.request(%{}, headers, [])