@datadog/datadog-api-client
Version:
OpenAPI client for Datadog APIs
218 lines (217 loc) • 10.2 kB
TypeScript
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi";
import { Configuration } from "../../datadog-api-client-common/configuration";
import { RequestContext, ResponseContext } from "../../datadog-api-client-common/http/http";
import { TagPoliciesListResponse } from "../models/TagPoliciesListResponse";
import { TagPolicyCreateRequest } from "../models/TagPolicyCreateRequest";
import { TagPolicyInclude } from "../models/TagPolicyInclude";
import { TagPolicyResponse } from "../models/TagPolicyResponse";
import { TagPolicyScoreResponse } from "../models/TagPolicyScoreResponse";
import { TagPolicySource } from "../models/TagPolicySource";
import { TagPolicyUpdateRequest } from "../models/TagPolicyUpdateRequest";
export declare class TagPoliciesApiRequestFactory extends BaseAPIRequestFactory {
createTagPolicy(body: TagPolicyCreateRequest, _options?: Configuration): Promise<RequestContext>;
deleteTagPolicy(policyId: string, hardDelete?: boolean, _options?: Configuration): Promise<RequestContext>;
getTagPolicy(policyId: string, include?: TagPolicyInclude, tsStart?: number, tsEnd?: number, _options?: Configuration): Promise<RequestContext>;
getTagPolicyScore(policyId: string, tsStart?: number, tsEnd?: number, _options?: Configuration): Promise<RequestContext>;
listTagPolicies(includeDisabled?: boolean, includeDeleted?: boolean, include?: TagPolicyInclude, filterSource?: TagPolicySource, tsStart?: number, tsEnd?: number, _options?: Configuration): Promise<RequestContext>;
updateTagPolicy(policyId: string, body: TagPolicyUpdateRequest, _options?: Configuration): Promise<RequestContext>;
}
export declare class TagPoliciesApiResponseProcessor {
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to createTagPolicy
* @throws ApiException if the response code was not in [200, 299]
*/
createTagPolicy(response: ResponseContext): Promise<TagPolicyResponse>;
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to deleteTagPolicy
* @throws ApiException if the response code was not in [200, 299]
*/
deleteTagPolicy(response: ResponseContext): Promise<void>;
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getTagPolicy
* @throws ApiException if the response code was not in [200, 299]
*/
getTagPolicy(response: ResponseContext): Promise<TagPolicyResponse>;
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getTagPolicyScore
* @throws ApiException if the response code was not in [200, 299]
*/
getTagPolicyScore(response: ResponseContext): Promise<TagPolicyScoreResponse>;
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to listTagPolicies
* @throws ApiException if the response code was not in [200, 299]
*/
listTagPolicies(response: ResponseContext): Promise<TagPoliciesListResponse>;
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to updateTagPolicy
* @throws ApiException if the response code was not in [200, 299]
*/
updateTagPolicy(response: ResponseContext): Promise<TagPolicyResponse>;
}
export interface TagPoliciesApiCreateTagPolicyRequest {
/**
* @type TagPolicyCreateRequest
*/
body: TagPolicyCreateRequest;
}
export interface TagPoliciesApiDeleteTagPolicyRequest {
/**
* The unique identifier of the tag policy to delete.
* @type string
*/
policyId: string;
/**
* Whether to permanently delete the policy instead of performing a soft delete. Defaults to `false`.
* @type boolean
*/
hardDelete?: boolean;
}
export interface TagPoliciesApiGetTagPolicyRequest {
/**
* The unique identifier of the tag policy.
* @type string
*/
policyId: string;
/**
* Comma-separated list of related resources to include alongside the policy. Currently the only supported value is `score`.
* @type TagPolicyInclude
*/
include?: TagPolicyInclude;
/**
* Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
* @type number
*/
tsStart?: number;
/**
* End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`.
* @type number
*/
tsEnd?: number;
}
export interface TagPoliciesApiGetTagPolicyScoreRequest {
/**
* The unique identifier of the tag policy.
* @type string
*/
policyId: string;
/**
* Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
* @type number
*/
tsStart?: number;
/**
* End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`.
* @type number
*/
tsEnd?: number;
}
export interface TagPoliciesApiListTagPoliciesRequest {
/**
* Whether to include policies that are currently disabled. Defaults to `false`.
* @type boolean
*/
includeDisabled?: boolean;
/**
* Whether to include policies that have been soft-deleted. Defaults to `false`.
* @type boolean
*/
includeDeleted?: boolean;
/**
* Comma-separated list of related resources to include alongside each policy in the response. Currently the only supported value is `score`.
* @type TagPolicyInclude
*/
include?: TagPolicyInclude;
/**
* Restrict the result set to policies whose source matches the given value.
* @type TagPolicySource
*/
filterSource?: TagPolicySource;
/**
* Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to a recent window appropriate for the source.
* @type number
*/
tsStart?: number;
/**
* End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`.
* @type number
*/
tsEnd?: number;
}
export interface TagPoliciesApiUpdateTagPolicyRequest {
/**
* The unique identifier of the tag policy to update.
* @type string
*/
policyId: string;
/**
* @type TagPolicyUpdateRequest
*/
body: TagPolicyUpdateRequest;
}
export declare class TagPoliciesApi {
private requestFactory;
private responseProcessor;
private configuration;
constructor(configuration: Configuration, requestFactory?: TagPoliciesApiRequestFactory, responseProcessor?: TagPoliciesApiResponseProcessor);
/**
* Create a new tag policy for the organization. The caller's organization is derived from
* the authenticated user; cross-organization creation is not supported. Fields such as
* `policy_id`, `version`, and the timestamp/audit fields are assigned by the server.
* @param param The request object
*/
createTagPolicy(param: TagPoliciesApiCreateTagPolicyRequest, options?: Configuration): Promise<TagPolicyResponse>;
/**
* Delete a tag policy. By default the policy is soft-deleted so it can be recovered later
* and so that historical score data remains queryable. Pass `hard_delete=true` to remove
* the policy permanently.
* @param param The request object
*/
deleteTagPolicy(param: TagPoliciesApiDeleteTagPolicyRequest, options?: Configuration): Promise<void>;
/**
* Retrieve a single tag policy by ID. Optionally include the policy's current compliance
* score via the `include=score` query parameter. Policies belonging to other organizations
* cannot be retrieved.
* @param param The request object
*/
getTagPolicy(param: TagPoliciesApiGetTagPolicyRequest, options?: Configuration): Promise<TagPolicyResponse>;
/**
* Retrieve the compliance score for a single tag policy. The score is computed over the
* requested time window (or a source-appropriate default) and represents the percentage of
* telemetry within that window that conforms to the policy. A `null` score indicates that
* no relevant telemetry was found.
* @param param The request object
*/
getTagPolicyScore(param: TagPoliciesApiGetTagPolicyScoreRequest, options?: Configuration): Promise<TagPolicyScoreResponse>;
/**
* Retrieve all tag policies for the organization. Optionally include disabled or deleted
* policies, filter by telemetry source, and include each policy's current compliance score
* via the `include=score` query parameter.
* @param param The request object
*/
listTagPolicies(param?: TagPoliciesApiListTagPoliciesRequest, options?: Configuration): Promise<TagPoliciesListResponse>;
/**
* Update one or more attributes of an existing tag policy. Only the fields supplied in the
* request body are modified; omitted fields retain their current values. The policy's
* `source` cannot be changed after creation.
* @param param The request object
*/
updateTagPolicy(param: TagPoliciesApiUpdateTagPolicyRequest, options?: Configuration): Promise<TagPolicyResponse>;
}