Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel,
n'hésitez pas à nous contacter.
Generic actions are workflow actions that are not associated with a tool or integration. If an action you need is missing from the Actions catalog, you might be able to solve your use case with a generic action.
As with all workflow actions, you can use the context variables tab to access any values available in the workflow context.
You can also request a new action or entire integration.
HTTP
Use the HTTP action to make a request to a custom endpoint. You can control the request method and its contents, how it is authenticated and processed, and how it should respond to scenarios like expired certificates or redirects. If you need to add Datadog IP address ranges to your allowlist so that the HTTP action works as expected, use the IPs listed in the webhooks
object. See the IP Ranges page for details.
Begin by specifying the request method and any necessary authentication. Read the sections below for further information about the available configuration tabs. Optionally, the request can wait on conditions that you specify in the Conditional wait section, and retry itself at a given interval if the condition is not satisfied.
Authentication
If you need to authenticate your request, use the action’s Connection to configure the authentication method. You can either select a preconfigured connection from the dropdown, or create a connection.
Create an AWS connection
- In the Connection section, click the plus icon (+).
- Select AWS.
- Enter a Connection Name, Account ID, and AWS Role Name.
- Click Create.
Create an Azure connection
- In the Connection section, click the plus icon (+).
- Select Azure.
- Enter a Connection Name, Tenant ID, Client ID, and Client Secret.
- Optionally, enter the Custom Scope to be requested from Microsoft when acquiring an OAuth 2 access token. A resource’s scope is constructed using the identifier URI for the resource and
.default
, separated by a forward slash (/
). For example, {identifierURI}/.default
. For more information, see the Microsoft documentation on .default scope. - Click Create.
Create an HTTP basic auth connection
The Basic Auth connection uses an authorization header with a username and password to authenticate the HTTP request.
- In the Connection section, click the plus icon (+).
- Select HTTP.
- Enter a Connection Name.
- From the Authentication Type dropdown, select Basic Auth.
- Enter a Username and Password.
- Enter the Base URL for authentication. The required authorization request header is automatically populated using your username and password, but you can add additional Request Headers if necessary.
- Optionally, add URL parameters and a Body to your request.
- Click Create.
Create an HTTP token auth connection
The Token Auth connection uses a bearer token to authenticate the HTTP request.
- In the Connection section, click the plus icon (+).
- Select HTTP.
- Enter a Connection Name.
- From the Authentication Type dropdown, select Token Auth.
- Enter a Token Name and Token Value. You can enter multiple tokens. To reference your token in a header, parameter, or the request body, use the syntax
{{ secretTokenName }}
. - Enter the Base URL for authentication.
- Optionally, add additional Request Headers, URL parameters and a Body to your request.
- Click Create.
Create an HTTP request auth connection
The HTTP Request Auth connection allows you to make a preliminary request to retrieve an access token with which to authenticate the HTTP request.
- In the Connection section, click the plus icon (+).
- Select HTTP.
- Enter a Connection Name.
- From the Authentication Type dropdown, select HTTP Request Auth.
Configure the preliminary access token request:
- In the Access token request section, under Secret Type, enter a Token Name and Token Value. You can enter multiple tokens.
- Under Request Setup, enter a Variable Reference Path. This is the path through which your access token is returned after making the authentication call. For example, if the access token is returned as the body of the access request, use
body
. If the access token is returned in a property called token
of the response body
, use body.token
. Paths are case sensitive. - Optionally, enter a Refresh Interval. This is the duration until the access token expires, specified in seconds. When the token expires, the connection automatically requests a new access token. Setting an interval of
0
disables token refresh. - Enter the Request URL and specify the type of request as either GET or POST.
- Optionally, add additional Request Headers, URL parameters and a Body to the request.
Configure the authentication request:
- In the Request details section, enter the Base URL for the authentication request. To reference your token in a header, parameter, or the request body, use
{{ accessToken }}
. For example: Authentication: Bearer {{ accessToken }}
. - Optionally, add additional Request Headers, URL parameters and a Body to your request.
- Click Create.
Create an HTTP mTLS connection
The Mutual TLS (mTLS) Auth connection allows you to use a private key and TLS certificate to authenticate the HTTP request.
The client certificate (.crt
, .pem
) and private key (.key
, .pem
) must use the PEM format.
- In the Connection section, click the plus icon (+).
- Select HTTP.
- Enter a Connection Name.
- From the Authentication Type dropdown, select mTLS Auth.
- Click Upload File to upload your Private Key.
- Click Upload File to upload your Certificate.
- Click Create.
A URL and request method are required for your request. Optionally, you can enter:
- URL parameters
- headers
- the content type
- a request body
- cookies
You can also select whether you want to allow expired certificates, or follow redirects.
Response options
Under Error on Status, enter a comma-delineated list of any status codes on which to return an error. Use the Response Parsing dropdown to override the default response parsing method inferred from the headers, and Response Encoding if the target server specifies the wrong encoding in its response headers.
The Expression and Function actions perform custom data transformations within your workflows using JavaScript. Use the values of any context variables available within your workflow as inputs for your JavaScript expressions and functions with the syntax $.Steps.<step_name>.<variable>
. You can also use _
to make use of Lodash in your data transformation actions with the same syntax. For example, to reference the HTTP request status variable (status
) from the HTTP request step (Make_request
), you’d use the following context variable:
$.Steps.Make_request.status
And to apply the _.includes
Lodash function on an array returned by a previous step Array_function
to determine if it includes the name Bits
, you’d use the following syntax:
_.includes($.Steps.Array_function.data, "Bits")
The data returned by these actions can then be referenced in subsequent steps of the workflow.
Expression
Use expression actions for data transformations that can be accomplished in a single line of code, and do not require variable assignments or multiple standalone operations. For example:
[1, 2, 3].filter(x => x < 3)
Function
The function action allows for variable assignments and data transformations requiring multiple expressions.
Testing expressions and functions
To test an expression or function action, click Test in the Inputs section. If the action uses an output variable from a previous step, comment out the variable in your code and replace it with test data. For example, consider the following action that assigns variables to the workflow name and to the Steps.List_monitors
output from a previous step:
let name = $.WorkflowName;
let object = $.Steps.List_monitors;
...
To test the action, comment out the existing variable assignments and replace them with hardcoded test data:
\\ let name = $.WorkflowName;
let name = 'Test workflow'
\\ let object = $.Steps.List_monitors;
let object = {0:{
'name': 'Test monitor'
}}
...
Documentation, liens et articles supplémentaires utiles: