// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { PageCursorURL, PagePromise } from '../../core/pagination'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Agents defined by the company */ export class Deployments extends APIResource { /** * A list of deployments for an agent. * * @example HTTP * Representative request and response shapes. * ``` * GET /agents/{agent_id}/deployments/?after_sequence=0&limit=1 HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "results": [ * { * "source_revision_version": 0, * "source_digest": "string", * "deployment_id": "string", * "outcome": "string", * "stage": "string", * "is_active": false, * "diagnostics": [ * {} * ] * } * ], * "next_link": "string" * } * ``` */ list( agentID: string, query: DeploymentListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList( path`/agents/${agentID}/deployments/`, PageCursorURL, { query, ...options }, ); } /** * Deploy a source revision for an agent. * * @example HTTP * Representative request and response shapes. * ``` * POST /agents/{agent_id}/deployments/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "source_revision_id": "source_revision_id" * } * * HTTP/1.1 202 Accepted * Content-Type: application/json * * { * "source_revision_version": 0, * "source_digest": "string", * "deployment_id": "string", * "outcome": "string", * "stage": "string", * "is_active": false, * "diagnostics": [ * { * "severity": "string", * "message": "string", * "path": "string" * } * ] * } * ``` */ create( agentID: string, body: DeploymentCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post(path`/agents/${agentID}/deployments/`, { body, ...options }); } /** * Retrieve a deployment for an agent. * * @example HTTP * Representative request and response shapes. * ``` * GET /agents/{agent_id}/deployments/{deployment_id}/ HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "source_revision_version": 0, * "source_digest": "string", * "deployment_id": "string", * "outcome": "string", * "stage": "string", * "is_active": false, * "diagnostics": [ * { * "severity": "string", * "message": "string", * "path": "string" * } * ] * } * ``` */ retrieve( agentID: string, deploymentID: string, options?: RequestOptions, ): APIPromise { return this._client.get(path`/agents/${agentID}/deployments/${deploymentID}/`, options); } } export type DeploymentListResponsesPageCursorURL = PageCursorURL; export interface DeploymentListResponse { /** * The ID of the deployment */ deployment_id?: string; /** * Diagnostics emitted while creating the deployment */ diagnostics?: Array; /** * Whether the deployment is active */ is_active?: boolean; /** * The deployment outcome */ outcome?: string; /** * The digest of the deployed source revision */ source_digest?: string; /** * The source revision version deployed by the control plane */ source_revision_version?: number; /** * The deployment stage */ stage?: string; } export namespace DeploymentListResponse { export interface Diagnostic { /** * The diagnostic message */ message?: string; /** * The source path for the diagnostic */ path?: string; /** * The diagnostic severity */ severity?: string; } } export interface DeploymentCreateResponse { /** * The ID of the deployment */ deployment_id?: string; /** * Diagnostics emitted while creating the deployment */ diagnostics?: Array; /** * Whether the deployment is active */ is_active?: boolean; /** * The deployment outcome */ outcome?: string; /** * The digest of the deployed source revision */ source_digest?: string; /** * The source revision version deployed by the control plane */ source_revision_version?: number; /** * The deployment stage */ stage?: string; } export namespace DeploymentCreateResponse { export interface Diagnostic { /** * The diagnostic message */ message?: string; /** * The source path for the diagnostic */ path?: string; /** * The diagnostic severity */ severity?: string; } } export interface DeploymentRetrieveResponse { /** * The ID of the deployment */ deployment_id?: string; /** * Diagnostics emitted while creating the deployment */ diagnostics?: Array; /** * Whether the deployment is active */ is_active?: boolean; /** * The deployment outcome */ outcome?: string; /** * The digest of the deployed source revision */ source_digest?: string; /** * The source revision version deployed by the control plane */ source_revision_version?: number; /** * The deployment stage */ stage?: string; } export namespace DeploymentRetrieveResponse { export interface Diagnostic { /** * The diagnostic message */ message?: string; /** * The source path for the diagnostic */ path?: string; /** * The diagnostic severity */ severity?: string; } } export interface DeploymentListParams { /** * Only return results after this control-plane sequence number. */ after_sequence?: number; /** * The maximum number of results to return. */ limit?: number; } export interface DeploymentCreateParams { /** * The ID of the source revision to deploy */ source_revision_id: string; } export declare namespace Deployments { export { type DeploymentListResponse as DeploymentListResponse, type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentRetrieveResponse as DeploymentRetrieveResponse, type DeploymentListResponsesPageCursorURL as DeploymentListResponsesPageCursorURL, type DeploymentListParams as DeploymentListParams, type DeploymentCreateParams as DeploymentCreateParams, }; }