Skip to content

Commit

Permalink
Add .cmd to deployment config
Browse files Browse the repository at this point in the history
  • Loading branch information
alii committed Dec 28, 2022
1 parent b74b4a8 commit 7a0237d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
18 changes: 12 additions & 6 deletions src/rest/types/ignite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
HopShDomain,
Id,
InternalHopDomain,
MakeOptional,
Timestamp,
} from '../../util/types.js';
import {Endpoint} from '../endpoints.js';
Expand Down Expand Up @@ -433,9 +434,9 @@ export type DeploymentRollout = {
acknowledged: boolean;
};

// This is a type not an interface so we can make a union
// when future versions of deployment configs come out
export type DeploymentConfig = {
export type CreateDeploymentConfig = MakeOptional<DeploymentConfig, 'cmd'>;

export interface DeploymentConfig {
/**
* The name of the deployment
*/
Expand All @@ -458,7 +459,12 @@ export type DeploymentConfig = {
/**
* The version of this config
*/
version: '2022-05-17';
version: '12-12-2022';

/**
* Entrypoint command for the image
*/
cmd: string[];

/**
* The docker image config for this deployment
Expand Down Expand Up @@ -491,7 +497,7 @@ export type DeploymentConfig = {
* Entrypoint for this deployment
*/
entrypoint?: string[];
};
}

/**
* Docker image config
Expand Down Expand Up @@ -766,7 +772,7 @@ export type IgniteEndpoints =
'POST',
'/v1/ignite/deployments',
{deployment: Deployment},
DeploymentConfig
CreateDeploymentConfig
>
| Endpoint<'DELETE', '/v1/ignite/deployments/:deployment_id', Empty>
| Endpoint<'DELETE', '/v1/ignite/containers/:container_id', Empty>
Expand Down
10 changes: 5 additions & 5 deletions src/sdks/ignite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const ignite = sdk(client => {
*/
async function createDeployment(
configOrProject: Id<'project'>,
bearerOrPatConfig: API.Ignite.DeploymentConfig,
bearerOrPatConfig: API.Ignite.CreateDeploymentConfig,
): Promise<Infer<typeof Deployments>>;

/**
Expand All @@ -76,14 +76,14 @@ export const ignite = sdk(client => {
* @param configOrProject The config for this deployment.
*/
async function createDeployment(
configOrProject: API.Ignite.DeploymentConfig,
configOrProject: API.Ignite.CreateDeploymentConfig,
): Promise<Infer<typeof Deployments>>;

async function createDeployment(
configOrProject: Id<'project'> | API.Ignite.DeploymentConfig,
bearerOrPatConfig?: API.Ignite.DeploymentConfig,
configOrProject: Id<'project'> | API.Ignite.CreateDeploymentConfig,
bearerOrPatConfig?: API.Ignite.CreateDeploymentConfig,
): Promise<Infer<typeof Deployments>> {
let config: API.Ignite.DeploymentConfig;
let config: API.Ignite.CreateDeploymentConfig;
let project: Id<'project'> | undefined = undefined;

if (typeof configOrProject === 'object') {
Expand Down
3 changes: 3 additions & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';

export type Empty = void;

export type MakeOptional<T, K extends keyof T> = Omit<T, K> &
Partial<Pick<T, K>>;

export type Tag<T, Name extends string> = T & {
/**
* Mark a type as having a specific name in the API
Expand Down

1 comment on commit 7a0237d

@vercel
Copy link

@vercel vercel bot commented on 7a0237d Dec 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hop-js – ./

hop-js-git-master-onehop.vercel.app
hop-js-onehop.vercel.app
js.hop.io
hop-js.vercel.app

Please sign in to comment.