Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions examples/project.v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,22 +792,10 @@ describe('ProjectV1', () => {
value: 'cluster_id',
};

// StackDefinitionMemberInputPrototype
const stackDefinitionMemberInputPrototypeModel = {
name: 'region',
};

// StackDefinitionMemberPrototype
const stackDefinitionMemberPrototypeModel = {
name: 'foundation-deployable-architecture',
inputs: [stackDefinitionMemberInputPrototypeModel],
};

// StackDefinitionBlockPrototype
const stackDefinitionBlockPrototypeModel = {
inputs: [stackDefinitionInputVariableModel],
outputs: [stackDefinitionOutputVariableModel],
members: [stackDefinitionMemberPrototypeModel],
};

const params = {
Expand Down Expand Up @@ -880,21 +868,9 @@ describe('ProjectV1', () => {
hidden: false,
};

// StackDefinitionMemberInputPrototype
const stackDefinitionMemberInputPrototypeModel = {
name: 'cluster_name',
};

// StackDefinitionMemberPrototype
const stackDefinitionMemberPrototypeModel = {
name: 'foundation-deployable-architecture',
inputs: [stackDefinitionMemberInputPrototypeModel],
};

// StackDefinitionBlockPrototype
const stackDefinitionBlockPrototypeModel = {
inputs: [stackDefinitionInputVariableModel],
members: [stackDefinitionMemberPrototypeModel],
};

const params = {
Expand Down
68 changes: 47 additions & 21 deletions project/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ namespace ProjectV1 {
/** The definition of the project. */
definition: ProjectPrototypeDefinition;
/** The IBM Cloud location where a resource is deployed. */
location: string;
location: CreateProjectConstants.Location | string;
/** The resource group name where the project's data and tools are created. */
resourceGroup: string;
/** The project configurations. These configurations are included in the response of creating a project only if
Expand All @@ -1773,6 +1773,18 @@ namespace ProjectV1 {
headers?: OutgoingHttpHeaders;
}

/** Constants for the `createProject` operation. */
export namespace CreateProjectConstants {
/** The IBM Cloud location where a resource is deployed. */
export enum Location {
US_SOUTH = 'us-south',
US_EAST = 'us-east',
EU_GB = 'eu-gb',
EU_DE = 'eu-de',
CA_TOR = 'ca-tor',
}
}

/** Parameters for the `listProjects` operation. */
export interface ListProjectsParams {
/** The server uses this parameter to determine the first entry that is returned on the next page. If this
Expand Down Expand Up @@ -2611,12 +2623,24 @@ namespace ProjectV1 {
/** A unique ID for the instance of a compliance profile. */
instance_id?: string;
/** The location of the compliance instance. */
instance_location?: string;
instance_location?: ProjectComplianceProfile.Constants.InstanceLocation | string;
/** A unique ID for the attachment to a compliance profile. */
attachment_id?: string;
/** The name of the compliance profile. */
profile_name?: string;
}
export namespace ProjectComplianceProfile {
export namespace Constants {
/** The location of the compliance instance. */
export enum InstanceLocation {
US_SOUTH = 'us-south',
US_EAST = 'us-east',
EU_GB = 'eu-gb',
EU_DE = 'eu-de',
CA_TOR = 'ca-tor',
}
}
}

/** The standard schema of a project configuration. */
export interface ProjectConfig {
Expand Down Expand Up @@ -3152,6 +3176,8 @@ namespace ProjectV1 {
* project without providing a description.
*/
description: string;
/** A boolean flag to enable auto deploy. */
auto_deploy: boolean;
/** A boolean flag to enable automatic drift detection. Use this field to run a daily check to compare your
* configurations to your deployed resources to detect any difference.
*/
Expand All @@ -3164,6 +3190,18 @@ namespace ProjectV1 {
name: string;
}

/** The definition of the project. */
export interface ProjectDefinitionSummary {
/** The name of the project. It's unique within the account across regions. */
name: string;
/** The policy that indicates whether the resources are destroyed or not when a project is deleted. */
destroy_on_delete: boolean;
/** A brief explanation of the project's use in the configuration of a deployable architecture. You can create a
* project without providing a description.
*/
description: string;
}

/** The ID of the deleted project. */
export interface ProjectDeleteResponse {
/** The ID of the deleted project or configuration. */
Expand Down Expand Up @@ -3200,6 +3238,8 @@ namespace ProjectV1 {
name?: string;
/** The policy that indicates whether the resources are destroyed or not when a project is deleted. */
destroy_on_delete?: boolean;
/** A boolean flag to enable auto deploy. */
auto_deploy?: boolean;
/** A brief explanation of the project's use in the configuration of a deployable architecture. You can create a
* project without providing a description.
*/
Expand All @@ -3220,6 +3260,8 @@ namespace ProjectV1 {
* project without providing a description.
*/
description?: string;
/** A boolean flag to enable auto deploy. */
auto_deploy?: boolean;
/** A boolean flag to enable automatic drift detection. Use this field to run a daily check to compare your
* configurations to your deployed resources to detect any difference.
*/
Expand Down Expand Up @@ -3265,7 +3307,7 @@ namespace ProjectV1 {
/** A URL. */
href: string;
/** The definition of the project. */
definition: ProjectDefinitionProperties;
definition: ProjectDefinitionSummary;
}
export namespace ProjectSummary {
export namespace Constants {
Expand Down Expand Up @@ -3391,8 +3433,6 @@ namespace ProjectV1 {
inputs?: StackDefinitionInputVariable[];
/** The outputs associated with this stack definition. */
outputs?: StackDefinitionOutputVariable[];
/** Defines the member deployable architectures that are included in your stack. */
members?: StackDefinitionMemberPrototype[];
}

/** The payload for the stack definition export request. */
Expand Down Expand Up @@ -3449,32 +3489,18 @@ namespace ProjectV1 {
name: string;
/** The version locator of the member deployable architecture. */
version_locator: string;
/** The member input names to use for the stack definition. */
/** The member inputs to use for the stack definition. */
inputs?: StackDefinitionMemberInput[];
}

/** The member input definition. */
/** StackDefinitionMemberInput. */
export interface StackDefinitionMemberInput {
/** The member input name to use. */
name: string;
/** The value of the stack definition output. */
value: any;
}

/** The member input definition. */
export interface StackDefinitionMemberInputPrototype {
/** The member input name to use. */
name: string;
}

/** Defines the input values from member deployable architectures that are included in the catalog entry when the stack is exported to a private catalog. */
export interface StackDefinitionMemberPrototype {
/** The name matching the alias in the stack definition. */
name: string;
/** The member input names to use for the deployable architecture stack definition. */
inputs?: StackDefinitionMemberInputPrototype[];
}

/** The configuration reference. */
export interface StackDefinitionMetadataConfiguration {
/** The unique ID. */
Expand Down
32 changes: 5 additions & 27 deletions test/integration/project.v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ describe('ProjectV1_integration', () => {
name: 'acme-microservice',
destroy_on_delete: true,
description: 'A microservice to deploy on top of ACME infrastructure.',
auto_deploy: false,
monitoring_enabled: false,
};

// ProjectComplianceProfile
const projectComplianceProfileModel = {
id: 'testString',
instance_id: 'testString',
instance_location: 'testString',
instance_location: 'us-south',
attachment_id: 'testString',
profile_name: 'testString',
};
Expand Down Expand Up @@ -138,7 +139,7 @@ describe('ProjectV1_integration', () => {
const projectComplianceProfileModel = {
id: 'testString',
instance_id: 'testString',
instance_location: 'testString',
instance_location: 'us-south',
attachment_id: 'testString',
profile_name: 'testString',
};
Expand Down Expand Up @@ -241,6 +242,7 @@ describe('ProjectV1_integration', () => {
const projectPatchDefinitionBlockModel = {
name: 'acme-microservice',
destroy_on_delete: true,
auto_deploy: true,
description: 'A microservice to deploy on top of ACME infrastructure.',
monitoring_enabled: true,
};
Expand Down Expand Up @@ -440,7 +442,7 @@ describe('ProjectV1_integration', () => {
const projectComplianceProfileModel = {
id: 'testString',
instance_id: 'testString',
instance_location: 'testString',
instance_location: 'us-south',
attachment_id: 'testString',
profile_name: 'testString',
};
Expand Down Expand Up @@ -596,22 +598,10 @@ describe('ProjectV1_integration', () => {
value: 'cluster_id',
};

// StackDefinitionMemberInputPrototype
const stackDefinitionMemberInputPrototypeModel = {
name: 'region',
};

// StackDefinitionMemberPrototype
const stackDefinitionMemberPrototypeModel = {
name: 'foundation-deployable-architecture',
inputs: [stackDefinitionMemberInputPrototypeModel],
};

// StackDefinitionBlockPrototype
const stackDefinitionBlockPrototypeModel = {
inputs: [stackDefinitionInputVariableModel],
outputs: [stackDefinitionOutputVariableModel],
members: [stackDefinitionMemberPrototypeModel],
};

const params = {
Expand Down Expand Up @@ -657,22 +647,10 @@ describe('ProjectV1_integration', () => {
value: 'testString',
};

// StackDefinitionMemberInputPrototype
const stackDefinitionMemberInputPrototypeModel = {
name: 'cluster_name',
};

// StackDefinitionMemberPrototype
const stackDefinitionMemberPrototypeModel = {
name: 'foundation-deployable-architecture',
inputs: [stackDefinitionMemberInputPrototypeModel],
};

// StackDefinitionBlockPrototype
const stackDefinitionBlockPrototypeModel = {
inputs: [stackDefinitionInputVariableModel],
outputs: [stackDefinitionOutputVariableModel],
members: [stackDefinitionMemberPrototypeModel],
};

const params = {
Expand Down
40 changes: 9 additions & 31 deletions test/unit/project.v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ describe('ProjectV1', () => {
name: 'acme-microservice',
destroy_on_delete: true,
description: 'A microservice to deploy on top of ACME infrastructure.',
auto_deploy: false,
monitoring_enabled: false,
};

// ProjectComplianceProfile
const projectComplianceProfileModel = {
id: 'testString',
instance_id: 'testString',
instance_location: 'testString',
instance_location: 'us-south',
attachment_id: 'testString',
profile_name: 'testString',
};
Expand Down Expand Up @@ -355,9 +356,9 @@ describe('ProjectV1', () => {
const serviceUrl = projectServiceOptions.url;
const path = '/v1/projects';
const mockPagerResponse1 =
'{"next":{"href":"https://myhost.com/somePath?token=1"},"projects":[{"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::","created_at":"2019-01-01T12:00:00.000Z","cumulative_needs_attention_view":[{"event":"event","event_id":"event_id","config_id":"config_id","config_version":14}],"cumulative_needs_attention_view_error":false,"id":"id","location":"location","resource_group_id":"resource_group_id","state":"ready","href":"href","definition":{"name":"name","destroy_on_delete":false,"description":"description","monitoring_enabled":false}}],"total_count":2,"limit":1}';
'{"next":{"href":"https://myhost.com/somePath?token=1"},"projects":[{"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::","created_at":"2019-01-01T12:00:00.000Z","cumulative_needs_attention_view":[{"event":"event","event_id":"event_id","config_id":"config_id","config_version":14}],"cumulative_needs_attention_view_error":false,"id":"id","location":"location","resource_group_id":"resource_group_id","state":"ready","href":"href","definition":{"name":"name","destroy_on_delete":false,"description":"description"}}],"total_count":2,"limit":1}';
const mockPagerResponse2 =
'{"projects":[{"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::","created_at":"2019-01-01T12:00:00.000Z","cumulative_needs_attention_view":[{"event":"event","event_id":"event_id","config_id":"config_id","config_version":14}],"cumulative_needs_attention_view_error":false,"id":"id","location":"location","resource_group_id":"resource_group_id","state":"ready","href":"href","definition":{"name":"name","destroy_on_delete":false,"description":"description","monitoring_enabled":false}}],"total_count":2,"limit":1}';
'{"projects":[{"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::","created_at":"2019-01-01T12:00:00.000Z","cumulative_needs_attention_view":[{"event":"event","event_id":"event_id","config_id":"config_id","config_version":14}],"cumulative_needs_attention_view_error":false,"id":"id","location":"location","resource_group_id":"resource_group_id","state":"ready","href":"href","definition":{"name":"name","destroy_on_delete":false,"description":"description"}}],"total_count":2,"limit":1}';

beforeEach(() => {
unmock_createRequest();
Expand Down Expand Up @@ -492,6 +493,7 @@ describe('ProjectV1', () => {
const projectPatchDefinitionBlockModel = {
name: 'acme-microservice',
destroy_on_delete: true,
auto_deploy: true,
description: 'A microservice to deploy on top of ACME infrastructure.',
monitoring_enabled: true,
};
Expand Down Expand Up @@ -880,9 +882,9 @@ describe('ProjectV1', () => {
const serviceUrl = projectServiceOptions.url;
const path = '/v1/projects/testString/environments';
const mockPagerResponse1 =
'{"next":{"href":"https://myhost.com/somePath?token=1"},"environments":[{"id":"id","project":{"id":"id","href":"href","definition":{"name":"name"},"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"},"created_at":"2019-01-01T12:00:00.000Z","target_account":"target_account","modified_at":"2019-01-01T12:00:00.000Z","href":"href","definition":{"description":"description","name":"name","authorizations":{"trusted_profile_id":"trusted_profile_id","method":"api_key","api_key":"api_key"},"inputs":{"anyKey":"anyValue"},"compliance_profile":{"id":"id","instance_id":"instance_id","instance_location":"instance_location","attachment_id":"attachment_id","profile_name":"profile_name"}}}],"total_count":2,"limit":1}';
'{"next":{"href":"https://myhost.com/somePath?token=1"},"environments":[{"id":"id","project":{"id":"id","href":"href","definition":{"name":"name"},"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"},"created_at":"2019-01-01T12:00:00.000Z","target_account":"target_account","modified_at":"2019-01-01T12:00:00.000Z","href":"href","definition":{"description":"description","name":"name","authorizations":{"trusted_profile_id":"trusted_profile_id","method":"api_key","api_key":"api_key"},"inputs":{"anyKey":"anyValue"},"compliance_profile":{"id":"id","instance_id":"instance_id","instance_location":"us-south","attachment_id":"attachment_id","profile_name":"profile_name"}}}],"total_count":2,"limit":1}';
const mockPagerResponse2 =
'{"environments":[{"id":"id","project":{"id":"id","href":"href","definition":{"name":"name"},"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"},"created_at":"2019-01-01T12:00:00.000Z","target_account":"target_account","modified_at":"2019-01-01T12:00:00.000Z","href":"href","definition":{"description":"description","name":"name","authorizations":{"trusted_profile_id":"trusted_profile_id","method":"api_key","api_key":"api_key"},"inputs":{"anyKey":"anyValue"},"compliance_profile":{"id":"id","instance_id":"instance_id","instance_location":"instance_location","attachment_id":"attachment_id","profile_name":"profile_name"}}}],"total_count":2,"limit":1}';
'{"environments":[{"id":"id","project":{"id":"id","href":"href","definition":{"name":"name"},"crn":"crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"},"created_at":"2019-01-01T12:00:00.000Z","target_account":"target_account","modified_at":"2019-01-01T12:00:00.000Z","href":"href","definition":{"description":"description","name":"name","authorizations":{"trusted_profile_id":"trusted_profile_id","method":"api_key","api_key":"api_key"},"inputs":{"anyKey":"anyValue"},"compliance_profile":{"id":"id","instance_id":"instance_id","instance_location":"us-south","attachment_id":"attachment_id","profile_name":"profile_name"}}}],"total_count":2,"limit":1}';

beforeEach(() => {
unmock_createRequest();
Expand Down Expand Up @@ -1248,7 +1250,7 @@ describe('ProjectV1', () => {
const projectComplianceProfileModel = {
id: 'testString',
instance_id: 'testString',
instance_location: 'testString',
instance_location: 'us-south',
attachment_id: 'testString',
profile_name: 'testString',
};
Expand Down Expand Up @@ -1612,7 +1614,7 @@ describe('ProjectV1', () => {
const projectComplianceProfileModel = {
id: 'testString',
instance_id: 'testString',
instance_location: 'testString',
instance_location: 'us-south',
attachment_id: 'testString',
profile_name: 'testString',
};
Expand Down Expand Up @@ -2514,22 +2516,10 @@ describe('ProjectV1', () => {
value: 'cluster_id',
};

// StackDefinitionMemberInputPrototype
const stackDefinitionMemberInputPrototypeModel = {
name: 'region',
};

// StackDefinitionMemberPrototype
const stackDefinitionMemberPrototypeModel = {
name: 'foundation-deployable-architecture',
inputs: [stackDefinitionMemberInputPrototypeModel],
};

// StackDefinitionBlockPrototype
const stackDefinitionBlockPrototypeModel = {
inputs: [stackDefinitionInputVariableModel],
outputs: [stackDefinitionOutputVariableModel],
members: [stackDefinitionMemberPrototypeModel],
};

function __createStackDefinitionTest() {
Expand Down Expand Up @@ -2744,22 +2734,10 @@ describe('ProjectV1', () => {
value: 'testString',
};

// StackDefinitionMemberInputPrototype
const stackDefinitionMemberInputPrototypeModel = {
name: 'cluster_name',
};

// StackDefinitionMemberPrototype
const stackDefinitionMemberPrototypeModel = {
name: 'foundation-deployable-architecture',
inputs: [stackDefinitionMemberInputPrototypeModel],
};

// StackDefinitionBlockPrototype
const stackDefinitionBlockPrototypeModel = {
inputs: [stackDefinitionInputVariableModel],
outputs: [stackDefinitionOutputVariableModel],
members: [stackDefinitionMemberPrototypeModel],
};

function __updateStackDefinitionTest() {
Expand Down