diff --git a/examples/project.v1.test.js b/examples/project.v1.test.js index 75e48ff..5395e3b 100644 --- a/examples/project.v1.test.js +++ b/examples/project.v1.test.js @@ -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 = { @@ -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 = { diff --git a/project/v1.ts b/project/v1.ts index e5f0411..4048ef4 100644 --- a/project/v1.ts +++ b/project/v1.ts @@ -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 @@ -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 @@ -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 { @@ -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. */ @@ -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. */ @@ -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. */ @@ -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. */ @@ -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 { @@ -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. */ @@ -3449,11 +3489,11 @@ 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; @@ -3461,20 +3501,6 @@ namespace ProjectV1 { 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. */ diff --git a/test/integration/project.v1.test.js b/test/integration/project.v1.test.js index 6ed4086..8c6f63b 100644 --- a/test/integration/project.v1.test.js +++ b/test/integration/project.v1.test.js @@ -58,6 +58,7 @@ 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, }; @@ -65,7 +66,7 @@ describe('ProjectV1_integration', () => { const projectComplianceProfileModel = { id: 'testString', instance_id: 'testString', - instance_location: 'testString', + instance_location: 'us-south', attachment_id: 'testString', profile_name: 'testString', }; @@ -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', }; @@ -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, }; @@ -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', }; @@ -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 = { @@ -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 = { diff --git a/test/unit/project.v1.test.js b/test/unit/project.v1.test.js index aa492d1..29505b2 100644 --- a/test/unit/project.v1.test.js +++ b/test/unit/project.v1.test.js @@ -129,6 +129,7 @@ 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, }; @@ -136,7 +137,7 @@ describe('ProjectV1', () => { const projectComplianceProfileModel = { id: 'testString', instance_id: 'testString', - instance_location: 'testString', + instance_location: 'us-south', attachment_id: 'testString', profile_name: 'testString', }; @@ -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(); @@ -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, }; @@ -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(); @@ -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', }; @@ -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', }; @@ -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() { @@ -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() {