diff --git a/projectv1/project_v1.go b/projectv1/project_v1.go index 6396934..b6e1f93 100644 --- a/projectv1/project_v1.go +++ b/projectv1/project_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.79.0-2eb6af3d-20230905-174838 + * IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553 */ // Package projectv1 : Operations and models for the ProjectV1 service @@ -474,6 +474,329 @@ func (project *ProjectV1) DeleteProjectWithContext(ctx context.Context, deletePr return } +// CreateProjectEnvironment : Create an environment +// Create an environment. +func (project *ProjectV1) CreateProjectEnvironment(createProjectEnvironmentOptions *CreateProjectEnvironmentOptions) (result *Environment, response *core.DetailedResponse, err error) { + return project.CreateProjectEnvironmentWithContext(context.Background(), createProjectEnvironmentOptions) +} + +// CreateProjectEnvironmentWithContext is an alternate form of the CreateProjectEnvironment method which supports a Context parameter +func (project *ProjectV1) CreateProjectEnvironmentWithContext(ctx context.Context, createProjectEnvironmentOptions *CreateProjectEnvironmentOptions) (result *Environment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createProjectEnvironmentOptions, "createProjectEnvironmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createProjectEnvironmentOptions, "createProjectEnvironmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *createProjectEnvironmentOptions.ProjectID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/environments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createProjectEnvironmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "CreateProjectEnvironment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createProjectEnvironmentOptions.Definition != nil { + body["definition"] = createProjectEnvironmentOptions.Definition + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = project.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEnvironment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListProjectEnvironments : List environments +// Returns all environments. +func (project *ProjectV1) ListProjectEnvironments(listProjectEnvironmentsOptions *ListProjectEnvironmentsOptions) (result *EnvironmentListResponse, response *core.DetailedResponse, err error) { + return project.ListProjectEnvironmentsWithContext(context.Background(), listProjectEnvironmentsOptions) +} + +// ListProjectEnvironmentsWithContext is an alternate form of the ListProjectEnvironments method which supports a Context parameter +func (project *ProjectV1) ListProjectEnvironmentsWithContext(ctx context.Context, listProjectEnvironmentsOptions *ListProjectEnvironmentsOptions) (result *EnvironmentListResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listProjectEnvironmentsOptions, "listProjectEnvironmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listProjectEnvironmentsOptions, "listProjectEnvironmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *listProjectEnvironmentsOptions.ProjectID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/environments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listProjectEnvironmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "ListProjectEnvironments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = project.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEnvironmentListResponse) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetProjectEnvironment : Get an environment +// Returns an environment. +func (project *ProjectV1) GetProjectEnvironment(getProjectEnvironmentOptions *GetProjectEnvironmentOptions) (result *Environment, response *core.DetailedResponse, err error) { + return project.GetProjectEnvironmentWithContext(context.Background(), getProjectEnvironmentOptions) +} + +// GetProjectEnvironmentWithContext is an alternate form of the GetProjectEnvironment method which supports a Context parameter +func (project *ProjectV1) GetProjectEnvironmentWithContext(ctx context.Context, getProjectEnvironmentOptions *GetProjectEnvironmentOptions) (result *Environment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getProjectEnvironmentOptions, "getProjectEnvironmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getProjectEnvironmentOptions, "getProjectEnvironmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *getProjectEnvironmentOptions.ProjectID, + "id": *getProjectEnvironmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/environments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getProjectEnvironmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "GetProjectEnvironment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = project.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEnvironment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateProjectEnvironment : Update an environment +// Update an environment by the ID. +func (project *ProjectV1) UpdateProjectEnvironment(updateProjectEnvironmentOptions *UpdateProjectEnvironmentOptions) (result *Environment, response *core.DetailedResponse, err error) { + return project.UpdateProjectEnvironmentWithContext(context.Background(), updateProjectEnvironmentOptions) +} + +// UpdateProjectEnvironmentWithContext is an alternate form of the UpdateProjectEnvironment method which supports a Context parameter +func (project *ProjectV1) UpdateProjectEnvironmentWithContext(ctx context.Context, updateProjectEnvironmentOptions *UpdateProjectEnvironmentOptions) (result *Environment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateProjectEnvironmentOptions, "updateProjectEnvironmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateProjectEnvironmentOptions, "updateProjectEnvironmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *updateProjectEnvironmentOptions.ProjectID, + "id": *updateProjectEnvironmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/environments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateProjectEnvironmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "UpdateProjectEnvironment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateProjectEnvironmentOptions.Definition != nil { + body["definition"] = updateProjectEnvironmentOptions.Definition + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = project.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEnvironment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteProjectEnvironment : Delete an environment +// Delete an environment in a project by ID. +func (project *ProjectV1) DeleteProjectEnvironment(deleteProjectEnvironmentOptions *DeleteProjectEnvironmentOptions) (result *EnvironmentDeleteResponse, response *core.DetailedResponse, err error) { + return project.DeleteProjectEnvironmentWithContext(context.Background(), deleteProjectEnvironmentOptions) +} + +// DeleteProjectEnvironmentWithContext is an alternate form of the DeleteProjectEnvironment method which supports a Context parameter +func (project *ProjectV1) DeleteProjectEnvironmentWithContext(ctx context.Context, deleteProjectEnvironmentOptions *DeleteProjectEnvironmentOptions) (result *EnvironmentDeleteResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteProjectEnvironmentOptions, "deleteProjectEnvironmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteProjectEnvironmentOptions, "deleteProjectEnvironmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *deleteProjectEnvironmentOptions.ProjectID, + "id": *deleteProjectEnvironmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/environments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteProjectEnvironmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "DeleteProjectEnvironment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = project.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEnvironmentDeleteResponse) + if err != nil { + return + } + response.Result = result + } + + return +} + // CreateConfig : Add a new configuration // Add a new configuration to a project. func (project *ProjectV1) CreateConfig(createConfigOptions *CreateConfigOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { @@ -518,6 +841,9 @@ func (project *ProjectV1) CreateConfigWithContext(ctx context.Context, createCon if createConfigOptions.Definition != nil { body["definition"] = createConfigOptions.Definition } + if createConfigOptions.Schematics != nil { + body["schematics"] = createConfigOptions.Schematics + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -800,12 +1126,12 @@ func (project *ProjectV1) DeleteConfigWithContext(ctx context.Context, deleteCon // ForceApprove : Force approve project configuration // Force approve configuration edits to the main configuration with an approving comment. -func (project *ProjectV1) ForceApprove(forceApproveOptions *ForceApproveOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) ForceApprove(forceApproveOptions *ForceApproveOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { return project.ForceApproveWithContext(context.Background(), forceApproveOptions) } // ForceApproveWithContext is an alternate form of the ForceApprove method which supports a Context parameter -func (project *ProjectV1) ForceApproveWithContext(ctx context.Context, forceApproveOptions *ForceApproveOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) ForceApproveWithContext(ctx context.Context, forceApproveOptions *ForceApproveOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(forceApproveOptions, "forceApproveOptions cannot be nil") if err != nil { return @@ -859,7 +1185,7 @@ func (project *ProjectV1) ForceApproveWithContext(ctx context.Context, forceAppr return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfig) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfigVersion) if err != nil { return } @@ -871,12 +1197,12 @@ func (project *ProjectV1) ForceApproveWithContext(ctx context.Context, forceAppr // Approve : Approve and merge a configuration draft // Approve and merge configuration edits to the main configuration. -func (project *ProjectV1) Approve(approveOptions *ApproveOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) Approve(approveOptions *ApproveOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { return project.ApproveWithContext(context.Background(), approveOptions) } // ApproveWithContext is an alternate form of the Approve method which supports a Context parameter -func (project *ProjectV1) ApproveWithContext(ctx context.Context, approveOptions *ApproveOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) ApproveWithContext(ctx context.Context, approveOptions *ApproveOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(approveOptions, "approveOptions cannot be nil") if err != nil { return @@ -930,7 +1256,7 @@ func (project *ProjectV1) ApproveWithContext(ctx context.Context, approveOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfig) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfigVersion) if err != nil { return } @@ -943,12 +1269,12 @@ func (project *ProjectV1) ApproveWithContext(ctx context.Context, approveOptions // ValidateConfig : Run a validation check // Run a validation check on a given configuration in project. The check includes creating or updating the associated // schematics workspace with a plan job, running the CRA scans, and cost estimatation. -func (project *ProjectV1) ValidateConfig(validateConfigOptions *ValidateConfigOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) ValidateConfig(validateConfigOptions *ValidateConfigOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { return project.ValidateConfigWithContext(context.Background(), validateConfigOptions) } // ValidateConfigWithContext is an alternate form of the ValidateConfig method which supports a Context parameter -func (project *ProjectV1) ValidateConfigWithContext(ctx context.Context, validateConfigOptions *ValidateConfigOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) ValidateConfigWithContext(ctx context.Context, validateConfigOptions *ValidateConfigOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(validateConfigOptions, "validateConfigOptions cannot be nil") if err != nil { return @@ -995,7 +1321,7 @@ func (project *ProjectV1) ValidateConfigWithContext(ctx context.Context, validat return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfig) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfigVersion) if err != nil { return } @@ -1008,12 +1334,12 @@ func (project *ProjectV1) ValidateConfigWithContext(ctx context.Context, validat // DeployConfig : Deploy a configuration // Deploy a project's configuration. It's an asynchronous operation that can be tracked using the get project // configuration API with full metadata. -func (project *ProjectV1) DeployConfig(deployConfigOptions *DeployConfigOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) DeployConfig(deployConfigOptions *DeployConfigOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { return project.DeployConfigWithContext(context.Background(), deployConfigOptions) } // DeployConfigWithContext is an alternate form of the DeployConfig method which supports a Context parameter -func (project *ProjectV1) DeployConfigWithContext(ctx context.Context, deployConfigOptions *DeployConfigOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) DeployConfigWithContext(ctx context.Context, deployConfigOptions *DeployConfigOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deployConfigOptions, "deployConfigOptions cannot be nil") if err != nil { return @@ -1057,7 +1383,7 @@ func (project *ProjectV1) DeployConfigWithContext(ctx context.Context, deployCon return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfig) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfigVersion) if err != nil { return } @@ -1159,8 +1485,8 @@ func (project *ProjectV1) SyncConfigWithContext(ctx context.Context, syncConfigO builder.AddHeader("Content-Type", "application/json") body := make(map[string]interface{}) - if syncConfigOptions.WorkspaceID != nil { - body["workspace_id"] = syncConfigOptions.WorkspaceID + if syncConfigOptions.Schematics != nil { + body["schematics"] = syncConfigOptions.Schematics } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -1301,12 +1627,12 @@ func (project *ProjectV1) ListConfigVersionsWithContext(ctx context.Context, lis // GetConfigVersion : Get a specific version of a project configuration // Returns a specific version of a project configuration in a specific project. -func (project *ProjectV1) GetConfigVersion(getConfigVersionOptions *GetConfigVersionOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) GetConfigVersion(getConfigVersionOptions *GetConfigVersionOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { return project.GetConfigVersionWithContext(context.Background(), getConfigVersionOptions) } // GetConfigVersionWithContext is an alternate form of the GetConfigVersion method which supports a Context parameter -func (project *ProjectV1) GetConfigVersionWithContext(ctx context.Context, getConfigVersionOptions *GetConfigVersionOptions) (result *ProjectConfig, response *core.DetailedResponse, err error) { +func (project *ProjectV1) GetConfigVersionWithContext(ctx context.Context, getConfigVersionOptions *GetConfigVersionOptions) (result *ProjectConfigVersion, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getConfigVersionOptions, "getConfigVersionOptions cannot be nil") if err != nil { return @@ -1351,7 +1677,7 @@ func (project *ProjectV1) GetConfigVersionWithContext(ctx context.Context, getCo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfig) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProjectConfigVersion) if err != nil { return } @@ -1563,6 +1889,9 @@ type CreateConfigOptions struct { // The name and description of a project configuration. Definition *ProjectConfigPrototypeDefinitionBlock `json:"definition" validate:"required"` + // A schematics workspace associated to a project configuration. + Schematics *SchematicsWorkspace `json:"schematics,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -1587,12 +1916,56 @@ func (_options *CreateConfigOptions) SetDefinition(definition *ProjectConfigProt return _options } +// SetSchematics : Allow user to set Schematics +func (_options *CreateConfigOptions) SetSchematics(schematics *SchematicsWorkspace) *CreateConfigOptions { + _options.Schematics = schematics + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateConfigOptions) SetHeaders(param map[string]string) *CreateConfigOptions { options.Headers = param return options } +// CreateProjectEnvironmentOptions : The CreateProjectEnvironment options. +type CreateProjectEnvironmentOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The environment definition. + Definition *EnvironmentDefinitionRequiredProperties `json:"definition" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateProjectEnvironmentOptions : Instantiate CreateProjectEnvironmentOptions +func (*ProjectV1) NewCreateProjectEnvironmentOptions(projectID string, definition *EnvironmentDefinitionRequiredProperties) *CreateProjectEnvironmentOptions { + return &CreateProjectEnvironmentOptions{ + ProjectID: core.StringPtr(projectID), + Definition: definition, + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *CreateProjectEnvironmentOptions) SetProjectID(projectID string) *CreateProjectEnvironmentOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetDefinition : Allow user to set Definition +func (_options *CreateProjectEnvironmentOptions) SetDefinition(definition *EnvironmentDefinitionRequiredProperties) *CreateProjectEnvironmentOptions { + _options.Definition = definition + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateProjectEnvironmentOptions) SetHeaders(param map[string]string) *CreateProjectEnvironmentOptions { + options.Headers = param + return options +} + // CreateProjectOptions : The CreateProject options. type CreateProjectOptions struct { // The definition of the project. @@ -1757,88 +2130,344 @@ func (_options *DeleteConfigVersionOptions) SetProjectID(projectID string) *Dele return _options } -// SetID : Allow user to set ID -func (_options *DeleteConfigVersionOptions) SetID(id string) *DeleteConfigVersionOptions { - _options.ID = core.StringPtr(id) - return _options -} +// SetID : Allow user to set ID +func (_options *DeleteConfigVersionOptions) SetID(id string) *DeleteConfigVersionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVersion : Allow user to set Version +func (_options *DeleteConfigVersionOptions) SetVersion(version int64) *DeleteConfigVersionOptions { + _options.Version = core.Int64Ptr(version) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteConfigVersionOptions) SetHeaders(param map[string]string) *DeleteConfigVersionOptions { + options.Headers = param + return options +} + +// DeleteProjectEnvironmentOptions : The DeleteProjectEnvironment options. +type DeleteProjectEnvironmentOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The environment ID. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteProjectEnvironmentOptions : Instantiate DeleteProjectEnvironmentOptions +func (*ProjectV1) NewDeleteProjectEnvironmentOptions(projectID string, id string) *DeleteProjectEnvironmentOptions { + return &DeleteProjectEnvironmentOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *DeleteProjectEnvironmentOptions) SetProjectID(projectID string) *DeleteProjectEnvironmentOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteProjectEnvironmentOptions) SetID(id string) *DeleteProjectEnvironmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteProjectEnvironmentOptions) SetHeaders(param map[string]string) *DeleteProjectEnvironmentOptions { + options.Headers = param + return options +} + +// DeleteProjectOptions : The DeleteProject options. +type DeleteProjectOptions struct { + // The unique project ID. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteProjectOptions : Instantiate DeleteProjectOptions +func (*ProjectV1) NewDeleteProjectOptions(id string) *DeleteProjectOptions { + return &DeleteProjectOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteProjectOptions) SetID(id string) *DeleteProjectOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteProjectOptions) SetHeaders(param map[string]string) *DeleteProjectOptions { + options.Headers = param + return options +} + +// DeployConfigOptions : The DeployConfig options. +type DeployConfigOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The unique config ID. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeployConfigOptions : Instantiate DeployConfigOptions +func (*ProjectV1) NewDeployConfigOptions(projectID string, id string) *DeployConfigOptions { + return &DeployConfigOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *DeployConfigOptions) SetProjectID(projectID string) *DeployConfigOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeployConfigOptions) SetID(id string) *DeployConfigOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeployConfigOptions) SetHeaders(param map[string]string) *DeployConfigOptions { + options.Headers = param + return options +} + +// Environment : The definition of a project environment. +type Environment struct { + // The environment id as a friendly name. + ID *string `json:"id" validate:"required"` + + // The unique ID. + ProjectID *string `json:"project_id" validate:"required"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time + // format as specified by RFC 3339. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // An IBM Cloud resource name, which uniquely identifies a resource. + ProjectCrn *string `json:"project_crn" validate:"required"` + + // The target account ID derived from the authentication block values. + TargetAccount *string `json:"target_account,omitempty"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time + // format as specified by RFC 3339. + UserModifiedAt *strfmt.DateTime `json:"user_modified_at" validate:"required"` + + // The environment definition. + Definition *EnvironmentDefinitionRequiredProperties `json:"definition" validate:"required"` +} + +// UnmarshalEnvironment unmarshals an instance of Environment from the specified map of raw messages. +func UnmarshalEnvironment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Environment) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "project_id", &obj.ProjectID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "project_crn", &obj.ProjectCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_account", &obj.TargetAccount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_modified_at", &obj.UserModifiedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalEnvironmentDefinitionRequiredProperties) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EnvironmentDefinitionNameDescription : The environment definition used in the project collection. +type EnvironmentDefinitionNameDescription struct { + // The name of the environment. + Name *string `json:"name,omitempty"` + + // The description of the environment. + Description *string `json:"description,omitempty"` +} + +// UnmarshalEnvironmentDefinitionNameDescription unmarshals an instance of EnvironmentDefinitionNameDescription from the specified map of raw messages. +func UnmarshalEnvironmentDefinitionNameDescription(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnvironmentDefinitionNameDescription) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EnvironmentDefinitionProperties : The environment definition used for updates. +type EnvironmentDefinitionProperties struct { + // The name of the environment. + Name *string `json:"name,omitempty"` -// SetVersion : Allow user to set Version -func (_options *DeleteConfigVersionOptions) SetVersion(version int64) *DeleteConfigVersionOptions { - _options.Version = core.Int64Ptr(version) - return _options -} + // The description of the environment. + Description *string `json:"description,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeleteConfigVersionOptions) SetHeaders(param map[string]string) *DeleteConfigVersionOptions { - options.Headers = param - return options -} + // The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. + Authorizations *ProjectConfigAuth `json:"authorizations,omitempty"` -// DeleteProjectOptions : The DeleteProject options. -type DeleteProjectOptions struct { - // The unique project ID. - ID *string `json:"id" validate:"required,ne="` + // The input variables for configuration definition and environment. + Input *InputVariable `json:"input,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // The profile required for compliance. + ComplianceProfile *ProjectComplianceProfile `json:"compliance_profile,omitempty"` } -// NewDeleteProjectOptions : Instantiate DeleteProjectOptions -func (*ProjectV1) NewDeleteProjectOptions(id string) *DeleteProjectOptions { - return &DeleteProjectOptions{ - ID: core.StringPtr(id), +// UnmarshalEnvironmentDefinitionProperties unmarshals an instance of EnvironmentDefinitionProperties from the specified map of raw messages. +func UnmarshalEnvironmentDefinitionProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnvironmentDefinitionProperties) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalModel(m, "authorizations", &obj.Authorizations, UnmarshalProjectConfigAuth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "input", &obj.Input, UnmarshalInputVariable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "compliance_profile", &obj.ComplianceProfile, UnmarshalProjectComplianceProfile) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetID : Allow user to set ID -func (_options *DeleteProjectOptions) SetID(id string) *DeleteProjectOptions { - _options.ID = core.StringPtr(id) - return _options -} +// EnvironmentDefinitionRequiredProperties : The environment definition. +type EnvironmentDefinitionRequiredProperties struct { + // The name of the environment. + Name *string `json:"name" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *DeleteProjectOptions) SetHeaders(param map[string]string) *DeleteProjectOptions { - options.Headers = param - return options -} + // The description of the environment. + Description *string `json:"description,omitempty"` -// DeployConfigOptions : The DeployConfig options. -type DeployConfigOptions struct { - // The unique project ID. - ProjectID *string `json:"project_id" validate:"required,ne="` + // The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. + Authorizations *ProjectConfigAuth `json:"authorizations,omitempty"` - // The unique config ID. - ID *string `json:"id" validate:"required,ne="` + // The input variables for configuration definition and environment. + Input *InputVariable `json:"input,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // The profile required for compliance. + ComplianceProfile *ProjectComplianceProfile `json:"compliance_profile,omitempty"` } -// NewDeployConfigOptions : Instantiate DeployConfigOptions -func (*ProjectV1) NewDeployConfigOptions(projectID string, id string) *DeployConfigOptions { - return &DeployConfigOptions{ - ProjectID: core.StringPtr(projectID), - ID: core.StringPtr(id), +// NewEnvironmentDefinitionRequiredProperties : Instantiate EnvironmentDefinitionRequiredProperties (Generic Model Constructor) +func (*ProjectV1) NewEnvironmentDefinitionRequiredProperties(name string) (_model *EnvironmentDefinitionRequiredProperties, err error) { + _model = &EnvironmentDefinitionRequiredProperties{ + Name: core.StringPtr(name), } + err = core.ValidateStruct(_model, "required parameters") + return } -// SetProjectID : Allow user to set ProjectID -func (_options *DeployConfigOptions) SetProjectID(projectID string) *DeployConfigOptions { - _options.ProjectID = core.StringPtr(projectID) - return _options +// UnmarshalEnvironmentDefinitionRequiredProperties unmarshals an instance of EnvironmentDefinitionRequiredProperties from the specified map of raw messages. +func UnmarshalEnvironmentDefinitionRequiredProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnvironmentDefinitionRequiredProperties) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalModel(m, "authorizations", &obj.Authorizations, UnmarshalProjectConfigAuth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "input", &obj.Input, UnmarshalInputVariable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "compliance_profile", &obj.ComplianceProfile, UnmarshalProjectComplianceProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetID : Allow user to set ID -func (_options *DeployConfigOptions) SetID(id string) *DeployConfigOptions { - _options.ID = core.StringPtr(id) - return _options +// EnvironmentDeleteResponse : The delete environment response. +type EnvironmentDeleteResponse struct { + // The environment id as a friendly name. + ID *string `json:"id" validate:"required"` } -// SetHeaders : Allow user to set Headers -func (options *DeployConfigOptions) SetHeaders(param map[string]string) *DeployConfigOptions { - options.Headers = param - return options +// UnmarshalEnvironmentDeleteResponse unmarshals an instance of EnvironmentDeleteResponse from the specified map of raw messages. +func UnmarshalEnvironmentDeleteResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnvironmentDeleteResponse) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EnvironmentListResponse : The list environment response. +type EnvironmentListResponse struct { + // The environments. + Environments []Environment `json:"environments,omitempty"` +} + +// UnmarshalEnvironmentListResponse unmarshals an instance of EnvironmentListResponse from the specified map of raw messages. +func UnmarshalEnvironmentListResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnvironmentListResponse) + err = core.UnmarshalModel(m, "environments", &obj.Environments, UnmarshalEnvironment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } // ForceApproveOptions : The ForceApprove options. @@ -1975,6 +2604,44 @@ func (options *GetConfigVersionOptions) SetHeaders(param map[string]string) *Get return options } +// GetProjectEnvironmentOptions : The GetProjectEnvironment options. +type GetProjectEnvironmentOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The environment ID. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetProjectEnvironmentOptions : Instantiate GetProjectEnvironmentOptions +func (*ProjectV1) NewGetProjectEnvironmentOptions(projectID string, id string) *GetProjectEnvironmentOptions { + return &GetProjectEnvironmentOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *GetProjectEnvironmentOptions) SetProjectID(projectID string) *GetProjectEnvironmentOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetProjectEnvironmentOptions) SetID(id string) *GetProjectEnvironmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetProjectEnvironmentOptions) SetHeaders(param map[string]string) *GetProjectEnvironmentOptions { + options.Headers = param + return options +} + // GetProjectOptions : The GetProject options. type GetProjectOptions struct { // The unique project ID. @@ -2072,6 +2739,12 @@ type LastActionWithSummary struct { // The result of the last action. Result *string `json:"result,omitempty"` + // A brief summary of a pre/post action. + PreJob *PrePostActionJobWithIdAndSummary `json:"pre_job,omitempty"` + + // A brief summary of a pre/post action. + PostJob *PrePostActionJobWithIdAndSummary `json:"post_job,omitempty"` + // A brief summary of an action. Job *ActionJobWithIdAndSummary `json:"job,omitempty"` } @@ -2094,6 +2767,14 @@ func UnmarshalLastActionWithSummary(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalModel(m, "pre_job", &obj.PreJob, UnmarshalPrePostActionJobWithIdAndSummary) + if err != nil { + return + } + err = core.UnmarshalModel(m, "post_job", &obj.PostJob, UnmarshalPrePostActionJobWithIdAndSummary) + if err != nil { + return + } err = core.UnmarshalModel(m, "job", &obj.Job, UnmarshalActionJobWithIdAndSummary) if err != nil { return @@ -2110,6 +2791,12 @@ type LastValidatedActionWithSummary struct { // The result of the last action. Result *string `json:"result,omitempty"` + // A brief summary of a pre/post action. + PreJob *PrePostActionJobWithIdAndSummary `json:"pre_job,omitempty"` + + // A brief summary of a pre/post action. + PostJob *PrePostActionJobWithIdAndSummary `json:"post_job,omitempty"` + // A brief summary of an action. Job *ActionJobWithIdAndSummary `json:"job,omitempty"` @@ -2139,6 +2826,14 @@ func UnmarshalLastValidatedActionWithSummary(m map[string]json.RawMessage, resul if err != nil { return } + err = core.UnmarshalModel(m, "pre_job", &obj.PreJob, UnmarshalPrePostActionJobWithIdAndSummary) + if err != nil { + return + } + err = core.UnmarshalModel(m, "post_job", &obj.PostJob, UnmarshalPrePostActionJobWithIdAndSummary) + if err != nil { + return + } err = core.UnmarshalModel(m, "job", &obj.Job, UnmarshalActionJobWithIdAndSummary) if err != nil { return @@ -2259,6 +2954,34 @@ func (options *ListConfigsOptions) SetHeaders(param map[string]string) *ListConf return options } +// ListProjectEnvironmentsOptions : The ListProjectEnvironments options. +type ListProjectEnvironmentsOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListProjectEnvironmentsOptions : Instantiate ListProjectEnvironmentsOptions +func (*ProjectV1) NewListProjectEnvironmentsOptions(projectID string) *ListProjectEnvironmentsOptions { + return &ListProjectEnvironmentsOptions{ + ProjectID: core.StringPtr(projectID), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *ListProjectEnvironmentsOptions) SetProjectID(projectID string) *ListProjectEnvironmentsOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListProjectEnvironmentsOptions) SetHeaders(param map[string]string) *ListProjectEnvironmentsOptions { + options.Headers = param + return options +} + // ListProjectsOptions : The ListProjects options. type ListProjectsOptions struct { // Marks the last entry that is returned on the page. The server uses this parameter to determine the first entry that @@ -2344,6 +3067,30 @@ func UnmarshalPaginationLink(m map[string]json.RawMessage, result interface{}) ( return } +// PrePostActionJobWithIdAndSummary : A brief summary of a pre/post action. +type PrePostActionJobWithIdAndSummary struct { + // The unique ID. + ID *string `json:"id,omitempty"` + + // The Summary of the pre/post job of the configuration. + Summary map[string]interface{} `json:"summary,omitempty"` +} + +// UnmarshalPrePostActionJobWithIdAndSummary unmarshals an instance of PrePostActionJobWithIdAndSummary from the specified map of raw messages. +func UnmarshalPrePostActionJobWithIdAndSummary(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrePostActionJobWithIdAndSummary) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "summary", &obj.Summary) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Project : The canonical schema of a project. type Project struct { // An IBM Cloud resource name, which uniquely identifies a resource. @@ -2380,6 +3127,10 @@ type Project struct { // configs array is specified in the request payload. Configs []ProjectConfigCollectionMember `json:"configs,omitempty"` + // The project environments. These environments are only included in the response if project environments were created + // on the project. + Environments []ProjectEnvironmentCollectionMember `json:"environments,omitempty"` + // The definition of the project. Definition *ProjectDefinitionProperties `json:"definition" validate:"required"` } @@ -2435,6 +3186,10 @@ func UnmarshalProject(m map[string]json.RawMessage, result interface{}) (err err if err != nil { return } + err = core.UnmarshalModel(m, "environments", &obj.Environments, UnmarshalProjectEnvironmentCollectionMember) + if err != nil { + return + } err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalProjectDefinitionProperties) if err != nil { return @@ -2679,7 +3434,7 @@ type ProjectConfig struct { // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time // format as specified by RFC 3339. - UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + UserModifiedAt *strfmt.DateTime `json:"user_modified_at,omitempty"` // The last approved metadata of the configuration. LastApproved *ProjectConfigMetadataLastApproved `json:"last_approved,omitempty"` @@ -2688,6 +3443,9 @@ type ProjectConfig struct { // format as specified by RFC 3339. LastSave *strfmt.DateTime `json:"last_save,omitempty"` + // The references used in the config to resolve input values. + References map[string]interface{} `json:"references,omitempty"` + // The action job performed on the project configuration. LastValidated *LastValidatedActionWithSummary `json:"last_validated,omitempty"` @@ -2697,8 +3455,17 @@ type ProjectConfig struct { // The action job performed on the project configuration. LastUndeployed *LastActionWithSummary `json:"last_undeployed,omitempty"` + // A schematics workspace associated to a project configuration. + Schematics *SchematicsWorkspace `json:"schematics,omitempty"` + // The type and output of a project configuration. Definition *ProjectConfigResponseDefinition `json:"definition" validate:"required"` + + // The project configuration version. + ApprovedVersion *ProjectConfigVersionSummary `json:"approved_version,omitempty"` + + // The project configuration version. + DeployedVersion *ProjectConfigVersionSummary `json:"deployed_version,omitempty"` } // Constants associated with the ProjectConfig.State property. @@ -2756,7 +3523,7 @@ func UnmarshalProjectConfig(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalPrimitive(m, "user_modified_at", &obj.UserModifiedAt) if err != nil { return } @@ -2768,6 +3535,10 @@ func UnmarshalProjectConfig(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } + err = core.UnmarshalPrimitive(m, "references", &obj.References) + if err != nil { + return + } err = core.UnmarshalModel(m, "last_validated", &obj.LastValidated, UnmarshalLastValidatedActionWithSummary) if err != nil { return @@ -2780,39 +3551,19 @@ func UnmarshalProjectConfig(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } - err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalProjectConfigResponseDefinition) + err = core.UnmarshalModel(m, "schematics", &obj.Schematics, UnmarshalSchematicsWorkspace) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ProjectConfigAuth : The authorization for a configuration. You can authorize by using a trusted profile or an API key in Secrets Manager. -type ProjectConfigAuth struct { - // The trusted profile for authorizations. - TrustedProfile *ProjectConfigAuthTrustedProfile `json:"trusted_profile,omitempty"` - - // The authorization for a configuration. You can authorize by using a trusted profile or an API key in Secrets - // Manager. - Method *string `json:"method,omitempty"` - - // The IBM Cloud API Key. - ApiKey *string `json:"api_key,omitempty"` -} - -// UnmarshalProjectConfigAuth unmarshals an instance of ProjectConfigAuth from the specified map of raw messages. -func UnmarshalProjectConfigAuth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ProjectConfigAuth) - err = core.UnmarshalModel(m, "trusted_profile", &obj.TrustedProfile, UnmarshalProjectConfigAuthTrustedProfile) + err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalProjectConfigResponseDefinition) if err != nil { return } - err = core.UnmarshalPrimitive(m, "method", &obj.Method) + err = core.UnmarshalModel(m, "approved_version", &obj.ApprovedVersion, UnmarshalProjectConfigVersionSummary) if err != nil { return } - err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) + err = core.UnmarshalModel(m, "deployed_version", &obj.DeployedVersion, UnmarshalProjectConfigVersionSummary) if err != nil { return } @@ -2820,23 +3571,30 @@ func UnmarshalProjectConfigAuth(m map[string]json.RawMessage, result interface{} return } -// ProjectConfigAuthTrustedProfile : The trusted profile for authorizations. -type ProjectConfigAuthTrustedProfile struct { - // The unique ID. - ID *string `json:"id,omitempty"` +// ProjectConfigAuth : The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. +type ProjectConfigAuth struct { + // The trusted profile ID. + TrustedProfileID *string `json:"trusted_profile_id,omitempty"` - // The unique ID. - TargetIamID *string `json:"target_iam_id,omitempty"` + // The authorization method. You can authorize by using a trusted profile or an API key in Secrets Manager. + Method *string `json:"method,omitempty"` + + // The IBM Cloud API Key. + ApiKey *string `json:"api_key,omitempty"` } -// UnmarshalProjectConfigAuthTrustedProfile unmarshals an instance of ProjectConfigAuthTrustedProfile from the specified map of raw messages. -func UnmarshalProjectConfigAuthTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ProjectConfigAuthTrustedProfile) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalProjectConfigAuth unmarshals an instance of ProjectConfigAuth from the specified map of raw messages. +func UnmarshalProjectConfigAuth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProjectConfigAuth) + err = core.UnmarshalPrimitive(m, "trusted_profile_id", &obj.TrustedProfileID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { return } - err = core.UnmarshalPrimitive(m, "target_iam_id", &obj.TargetIamID) + err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) if err != nil { return } @@ -2863,6 +3621,12 @@ func UnmarshalProjectConfigCollection(m map[string]json.RawMessage, result inter // ProjectConfigCollectionMember : ProjectConfigCollectionMember struct type ProjectConfigCollectionMember struct { + // The project configuration version. + ApprovedVersion *ProjectConfigVersionSummary `json:"approved_version,omitempty"` + + // The project configuration version. + DeployedVersion *ProjectConfigVersionSummary `json:"deployed_version,omitempty"` + // The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. ID *string `json:"id" validate:"required"` @@ -2890,7 +3654,7 @@ type ProjectConfigCollectionMember struct { // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time // format as specified by RFC 3339. - UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + UserModifiedAt *strfmt.DateTime `json:"user_modified_at,omitempty"` // The last approved metadata of the configuration. LastApproved *ProjectConfigMetadataLastApproved `json:"last_approved,omitempty"` @@ -2899,6 +3663,9 @@ type ProjectConfigCollectionMember struct { // format as specified by RFC 3339. LastSave *strfmt.DateTime `json:"last_save,omitempty"` + // The references used in the config to resolve input values. + References map[string]interface{} `json:"references,omitempty"` + // The action job performed on the project configuration. LastValidated *LastValidatedActionWithSummary `json:"last_validated,omitempty"` @@ -2908,6 +3675,9 @@ type ProjectConfigCollectionMember struct { // The action job performed on the project configuration. LastUndeployed *LastActionWithSummary `json:"last_undeployed,omitempty"` + // A schematics workspace associated to a project configuration. + Schematics *SchematicsWorkspace `json:"schematics,omitempty"` + // A relative URL. Href *string `json:"href" validate:"required"` @@ -2938,6 +3708,14 @@ const ( // UnmarshalProjectConfigCollectionMember unmarshals an instance of ProjectConfigCollectionMember from the specified map of raw messages. func UnmarshalProjectConfigCollectionMember(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ProjectConfigCollectionMember) + err = core.UnmarshalModel(m, "approved_version", &obj.ApprovedVersion, UnmarshalProjectConfigVersionSummary) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deployed_version", &obj.DeployedVersion, UnmarshalProjectConfigVersionSummary) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -2970,7 +3748,7 @@ func UnmarshalProjectConfigCollectionMember(m map[string]json.RawMessage, result if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalPrimitive(m, "user_modified_at", &obj.UserModifiedAt) if err != nil { return } @@ -2982,6 +3760,10 @@ func UnmarshalProjectConfigCollectionMember(m map[string]json.RawMessage, result if err != nil { return } + err = core.UnmarshalPrimitive(m, "references", &obj.References) + if err != nil { + return + } err = core.UnmarshalModel(m, "last_validated", &obj.LastValidated, UnmarshalLastValidatedActionWithSummary) if err != nil { return @@ -2994,6 +3776,10 @@ func UnmarshalProjectConfigCollectionMember(m map[string]json.RawMessage, result if err != nil { return } + err = core.UnmarshalModel(m, "schematics", &obj.Schematics, UnmarshalSchematicsWorkspace) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -3217,6 +4003,9 @@ func UnmarshalProjectConfigMetadataLastApproved(m map[string]json.RawMessage, re type ProjectConfigPrototype struct { // The name and description of a project configuration. Definition *ProjectConfigPrototypeDefinitionBlock `json:"definition" validate:"required"` + + // A schematics workspace associated to a project configuration. + Schematics *SchematicsWorkspace `json:"schematics,omitempty"` } // NewProjectConfigPrototype : Instantiate ProjectConfigPrototype (Generic Model Constructor) @@ -3235,6 +4024,10 @@ func UnmarshalProjectConfigPrototype(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalModel(m, "schematics", &obj.Schematics, UnmarshalSchematicsWorkspace) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -3250,15 +4043,17 @@ type ProjectConfigPrototypeDefinitionBlock struct { // The configuration labels. Labels []string `json:"labels,omitempty"` - // The authorization for a configuration. - // You can authorize by using a trusted profile or an API key in Secrets Manager. + // The ID of the project environment. + Environment *string `json:"environment,omitempty"` + + // The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Authorizations *ProjectConfigAuth `json:"authorizations,omitempty"` // The profile required for compliance. ComplianceProfile *ProjectComplianceProfile `json:"compliance_profile,omitempty"` // A dotted value of catalogID.versionID. - LocatorID *string `json:"locator_id" validate:"required"` + LocatorID *string `json:"locator_id,omitempty"` // The input variables for configuration definition and environment. Input *InputVariable `json:"input,omitempty"` @@ -3269,10 +4064,9 @@ type ProjectConfigPrototypeDefinitionBlock struct { } // NewProjectConfigPrototypeDefinitionBlock : Instantiate ProjectConfigPrototypeDefinitionBlock (Generic Model Constructor) -func (*ProjectV1) NewProjectConfigPrototypeDefinitionBlock(name string, locatorID string) (_model *ProjectConfigPrototypeDefinitionBlock, err error) { +func (*ProjectV1) NewProjectConfigPrototypeDefinitionBlock(name string) (_model *ProjectConfigPrototypeDefinitionBlock, err error) { _model = &ProjectConfigPrototypeDefinitionBlock{ Name: core.StringPtr(name), - LocatorID: core.StringPtr(locatorID), } err = core.ValidateStruct(_model, "required parameters") return @@ -3293,6 +4087,10 @@ func UnmarshalProjectConfigPrototypeDefinitionBlock(m map[string]json.RawMessage if err != nil { return } + err = core.UnmarshalPrimitive(m, "environment", &obj.Environment) + if err != nil { + return + } err = core.UnmarshalModel(m, "authorizations", &obj.Authorizations, UnmarshalProjectConfigAuth) if err != nil { return @@ -3328,8 +4126,10 @@ type ProjectConfigPrototypePatchDefinitionBlock struct { // The configuration labels. Labels []string `json:"labels,omitempty"` - // The authorization for a configuration. - // You can authorize by using a trusted profile or an API key in Secrets Manager. + // The ID of the project environment. + Environment *string `json:"environment,omitempty"` + + // The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Authorizations *ProjectConfigAuth `json:"authorizations,omitempty"` // The profile required for compliance. @@ -3361,6 +4161,10 @@ func UnmarshalProjectConfigPrototypePatchDefinitionBlock(m map[string]json.RawMe if err != nil { return } + err = core.UnmarshalPrimitive(m, "environment", &obj.Environment) + if err != nil { + return + } err = core.UnmarshalModel(m, "authorizations", &obj.Authorizations, UnmarshalProjectConfigAuth) if err != nil { return @@ -3465,8 +4269,10 @@ type ProjectConfigResponseDefinition struct { // The configuration labels. Labels []string `json:"labels,omitempty"` - // The authorization for a configuration. - // You can authorize by using a trusted profile or an API key in Secrets Manager. + // The ID of the project environment. + Environment *string `json:"environment,omitempty"` + + // The authorization details. You can authorize by using a trusted profile or an API key in Secrets Manager. Authorizations *ProjectConfigAuth `json:"authorizations,omitempty"` // The profile required for compliance. @@ -3511,6 +4317,10 @@ func UnmarshalProjectConfigResponseDefinition(m map[string]json.RawMessage, resu if err != nil { return } + err = core.UnmarshalPrimitive(m, "environment", &obj.Environment) + if err != nil { + return + } err = core.UnmarshalModel(m, "authorizations", &obj.Authorizations, UnmarshalProjectConfigAuth) if err != nil { return @@ -3605,6 +4415,158 @@ func UnmarshalProjectConfigSetting(m map[string]json.RawMessage, result interfac return } +// ProjectConfigVersion : A specific version of a project configuration. +type ProjectConfigVersion struct { + // The ID of the configuration. If this parameter is empty, an ID is automatically created for the configuration. + ID *string `json:"id" validate:"required"` + + // The unique ID. + ProjectID *string `json:"project_id" validate:"required"` + + // The version of the configuration. + Version *int64 `json:"version" validate:"required"` + + // The flag that indicates whether the version of the configuration is draft, or active. + IsDraft *bool `json:"is_draft" validate:"required"` + + // The needs attention state of a configuration. + NeedsAttentionState []interface{} `json:"needs_attention_state,omitempty"` + + // The state of the configuration. + State *string `json:"state" validate:"required"` + + // The flag that indicates whether a configuration update is available. + UpdateAvailable *bool `json:"update_available" validate:"required"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time + // format as specified by RFC 3339. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time + // format as specified by RFC 3339. + UserModifiedAt *strfmt.DateTime `json:"user_modified_at,omitempty"` + + // The last approved metadata of the configuration. + LastApproved *ProjectConfigMetadataLastApproved `json:"last_approved,omitempty"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time + // format as specified by RFC 3339. + LastSave *strfmt.DateTime `json:"last_save,omitempty"` + + // The references used in the config to resolve input values. + References map[string]interface{} `json:"references,omitempty"` + + // The action job performed on the project configuration. + LastValidated *LastValidatedActionWithSummary `json:"last_validated,omitempty"` + + // The action job performed on the project configuration. + LastDeployed *LastActionWithSummary `json:"last_deployed,omitempty"` + + // The action job performed on the project configuration. + LastUndeployed *LastActionWithSummary `json:"last_undeployed,omitempty"` + + // A schematics workspace associated to a project configuration. + Schematics *SchematicsWorkspace `json:"schematics,omitempty"` + + // The type and output of a project configuration. + Definition *ProjectConfigResponseDefinition `json:"definition" validate:"required"` +} + +// Constants associated with the ProjectConfigVersion.State property. +// The state of the configuration. +const ( + ProjectConfigVersion_State_Approved = "approved" + ProjectConfigVersion_State_Deleted = "deleted" + ProjectConfigVersion_State_Deleting = "deleting" + ProjectConfigVersion_State_DeletingFailed = "deleting_failed" + ProjectConfigVersion_State_Deployed = "deployed" + ProjectConfigVersion_State_Deploying = "deploying" + ProjectConfigVersion_State_DeployingFailed = "deploying_failed" + ProjectConfigVersion_State_Discarded = "discarded" + ProjectConfigVersion_State_Draft = "draft" + ProjectConfigVersion_State_Superceded = "superceded" + ProjectConfigVersion_State_Undeploying = "undeploying" + ProjectConfigVersion_State_UndeployingFailed = "undeploying_failed" + ProjectConfigVersion_State_Validated = "validated" + ProjectConfigVersion_State_Validating = "validating" + ProjectConfigVersion_State_ValidatingFailed = "validating_failed" +) + +// UnmarshalProjectConfigVersion unmarshals an instance of ProjectConfigVersion from the specified map of raw messages. +func UnmarshalProjectConfigVersion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProjectConfigVersion) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "project_id", &obj.ProjectID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_draft", &obj.IsDraft) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "needs_attention_state", &obj.NeedsAttentionState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "update_available", &obj.UpdateAvailable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_modified_at", &obj.UserModifiedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last_approved", &obj.LastApproved, UnmarshalProjectConfigMetadataLastApproved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_save", &obj.LastSave) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "references", &obj.References) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last_validated", &obj.LastValidated, UnmarshalLastValidatedActionWithSummary) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last_deployed", &obj.LastDeployed, UnmarshalLastActionWithSummary) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last_undeployed", &obj.LastUndeployed, UnmarshalLastActionWithSummary) + if err != nil { + return + } + err = core.UnmarshalModel(m, "schematics", &obj.Schematics, UnmarshalSchematicsWorkspace) + if err != nil { + return + } + err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalProjectConfigResponseDefinition) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ProjectConfigVersionSummary : The project configuration version. type ProjectConfigVersionSummary struct { // The needs attention state of a configuration. @@ -3712,6 +4674,52 @@ func UnmarshalProjectDefinitionProperties(m map[string]json.RawMessage, result i return } +// ProjectEnvironmentCollectionMember : The environment metadata. +type ProjectEnvironmentCollectionMember struct { + // The environment id as a friendly name. + ID *string `json:"id" validate:"required"` + + // The unique ID. + ProjectID *string `json:"project_id" validate:"required"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ, matching the date and time + // format as specified by RFC 3339. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // A relative URL. + Href *string `json:"href" validate:"required"` + + // The environment definition used in the project collection. + Definition *EnvironmentDefinitionNameDescription `json:"definition" validate:"required"` +} + +// UnmarshalProjectEnvironmentCollectionMember unmarshals an instance of ProjectEnvironmentCollectionMember from the specified map of raw messages. +func UnmarshalProjectEnvironmentCollectionMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProjectEnvironmentCollectionMember) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "project_id", &obj.ProjectID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalEnvironmentDefinitionNameDescription) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ProjectPrototypeDefinition : The definition of the project. type ProjectPrototypeDefinition struct { // The name of the project. @@ -3785,6 +4793,23 @@ func UnmarshalProjectPrototypePatchDefinitionBlock(m map[string]json.RawMessage, return } +// SchematicsWorkspace : A schematics workspace associated to a project configuration. +type SchematicsWorkspace struct { + // An existing schematics workspace ID. + WorkspaceID *string `json:"workspace_id,omitempty"` +} + +// UnmarshalSchematicsWorkspace unmarshals an instance of SchematicsWorkspace from the specified map of raw messages. +func UnmarshalSchematicsWorkspace(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SchematicsWorkspace) + err = core.UnmarshalPrimitive(m, "workspace_id", &obj.WorkspaceID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SyncConfigOptions : The SyncConfig options. type SyncConfigOptions struct { // The unique project ID. @@ -3793,8 +4818,8 @@ type SyncConfigOptions struct { // The unique config ID. ID *string `json:"id" validate:"required,ne="` - // An existing schematics workspace ID. - WorkspaceID *string `json:"workspace_id,omitempty"` + // A schematics workspace associated to a project configuration. + Schematics *SchematicsWorkspace `json:"schematics,omitempty"` // Allows users to set headers on API requests Headers map[string]string @@ -3820,9 +4845,9 @@ func (_options *SyncConfigOptions) SetID(id string) *SyncConfigOptions { return _options } -// SetWorkspaceID : Allow user to set WorkspaceID -func (_options *SyncConfigOptions) SetWorkspaceID(workspaceID string) *SyncConfigOptions { - _options.WorkspaceID = core.StringPtr(workspaceID) +// SetSchematics : Allow user to set Schematics +func (_options *SyncConfigOptions) SetSchematics(schematics *SchematicsWorkspace) *SyncConfigOptions { + _options.Schematics = schematics return _options } @@ -3918,6 +4943,54 @@ func (options *UpdateConfigOptions) SetHeaders(param map[string]string) *UpdateC return options } +// UpdateProjectEnvironmentOptions : The UpdateProjectEnvironment options. +type UpdateProjectEnvironmentOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The environment ID. + ID *string `json:"id" validate:"required,ne="` + + // The environment definition used for updates. + Definition *EnvironmentDefinitionProperties `json:"definition" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateProjectEnvironmentOptions : Instantiate UpdateProjectEnvironmentOptions +func (*ProjectV1) NewUpdateProjectEnvironmentOptions(projectID string, id string, definition *EnvironmentDefinitionProperties) *UpdateProjectEnvironmentOptions { + return &UpdateProjectEnvironmentOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + Definition: definition, + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *UpdateProjectEnvironmentOptions) SetProjectID(projectID string) *UpdateProjectEnvironmentOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateProjectEnvironmentOptions) SetID(id string) *UpdateProjectEnvironmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDefinition : Allow user to set Definition +func (_options *UpdateProjectEnvironmentOptions) SetDefinition(definition *EnvironmentDefinitionProperties) *UpdateProjectEnvironmentOptions { + _options.Definition = definition + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateProjectEnvironmentOptions) SetHeaders(param map[string]string) *UpdateProjectEnvironmentOptions { + options.Headers = param + return options +} + // UpdateProjectOptions : The UpdateProject options. type UpdateProjectOptions struct { // The unique project ID. diff --git a/projectv1/project_v1_examples_test.go b/projectv1/project_v1_examples_test.go index b8e2217..e9e8eda 100644 --- a/projectv1/project_v1_examples_test.go +++ b/projectv1/project_v1_examples_test.go @@ -115,21 +115,11 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { Description: core.StringPtr("A microservice to deploy on top of ACME infrastructure."), } - projectConfigPrototypeDefinitionBlockModel := &projectv1.ProjectConfigPrototypeDefinitionBlock{ - Name: core.StringPtr("common-variables"), - LocatorID: core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"), - } - - projectConfigPrototypeModel := &projectv1.ProjectConfigPrototype{ - Definition: projectConfigPrototypeDefinitionBlockModel, - } - createProjectOptions := projectService.NewCreateProjectOptions( projectPrototypeDefinitionModel, "us-south", "Default", ) - createProjectOptions.SetConfigs([]projectv1.ProjectConfigPrototype{*projectConfigPrototypeModel}) project, response, err := projectService.CreateProject(createProjectOptions) if err != nil { @@ -265,6 +255,146 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(200)) Expect(project).ToNot(BeNil()) }) + It(`CreateProjectEnvironment request example`, func() { + fmt.Println("\nCreateProjectEnvironment() result:") + // begin-create_project_environment + + projectConfigAuthModel := &projectv1.ProjectConfigAuth{ + Method: core.StringPtr("API_KEY"), + ApiKey: core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9"), + } + + inputVariableModel := &projectv1.InputVariable{ + } + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + projectComplianceProfileModel := &projectv1.ProjectComplianceProfile{ + ID: core.StringPtr("some-profile-id"), + InstanceID: core.StringPtr("some-instance-id"), + InstanceLocation: core.StringPtr("us-south"), + AttachmentID: core.StringPtr("some-attachment-id"), + ProfileName: core.StringPtr("some-profile-name"), + } + + environmentDefinitionRequiredPropertiesModel := &projectv1.EnvironmentDefinitionRequiredProperties{ + Name: core.StringPtr("development"), + Description: core.StringPtr("The environment 'development'"), + Authorizations: projectConfigAuthModel, + Input: inputVariableModel, + ComplianceProfile: projectComplianceProfileModel, + } + + createProjectEnvironmentOptions := projectService.NewCreateProjectEnvironmentOptions( + projectIdLink, + environmentDefinitionRequiredPropertiesModel, + ) + + environment, response, err := projectService.CreateProjectEnvironment(createProjectEnvironmentOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(environment, "", " ") + fmt.Println(string(b)) + + // end-create_project_environment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(environment).ToNot(BeNil()) + }) + It(`ListProjectEnvironments request example`, func() { + fmt.Println("\nListProjectEnvironments() result:") + // begin-list_project_environments + + listProjectEnvironmentsOptions := projectService.NewListProjectEnvironmentsOptions( + projectIdLink, + ) + + environmentListResponse, response, err := projectService.ListProjectEnvironments(listProjectEnvironmentsOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(environmentListResponse, "", " ") + fmt.Println(string(b)) + + // end-list_project_environments + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environmentListResponse).ToNot(BeNil()) + }) + It(`GetProjectEnvironment request example`, func() { + fmt.Println("\nGetProjectEnvironment() result:") + // begin-get_project_environment + + getProjectEnvironmentOptions := projectService.NewGetProjectEnvironmentOptions( + projectIdLink, + projectIdLink, + ) + + environment, response, err := projectService.GetProjectEnvironment(getProjectEnvironmentOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(environment, "", " ") + fmt.Println(string(b)) + + // end-get_project_environment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environment).ToNot(BeNil()) + }) + It(`UpdateProjectEnvironment request example`, func() { + fmt.Println("\nUpdateProjectEnvironment() result:") + // begin-update_project_environment + + projectConfigAuthModel := &projectv1.ProjectConfigAuth{ + Method: core.StringPtr("API_KEY"), + ApiKey: core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9"), + } + + inputVariableModel := &projectv1.InputVariable{ + } + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + projectComplianceProfileModel := &projectv1.ProjectComplianceProfile{ + ID: core.StringPtr("some-profile-id"), + InstanceID: core.StringPtr("some-instance-id"), + InstanceLocation: core.StringPtr("us-south"), + AttachmentID: core.StringPtr("some-attachment-id"), + ProfileName: core.StringPtr("some-profile-name"), + } + + environmentDefinitionPropertiesModel := &projectv1.EnvironmentDefinitionProperties{ + Name: core.StringPtr("development"), + Description: core.StringPtr("The environment 'development'"), + Authorizations: projectConfigAuthModel, + Input: inputVariableModel, + ComplianceProfile: projectComplianceProfileModel, + } + + updateProjectEnvironmentOptions := projectService.NewUpdateProjectEnvironmentOptions( + projectIdLink, + projectIdLink, + environmentDefinitionPropertiesModel, + ) + + environment, response, err := projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(environment, "", " ") + fmt.Println(string(b)) + + // end-update_project_environment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environment).ToNot(BeNil()) + }) It(`ListConfigs request example`, func() { fmt.Println("\nListConfigs() result:") // begin-list_configs @@ -353,18 +483,18 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { ) forceApproveOptions.SetComment("Approving the changes") - projectConfig, response, err := projectService.ForceApprove(forceApproveOptions) + projectConfigVersion, response, err := projectService.ForceApprove(forceApproveOptions) if err != nil { panic(err) } - b, _ := json.MarshalIndent(projectConfig, "", " ") + b, _ := json.MarshalIndent(projectConfigVersion, "", " ") fmt.Println(string(b)) // end-force_approve Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) It(`Approve request example`, func() { fmt.Println("\nApprove() result:") @@ -376,18 +506,18 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { ) approveOptions.SetComment("Approving the changes") - projectConfig, response, err := projectService.Approve(approveOptions) + projectConfigVersion, response, err := projectService.Approve(approveOptions) if err != nil { panic(err) } - b, _ := json.MarshalIndent(projectConfig, "", " ") + b, _ := json.MarshalIndent(projectConfigVersion, "", " ") fmt.Println(string(b)) // end-approve Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) It(`ValidateConfig request example`, func() { fmt.Println("\nValidateConfig() result:") @@ -398,18 +528,18 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { configIdLink, ) - projectConfig, response, err := projectService.ValidateConfig(validateConfigOptions) + projectConfigVersion, response, err := projectService.ValidateConfig(validateConfigOptions) if err != nil { panic(err) } - b, _ := json.MarshalIndent(projectConfig, "", " ") + b, _ := json.MarshalIndent(projectConfigVersion, "", " ") fmt.Println(string(b)) // end-validate_config Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(202)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) It(`DeployConfig request example`, func() { fmt.Println("\nDeployConfig() result:") @@ -420,18 +550,18 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { configIdLink, ) - projectConfig, response, err := projectService.DeployConfig(deployConfigOptions) + projectConfigVersion, response, err := projectService.DeployConfig(deployConfigOptions) if err != nil { panic(err) } - b, _ := json.MarshalIndent(projectConfig, "", " ") + b, _ := json.MarshalIndent(projectConfigVersion, "", " ") fmt.Println(string(b)) // end-deploy_config Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(202)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) It(`UndeployConfig request example`, func() { // begin-undeploy_config @@ -457,11 +587,15 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { It(`SyncConfig request example`, func() { // begin-sync_config + schematicsWorkspaceModel := &projectv1.SchematicsWorkspace{ + WorkspaceID: core.StringPtr("us-south.workspace.service.e0106139"), + } + syncConfigOptions := projectService.NewSyncConfigOptions( projectIdLink, configIdLink, ) - syncConfigOptions.SetWorkspaceID("us-south.workspace.service.e0106139") + syncConfigOptions.SetSchematics(schematicsWorkspaceModel) response, err := projectService.SyncConfig(syncConfigOptions) if err != nil { @@ -530,18 +664,40 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { int64(38), ) - projectConfig, response, err := projectService.GetConfigVersion(getConfigVersionOptions) + projectConfigVersion, response, err := projectService.GetConfigVersion(getConfigVersionOptions) if err != nil { panic(err) } - b, _ := json.MarshalIndent(projectConfig, "", " ") + b, _ := json.MarshalIndent(projectConfigVersion, "", " ") fmt.Println(string(b)) // end-get_config_version Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) + }) + It(`DeleteProjectEnvironment request example`, func() { + fmt.Println("\nDeleteProjectEnvironment() result:") + // begin-delete_project_environment + + deleteProjectEnvironmentOptions := projectService.NewDeleteProjectEnvironmentOptions( + projectIdLink, + projectIdLink, + ) + + environmentDeleteResponse, response, err := projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(environmentDeleteResponse, "", " ") + fmt.Println(string(b)) + + // end-delete_project_environment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environmentDeleteResponse).ToNot(BeNil()) }) It(`DeleteConfig request example`, func() { fmt.Println("\nDeleteConfig() result:") diff --git a/projectv1/project_v1_integration_test.go b/projectv1/project_v1_integration_test.go index e2b94b8..9a00a56 100644 --- a/projectv1/project_v1_integration_test.go +++ b/projectv1/project_v1_integration_test.go @@ -106,13 +106,8 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { DestroyOnDelete: core.BoolPtr(true), } - projectConfigAuthTrustedProfileModel := &projectv1.ProjectConfigAuthTrustedProfile{ - ID: core.StringPtr("testString"), - TargetIamID: core.StringPtr("testString"), - } - projectConfigAuthModel := &projectv1.ProjectConfigAuth{ - TrustedProfile: projectConfigAuthTrustedProfileModel, + TrustedProfileID: core.StringPtr("testString"), Method: core.StringPtr("testString"), ApiKey: core.StringPtr("testString"), } @@ -134,18 +129,24 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { projectConfigSettingModel.SetProperty("foo", core.StringPtr("testString")) projectConfigPrototypeDefinitionBlockModel := &projectv1.ProjectConfigPrototypeDefinitionBlock{ - Name: core.StringPtr("common-variables"), + Name: core.StringPtr("testString"), Description: core.StringPtr("testString"), Labels: []string{"testString"}, + Environment: core.StringPtr("testString"), Authorizations: projectConfigAuthModel, ComplianceProfile: projectComplianceProfileModel, - LocatorID: core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"), + LocatorID: core.StringPtr("testString"), Input: inputVariableModel, Setting: projectConfigSettingModel, } + schematicsWorkspaceModel := &projectv1.SchematicsWorkspace{ + WorkspaceID: core.StringPtr("testString"), + } + projectConfigPrototypeModel := &projectv1.ProjectConfigPrototype{ Definition: projectConfigPrototypeDefinitionBlockModel, + Schematics: schematicsWorkspaceModel, } createProjectOptions := &projectv1.CreateProjectOptions{ @@ -170,13 +171,8 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { shouldSkipTest() }) It(`CreateConfig(createConfigOptions *CreateConfigOptions)`, func() { - projectConfigAuthTrustedProfileModel := &projectv1.ProjectConfigAuthTrustedProfile{ - ID: core.StringPtr("testString"), - TargetIamID: core.StringPtr("testString"), - } - projectConfigAuthModel := &projectv1.ProjectConfigAuth{ - TrustedProfile: projectConfigAuthTrustedProfileModel, + TrustedProfileID: core.StringPtr("testString"), Method: core.StringPtr("testString"), ApiKey: core.StringPtr("testString"), } @@ -205,6 +201,7 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { Name: core.StringPtr("env-stage"), Description: core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace."), Labels: []string{"env:stage", "governance:test", "build:0"}, + Environment: core.StringPtr("testString"), Authorizations: projectConfigAuthModel, ComplianceProfile: projectComplianceProfileModel, LocatorID: core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"), @@ -212,9 +209,14 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { Setting: projectConfigSettingModel, } + schematicsWorkspaceModel := &projectv1.SchematicsWorkspace{ + WorkspaceID: core.StringPtr("testString"), + } + createConfigOptions := &projectv1.CreateConfigOptions{ ProjectID: &projectIdLink, Definition: projectConfigPrototypeDefinitionBlockModel, + Schematics: schematicsWorkspaceModel, } projectConfig, response, err := projectService.CreateConfig(createConfigOptions) @@ -328,6 +330,128 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { }) }) + Describe(`CreateProjectEnvironment - Create an environment`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateProjectEnvironment(createProjectEnvironmentOptions *CreateProjectEnvironmentOptions)`, func() { + projectConfigAuthModel := &projectv1.ProjectConfigAuth{ + TrustedProfileID: core.StringPtr("testString"), + Method: core.StringPtr("API_KEY"), + ApiKey: core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9"), + } + + inputVariableModel := &projectv1.InputVariable{ + } + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + projectComplianceProfileModel := &projectv1.ProjectComplianceProfile{ + ID: core.StringPtr("some-profile-id"), + InstanceID: core.StringPtr("some-instance-id"), + InstanceLocation: core.StringPtr("us-south"), + AttachmentID: core.StringPtr("some-attachment-id"), + ProfileName: core.StringPtr("some-profile-name"), + } + + environmentDefinitionRequiredPropertiesModel := &projectv1.EnvironmentDefinitionRequiredProperties{ + Name: core.StringPtr("development"), + Description: core.StringPtr("The environment 'development'"), + Authorizations: projectConfigAuthModel, + Input: inputVariableModel, + ComplianceProfile: projectComplianceProfileModel, + } + + createProjectEnvironmentOptions := &projectv1.CreateProjectEnvironmentOptions{ + ProjectID: &projectIdLink, + Definition: environmentDefinitionRequiredPropertiesModel, + } + + environment, response, err := projectService.CreateProjectEnvironment(createProjectEnvironmentOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(environment).ToNot(BeNil()) + }) + }) + + Describe(`ListProjectEnvironments - List environments`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListProjectEnvironments(listProjectEnvironmentsOptions *ListProjectEnvironmentsOptions)`, func() { + listProjectEnvironmentsOptions := &projectv1.ListProjectEnvironmentsOptions{ + ProjectID: &projectIdLink, + } + + environmentListResponse, response, err := projectService.ListProjectEnvironments(listProjectEnvironmentsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environmentListResponse).ToNot(BeNil()) + }) + }) + + Describe(`GetProjectEnvironment - Get an environment`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetProjectEnvironment(getProjectEnvironmentOptions *GetProjectEnvironmentOptions)`, func() { + getProjectEnvironmentOptions := &projectv1.GetProjectEnvironmentOptions{ + ProjectID: &projectIdLink, + ID: &projectIdLink, + } + + environment, response, err := projectService.GetProjectEnvironment(getProjectEnvironmentOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environment).ToNot(BeNil()) + }) + }) + + Describe(`UpdateProjectEnvironment - Update an environment`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`UpdateProjectEnvironment(updateProjectEnvironmentOptions *UpdateProjectEnvironmentOptions)`, func() { + projectConfigAuthModel := &projectv1.ProjectConfigAuth{ + TrustedProfileID: core.StringPtr("testString"), + Method: core.StringPtr("API_KEY"), + ApiKey: core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9"), + } + + inputVariableModel := &projectv1.InputVariable{ + } + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + projectComplianceProfileModel := &projectv1.ProjectComplianceProfile{ + ID: core.StringPtr("some-profile-id"), + InstanceID: core.StringPtr("some-instance-id"), + InstanceLocation: core.StringPtr("us-south"), + AttachmentID: core.StringPtr("some-attachment-id"), + ProfileName: core.StringPtr("some-profile-name"), + } + + environmentDefinitionPropertiesModel := &projectv1.EnvironmentDefinitionProperties{ + Name: core.StringPtr("development"), + Description: core.StringPtr("The environment 'development'"), + Authorizations: projectConfigAuthModel, + Input: inputVariableModel, + ComplianceProfile: projectComplianceProfileModel, + } + + updateProjectEnvironmentOptions := &projectv1.UpdateProjectEnvironmentOptions{ + ProjectID: &projectIdLink, + ID: &projectIdLink, + Definition: environmentDefinitionPropertiesModel, + } + + environment, response, err := projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environment).ToNot(BeNil()) + }) + }) + Describe(`ListConfigs - List all project configurations`, func() { BeforeEach(func() { shouldSkipTest() @@ -366,13 +490,8 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { shouldSkipTest() }) It(`UpdateConfig(updateConfigOptions *UpdateConfigOptions)`, func() { - projectConfigAuthTrustedProfileModel := &projectv1.ProjectConfigAuthTrustedProfile{ - ID: core.StringPtr("testString"), - TargetIamID: core.StringPtr("testString"), - } - projectConfigAuthModel := &projectv1.ProjectConfigAuth{ - TrustedProfile: projectConfigAuthTrustedProfileModel, + TrustedProfileID: core.StringPtr("testString"), Method: core.StringPtr("testString"), ApiKey: core.StringPtr("testString"), } @@ -401,6 +520,7 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { Name: core.StringPtr("testString"), Description: core.StringPtr("testString"), Labels: []string{"testString"}, + Environment: core.StringPtr("testString"), Authorizations: projectConfigAuthModel, ComplianceProfile: projectComplianceProfileModel, LocatorID: core.StringPtr("testString"), @@ -432,10 +552,10 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { Comment: core.StringPtr("Approving the changes"), } - projectConfig, response, err := projectService.ForceApprove(forceApproveOptions) + projectConfigVersion, response, err := projectService.ForceApprove(forceApproveOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) }) @@ -450,10 +570,10 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { Comment: core.StringPtr("Approving the changes"), } - projectConfig, response, err := projectService.Approve(approveOptions) + projectConfigVersion, response, err := projectService.Approve(approveOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) }) @@ -468,10 +588,10 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { XAuthRefreshToken: core.StringPtr("testString"), } - projectConfig, response, err := projectService.ValidateConfig(validateConfigOptions) + projectConfigVersion, response, err := projectService.ValidateConfig(validateConfigOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(202)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) }) @@ -485,10 +605,10 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { ID: &configIdLink, } - projectConfig, response, err := projectService.DeployConfig(deployConfigOptions) + projectConfigVersion, response, err := projectService.DeployConfig(deployConfigOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(202)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) }) }) @@ -513,10 +633,14 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { shouldSkipTest() }) It(`SyncConfig(syncConfigOptions *SyncConfigOptions)`, func() { + schematicsWorkspaceModel := &projectv1.SchematicsWorkspace{ + WorkspaceID: core.StringPtr("us-south.workspace.service.e0106139"), + } + syncConfigOptions := &projectv1.SyncConfigOptions{ ProjectID: &projectIdLink, ID: &configIdLink, - WorkspaceID: core.StringPtr("us-south.workspace.service.e0106139"), + Schematics: schematicsWorkspaceModel, } response, err := projectService.SyncConfig(syncConfigOptions) @@ -570,10 +694,27 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { Version: core.Int64Ptr(int64(38)), } - projectConfig, response, err := projectService.GetConfigVersion(getConfigVersionOptions) + projectConfigVersion, response, err := projectService.GetConfigVersion(getConfigVersionOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(projectConfig).ToNot(BeNil()) + Expect(projectConfigVersion).ToNot(BeNil()) + }) + }) + + Describe(`DeleteProjectEnvironment - Delete an environment`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteProjectEnvironment(deleteProjectEnvironmentOptions *DeleteProjectEnvironmentOptions)`, func() { + deleteProjectEnvironmentOptions := &projectv1.DeleteProjectEnvironmentOptions{ + ProjectID: &projectIdLink, + ID: &projectIdLink, + } + + environmentDeleteResponse, response, err := projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(environmentDeleteResponse).ToNot(BeNil()) }) }) diff --git a/projectv1/project_v1_test.go b/projectv1/project_v1_test.go index f7e0cfa..4f3917d 100644 --- a/projectv1/project_v1_test.go +++ b/projectv1/project_v1_test.go @@ -192,14 +192,9 @@ var _ = Describe(`ProjectV1`, func() { projectPrototypeDefinitionModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") projectPrototypeDefinitionModel.DestroyOnDelete = core.BoolPtr(true) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -221,18 +216,24 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the ProjectConfigPrototypeDefinitionBlock model projectConfigPrototypeDefinitionBlockModel := new(projectv1.ProjectConfigPrototypeDefinitionBlock) - projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("common-variables") + projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel - projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") + projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the ProjectConfigPrototype model projectConfigPrototypeModel := new(projectv1.ProjectConfigPrototype) projectConfigPrototypeModel.Definition = projectConfigPrototypeDefinitionBlockModel + projectConfigPrototypeModel.Schematics = schematicsWorkspaceModel // Construct an instance of the CreateProjectOptions model createProjectOptionsModel := new(projectv1.CreateProjectOptions) @@ -292,7 +293,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) })) }) It(`Invoke CreateProject successfully with retries`, func() { @@ -310,14 +311,9 @@ var _ = Describe(`ProjectV1`, func() { projectPrototypeDefinitionModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") projectPrototypeDefinitionModel.DestroyOnDelete = core.BoolPtr(true) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -339,18 +335,24 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the ProjectConfigPrototypeDefinitionBlock model projectConfigPrototypeDefinitionBlockModel := new(projectv1.ProjectConfigPrototypeDefinitionBlock) - projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("common-variables") + projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel - projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") + projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the ProjectConfigPrototype model projectConfigPrototypeModel := new(projectv1.ProjectConfigPrototype) projectConfigPrototypeModel.Definition = projectConfigPrototypeDefinitionBlockModel + projectConfigPrototypeModel.Schematics = schematicsWorkspaceModel // Construct an instance of the CreateProjectOptions model createProjectOptionsModel := new(projectv1.CreateProjectOptions) @@ -413,7 +415,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) })) }) It(`Invoke CreateProject successfully`, func() { @@ -436,14 +438,9 @@ var _ = Describe(`ProjectV1`, func() { projectPrototypeDefinitionModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") projectPrototypeDefinitionModel.DestroyOnDelete = core.BoolPtr(true) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -465,18 +462,24 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the ProjectConfigPrototypeDefinitionBlock model projectConfigPrototypeDefinitionBlockModel := new(projectv1.ProjectConfigPrototypeDefinitionBlock) - projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("common-variables") + projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel - projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") + projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the ProjectConfigPrototype model projectConfigPrototypeModel := new(projectv1.ProjectConfigPrototype) projectConfigPrototypeModel.Definition = projectConfigPrototypeDefinitionBlockModel + projectConfigPrototypeModel.Schematics = schematicsWorkspaceModel // Construct an instance of the CreateProjectOptions model createProjectOptionsModel := new(projectv1.CreateProjectOptions) @@ -507,14 +510,9 @@ var _ = Describe(`ProjectV1`, func() { projectPrototypeDefinitionModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") projectPrototypeDefinitionModel.DestroyOnDelete = core.BoolPtr(true) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -536,18 +534,24 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the ProjectConfigPrototypeDefinitionBlock model projectConfigPrototypeDefinitionBlockModel := new(projectv1.ProjectConfigPrototypeDefinitionBlock) - projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("common-variables") + projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel - projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") + projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the ProjectConfigPrototype model projectConfigPrototypeModel := new(projectv1.ProjectConfigPrototype) projectConfigPrototypeModel.Definition = projectConfigPrototypeDefinitionBlockModel + projectConfigPrototypeModel.Schematics = schematicsWorkspaceModel // Construct an instance of the CreateProjectOptions model createProjectOptionsModel := new(projectv1.CreateProjectOptions) @@ -599,14 +603,9 @@ var _ = Describe(`ProjectV1`, func() { projectPrototypeDefinitionModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") projectPrototypeDefinitionModel.DestroyOnDelete = core.BoolPtr(true) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -628,18 +627,24 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the ProjectConfigPrototypeDefinitionBlock model projectConfigPrototypeDefinitionBlockModel := new(projectv1.ProjectConfigPrototypeDefinitionBlock) - projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("common-variables") + projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel - projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") + projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the ProjectConfigPrototype model projectConfigPrototypeModel := new(projectv1.ProjectConfigPrototype) projectConfigPrototypeModel.Definition = projectConfigPrototypeDefinitionBlockModel + projectConfigPrototypeModel.Schematics = schematicsWorkspaceModel // Construct an instance of the CreateProjectOptions model createProjectOptionsModel := new(projectv1.CreateProjectOptions) @@ -1039,7 +1044,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) })) }) It(`Invoke GetProject successfully with retries`, func() { @@ -1093,7 +1098,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) })) }) It(`Invoke GetProject successfully`, func() { @@ -1241,32 +1246,1559 @@ var _ = Describe(`ProjectV1`, func() { }) }) }) - Describe(`UpdateProject(updateProjectOptions *UpdateProjectOptions)`, func() { - updateProjectPath := "/v1/projects/testString" + Describe(`UpdateProject(updateProjectOptions *UpdateProjectOptions)`, func() { + updateProjectPath := "/v1/projects/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateProjectPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + })) + }) + It(`Invoke UpdateProject successfully with retries`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + projectService.EnableRetries(0, 0) + + // Construct an instance of the ProjectPrototypePatchDefinitionBlock model + projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) + projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") + projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") + projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) + + // Construct an instance of the UpdateProjectOptions model + updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) + updateProjectOptionsModel.ID = core.StringPtr("testString") + updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel + updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := projectService.UpdateProjectWithContext(ctx, updateProjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.UpdateProject(updateProjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = projectService.UpdateProjectWithContext(ctx, updateProjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateProjectPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + })) + }) + It(`Invoke UpdateProject successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := projectService.UpdateProject(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ProjectPrototypePatchDefinitionBlock model + projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) + projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") + projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") + projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) + + // Construct an instance of the UpdateProjectOptions model + updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) + updateProjectOptionsModel.ID = core.StringPtr("testString") + updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel + updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.UpdateProject(updateProjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateProject with error: Operation validation and request error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectPrototypePatchDefinitionBlock model + projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) + projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") + projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") + projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) + + // Construct an instance of the UpdateProjectOptions model + updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) + updateProjectOptionsModel.ID = core.StringPtr("testString") + updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel + updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := projectService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := projectService.UpdateProject(updateProjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateProjectOptions model with no property values + updateProjectOptionsModelNew := new(projectv1.UpdateProjectOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.UpdateProject(updateProjectOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateProject successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectPrototypePatchDefinitionBlock model + projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) + projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") + projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") + projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) + + // Construct an instance of the UpdateProjectOptions model + updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) + updateProjectOptionsModel.ID = core.StringPtr("testString") + updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel + updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.UpdateProject(updateProjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteProject(deleteProjectOptions *DeleteProjectOptions)`, func() { + deleteProjectPath := "/v1/projects/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteProjectPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteProject successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := projectService.DeleteProject(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteProjectOptions model + deleteProjectOptionsModel := new(projectv1.DeleteProjectOptions) + deleteProjectOptionsModel.ID = core.StringPtr("testString") + deleteProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = projectService.DeleteProject(deleteProjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteProject with error: Operation validation and request error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the DeleteProjectOptions model + deleteProjectOptionsModel := new(projectv1.DeleteProjectOptions) + deleteProjectOptionsModel.ID = core.StringPtr("testString") + deleteProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := projectService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := projectService.DeleteProject(deleteProjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteProjectOptions model with no property values + deleteProjectOptionsModelNew := new(projectv1.DeleteProjectOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = projectService.DeleteProject(deleteProjectOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateProjectEnvironment(createProjectEnvironmentOptions *CreateProjectEnvironmentOptions) - Operation response error`, func() { + createProjectEnvironmentPath := "/v1/projects/testString/environments" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createProjectEnvironmentPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateProjectEnvironment with error: Operation response processing error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionRequiredProperties model + environmentDefinitionRequiredPropertiesModel := new(projectv1.EnvironmentDefinitionRequiredProperties) + environmentDefinitionRequiredPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionRequiredPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionRequiredPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionRequiredPropertiesModel.Input = inputVariableModel + environmentDefinitionRequiredPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the CreateProjectEnvironmentOptions model + createProjectEnvironmentOptionsModel := new(projectv1.CreateProjectEnvironmentOptions) + createProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + createProjectEnvironmentOptionsModel.Definition = environmentDefinitionRequiredPropertiesModel + createProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + projectService.EnableRetries(0, 0) + result, response, operationErr = projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateProjectEnvironment(createProjectEnvironmentOptions *CreateProjectEnvironmentOptions)`, func() { + createProjectEnvironmentPath := "/v1/projects/testString/environments" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createProjectEnvironmentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}`) + })) + }) + It(`Invoke CreateProjectEnvironment successfully with retries`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + projectService.EnableRetries(0, 0) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionRequiredProperties model + environmentDefinitionRequiredPropertiesModel := new(projectv1.EnvironmentDefinitionRequiredProperties) + environmentDefinitionRequiredPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionRequiredPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionRequiredPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionRequiredPropertiesModel.Input = inputVariableModel + environmentDefinitionRequiredPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the CreateProjectEnvironmentOptions model + createProjectEnvironmentOptionsModel := new(projectv1.CreateProjectEnvironmentOptions) + createProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + createProjectEnvironmentOptionsModel.Definition = environmentDefinitionRequiredPropertiesModel + createProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := projectService.CreateProjectEnvironmentWithContext(ctx, createProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = projectService.CreateProjectEnvironmentWithContext(ctx, createProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createProjectEnvironmentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}`) + })) + }) + It(`Invoke CreateProjectEnvironment successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := projectService.CreateProjectEnvironment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionRequiredProperties model + environmentDefinitionRequiredPropertiesModel := new(projectv1.EnvironmentDefinitionRequiredProperties) + environmentDefinitionRequiredPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionRequiredPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionRequiredPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionRequiredPropertiesModel.Input = inputVariableModel + environmentDefinitionRequiredPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the CreateProjectEnvironmentOptions model + createProjectEnvironmentOptionsModel := new(projectv1.CreateProjectEnvironmentOptions) + createProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + createProjectEnvironmentOptionsModel.Definition = environmentDefinitionRequiredPropertiesModel + createProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateProjectEnvironment with error: Operation validation and request error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionRequiredProperties model + environmentDefinitionRequiredPropertiesModel := new(projectv1.EnvironmentDefinitionRequiredProperties) + environmentDefinitionRequiredPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionRequiredPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionRequiredPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionRequiredPropertiesModel.Input = inputVariableModel + environmentDefinitionRequiredPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the CreateProjectEnvironmentOptions model + createProjectEnvironmentOptionsModel := new(projectv1.CreateProjectEnvironmentOptions) + createProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + createProjectEnvironmentOptionsModel.Definition = environmentDefinitionRequiredPropertiesModel + createProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := projectService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateProjectEnvironmentOptions model with no property values + createProjectEnvironmentOptionsModelNew := new(projectv1.CreateProjectEnvironmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateProjectEnvironment successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionRequiredProperties model + environmentDefinitionRequiredPropertiesModel := new(projectv1.EnvironmentDefinitionRequiredProperties) + environmentDefinitionRequiredPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionRequiredPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionRequiredPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionRequiredPropertiesModel.Input = inputVariableModel + environmentDefinitionRequiredPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the CreateProjectEnvironmentOptions model + createProjectEnvironmentOptionsModel := new(projectv1.CreateProjectEnvironmentOptions) + createProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + createProjectEnvironmentOptionsModel.Definition = environmentDefinitionRequiredPropertiesModel + createProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.CreateProjectEnvironment(createProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListProjectEnvironments(listProjectEnvironmentsOptions *ListProjectEnvironmentsOptions) - Operation response error`, func() { + listProjectEnvironmentsPath := "/v1/projects/testString/environments" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listProjectEnvironmentsPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListProjectEnvironments with error: Operation response processing error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ListProjectEnvironmentsOptions model + listProjectEnvironmentsOptionsModel := new(projectv1.ListProjectEnvironmentsOptions) + listProjectEnvironmentsOptionsModel.ProjectID = core.StringPtr("testString") + listProjectEnvironmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + projectService.EnableRetries(0, 0) + result, response, operationErr = projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListProjectEnvironments(listProjectEnvironmentsOptions *ListProjectEnvironmentsOptions)`, func() { + listProjectEnvironmentsPath := "/v1/projects/testString/environments" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listProjectEnvironmentsPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}]}`) + })) + }) + It(`Invoke ListProjectEnvironments successfully with retries`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + projectService.EnableRetries(0, 0) + + // Construct an instance of the ListProjectEnvironmentsOptions model + listProjectEnvironmentsOptionsModel := new(projectv1.ListProjectEnvironmentsOptions) + listProjectEnvironmentsOptionsModel.ProjectID = core.StringPtr("testString") + listProjectEnvironmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := projectService.ListProjectEnvironmentsWithContext(ctx, listProjectEnvironmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = projectService.ListProjectEnvironmentsWithContext(ctx, listProjectEnvironmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listProjectEnvironmentsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"environments": [{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}]}`) + })) + }) + It(`Invoke ListProjectEnvironments successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := projectService.ListProjectEnvironments(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListProjectEnvironmentsOptions model + listProjectEnvironmentsOptionsModel := new(projectv1.ListProjectEnvironmentsOptions) + listProjectEnvironmentsOptionsModel.ProjectID = core.StringPtr("testString") + listProjectEnvironmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListProjectEnvironments with error: Operation validation and request error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ListProjectEnvironmentsOptions model + listProjectEnvironmentsOptionsModel := new(projectv1.ListProjectEnvironmentsOptions) + listProjectEnvironmentsOptionsModel.ProjectID = core.StringPtr("testString") + listProjectEnvironmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := projectService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListProjectEnvironmentsOptions model with no property values + listProjectEnvironmentsOptionsModelNew := new(projectv1.ListProjectEnvironmentsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListProjectEnvironments successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ListProjectEnvironmentsOptions model + listProjectEnvironmentsOptionsModel := new(projectv1.ListProjectEnvironmentsOptions) + listProjectEnvironmentsOptionsModel.ProjectID = core.StringPtr("testString") + listProjectEnvironmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.ListProjectEnvironments(listProjectEnvironmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetProjectEnvironment(getProjectEnvironmentOptions *GetProjectEnvironmentOptions) - Operation response error`, func() { + getProjectEnvironmentPath := "/v1/projects/testString/environments/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getProjectEnvironmentPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetProjectEnvironment with error: Operation response processing error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the GetProjectEnvironmentOptions model + getProjectEnvironmentOptionsModel := new(projectv1.GetProjectEnvironmentOptions) + getProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + projectService.EnableRetries(0, 0) + result, response, operationErr = projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetProjectEnvironment(getProjectEnvironmentOptions *GetProjectEnvironmentOptions)`, func() { + getProjectEnvironmentPath := "/v1/projects/testString/environments/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getProjectEnvironmentPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}`) + })) + }) + It(`Invoke GetProjectEnvironment successfully with retries`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + projectService.EnableRetries(0, 0) + + // Construct an instance of the GetProjectEnvironmentOptions model + getProjectEnvironmentOptionsModel := new(projectv1.GetProjectEnvironmentOptions) + getProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := projectService.GetProjectEnvironmentWithContext(ctx, getProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = projectService.GetProjectEnvironmentWithContext(ctx, getProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getProjectEnvironmentPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}`) + })) + }) + It(`Invoke GetProjectEnvironment successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := projectService.GetProjectEnvironment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetProjectEnvironmentOptions model + getProjectEnvironmentOptionsModel := new(projectv1.GetProjectEnvironmentOptions) + getProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetProjectEnvironment with error: Operation validation and request error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the GetProjectEnvironmentOptions model + getProjectEnvironmentOptionsModel := new(projectv1.GetProjectEnvironmentOptions) + getProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := projectService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetProjectEnvironmentOptions model with no property values + getProjectEnvironmentOptionsModelNew := new(projectv1.GetProjectEnvironmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetProjectEnvironment successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the GetProjectEnvironmentOptions model + getProjectEnvironmentOptionsModel := new(projectv1.GetProjectEnvironmentOptions) + getProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + getProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.GetProjectEnvironment(getProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateProjectEnvironment(updateProjectEnvironmentOptions *UpdateProjectEnvironmentOptions) - Operation response error`, func() { + updateProjectEnvironmentPath := "/v1/projects/testString/environments/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateProjectEnvironmentPath)) + Expect(req.Method).To(Equal("PATCH")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateProjectEnvironment with error: Operation response processing error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionProperties model + environmentDefinitionPropertiesModel := new(projectv1.EnvironmentDefinitionProperties) + environmentDefinitionPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionPropertiesModel.Input = inputVariableModel + environmentDefinitionPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the UpdateProjectEnvironmentOptions model + updateProjectEnvironmentOptionsModel := new(projectv1.UpdateProjectEnvironmentOptions) + updateProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.Definition = environmentDefinitionPropertiesModel + updateProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + projectService.EnableRetries(0, 0) + result, response, operationErr = projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateProjectEnvironment(updateProjectEnvironmentOptions *UpdateProjectEnvironmentOptions)`, func() { + updateProjectEnvironmentPath := "/v1/projects/testString/environments/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateProjectEnvironmentPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}`) + })) + }) + It(`Invoke UpdateProjectEnvironment successfully with retries`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + projectService.EnableRetries(0, 0) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionProperties model + environmentDefinitionPropertiesModel := new(projectv1.EnvironmentDefinitionProperties) + environmentDefinitionPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionPropertiesModel.Input = inputVariableModel + environmentDefinitionPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the UpdateProjectEnvironmentOptions model + updateProjectEnvironmentOptionsModel := new(projectv1.UpdateProjectEnvironmentOptions) + updateProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.Definition = environmentDefinitionPropertiesModel + updateProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := projectService.UpdateProjectEnvironmentWithContext(ctx, updateProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = projectService.UpdateProjectEnvironmentWithContext(ctx, updateProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateProjectEnvironmentPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "created_at": "2019-01-01T12:00:00.000Z", "project_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "target_account": "TargetAccount", "user_modified_at": "2019-01-01T12:00:00.000Z", "definition": {"name": "Name", "description": "Description", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "input": {}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}}}`) + })) + }) + It(`Invoke UpdateProjectEnvironment successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := projectService.UpdateProjectEnvironment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionProperties model + environmentDefinitionPropertiesModel := new(projectv1.EnvironmentDefinitionProperties) + environmentDefinitionPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionPropertiesModel.Input = inputVariableModel + environmentDefinitionPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the UpdateProjectEnvironmentOptions model + updateProjectEnvironmentOptionsModel := new(projectv1.UpdateProjectEnvironmentOptions) + updateProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.Definition = environmentDefinitionPropertiesModel + updateProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateProjectEnvironment with error: Operation validation and request error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionProperties model + environmentDefinitionPropertiesModel := new(projectv1.EnvironmentDefinitionProperties) + environmentDefinitionPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionPropertiesModel.Input = inputVariableModel + environmentDefinitionPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the UpdateProjectEnvironmentOptions model + updateProjectEnvironmentOptionsModel := new(projectv1.UpdateProjectEnvironmentOptions) + updateProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.Definition = environmentDefinitionPropertiesModel + updateProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := projectService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateProjectEnvironmentOptions model with no property values + updateProjectEnvironmentOptionsModelNew := new(projectv1.UpdateProjectEnvironmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateProjectEnvironment successfully`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + + // Construct an instance of the EnvironmentDefinitionProperties model + environmentDefinitionPropertiesModel := new(projectv1.EnvironmentDefinitionProperties) + environmentDefinitionPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionPropertiesModel.Input = inputVariableModel + environmentDefinitionPropertiesModel.ComplianceProfile = projectComplianceProfileModel + + // Construct an instance of the UpdateProjectEnvironmentOptions model + updateProjectEnvironmentOptionsModel := new(projectv1.UpdateProjectEnvironmentOptions) + updateProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + updateProjectEnvironmentOptionsModel.Definition = environmentDefinitionPropertiesModel + updateProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.UpdateProjectEnvironment(updateProjectEnvironmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteProjectEnvironment(deleteProjectEnvironmentOptions *DeleteProjectEnvironmentOptions) - Operation response error`, func() { + deleteProjectEnvironmentPath := "/v1/projects/testString/environments/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteProjectEnvironmentPath)) + Expect(req.Method).To(Equal("DELETE")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke DeleteProjectEnvironment with error: Operation response processing error`, func() { + projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(projectService).ToNot(BeNil()) + + // Construct an instance of the DeleteProjectEnvironmentOptions model + deleteProjectEnvironmentOptionsModel := new(projectv1.DeleteProjectEnvironmentOptions) + deleteProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + projectService.EnableRetries(0, 0) + result, response, operationErr = projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteProjectEnvironment(deleteProjectEnvironmentOptions *DeleteProjectEnvironmentOptions)`, func() { + deleteProjectEnvironmentPath := "/v1/projects/testString/environments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateProjectPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(deleteProjectEnvironmentPath)) + Expect(req.Method).To(Equal("DELETE")) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -1274,10 +2806,10 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + fmt.Fprintf(res, "%s", `{"id": "ID"}`) })) }) - It(`Invoke UpdateProject successfully with retries`, func() { + It(`Invoke DeleteProjectEnvironment successfully with retries`, func() { projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -1286,28 +2818,22 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectService).ToNot(BeNil()) projectService.EnableRetries(0, 0) - // Construct an instance of the ProjectPrototypePatchDefinitionBlock model - projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) - projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") - projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") - projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) - - // Construct an instance of the UpdateProjectOptions model - updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) - updateProjectOptionsModel.ID = core.StringPtr("testString") - updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel - updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteProjectEnvironmentOptions model + deleteProjectEnvironmentOptionsModel := new(projectv1.DeleteProjectEnvironmentOptions) + deleteProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := projectService.UpdateProjectWithContext(ctx, updateProjectOptionsModel) + _, _, operationErr := projectService.DeleteProjectEnvironmentWithContext(ctx, deleteProjectEnvironmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again projectService.DisableRetries() - result, response, operationErr := projectService.UpdateProject(updateProjectOptionsModel) + result, response, operationErr := projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -1315,7 +2841,7 @@ var _ = Describe(`ProjectV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = projectService.UpdateProjectWithContext(ctx, updateProjectOptionsModel) + _, _, operationErr = projectService.DeleteProjectEnvironmentWithContext(ctx, deleteProjectEnvironmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -1329,32 +2855,16 @@ var _ = Describe(`ProjectV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateProjectPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(deleteProjectEnvironmentPath)) + Expect(req.Method).To(Equal("DELETE")) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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": "EventID", "config_id": "ConfigID", "config_version": 13}], "cumulative_needs_attention_view_error": false, "id": "ID", "location": "Location", "resource_group": "ResourceGroup", "state": "ready", "event_notifications_crn": "EventNotificationsCrn", "configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}], "definition": {"name": "Name", "description": "Description", "destroy_on_delete": false}}`) + fmt.Fprintf(res, "%s", `{"id": "ID"}`) })) }) - It(`Invoke UpdateProject successfully`, func() { + It(`Invoke DeleteProjectEnvironment successfully`, func() { projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -1363,31 +2873,25 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := projectService.UpdateProject(nil) + result, response, operationErr := projectService.DeleteProjectEnvironment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ProjectPrototypePatchDefinitionBlock model - projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) - projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") - projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") - projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) - - // Construct an instance of the UpdateProjectOptions model - updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) - updateProjectOptionsModel.ID = core.StringPtr("testString") - updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel - updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteProjectEnvironmentOptions model + deleteProjectEnvironmentOptionsModel := new(projectv1.DeleteProjectEnvironmentOptions) + deleteProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = projectService.UpdateProject(updateProjectOptionsModel) + result, response, operationErr = projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateProject with error: Operation validation and request error`, func() { + It(`Invoke DeleteProjectEnvironment with error: Operation validation and request error`, func() { projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -1395,29 +2899,23 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectPrototypePatchDefinitionBlock model - projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) - projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") - projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") - projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) - - // Construct an instance of the UpdateProjectOptions model - updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) - updateProjectOptionsModel.ID = core.StringPtr("testString") - updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel - updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteProjectEnvironmentOptions model + deleteProjectEnvironmentOptionsModel := new(projectv1.DeleteProjectEnvironmentOptions) + deleteProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := projectService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := projectService.UpdateProject(updateProjectOptionsModel) + result, response, operationErr := projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateProjectOptions model with no property values - updateProjectOptionsModelNew := new(projectv1.UpdateProjectOptions) + // Construct a second instance of the DeleteProjectEnvironmentOptions model with no property values + deleteProjectEnvironmentOptionsModelNew := new(projectv1.DeleteProjectEnvironmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = projectService.UpdateProject(updateProjectOptionsModelNew) + result, response, operationErr = projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -1435,7 +2933,7 @@ var _ = Describe(`ProjectV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateProject successfully`, func() { + It(`Invoke DeleteProjectEnvironment successfully`, func() { projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -1443,20 +2941,14 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectPrototypePatchDefinitionBlock model - projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock) - projectPrototypePatchDefinitionBlockModel.Name = core.StringPtr("acme-microservice") - projectPrototypePatchDefinitionBlockModel.Description = core.StringPtr("A microservice to deploy on top of ACME infrastructure.") - projectPrototypePatchDefinitionBlockModel.DestroyOnDelete = core.BoolPtr(true) - - // Construct an instance of the UpdateProjectOptions model - updateProjectOptionsModel := new(projectv1.UpdateProjectOptions) - updateProjectOptionsModel.ID = core.StringPtr("testString") - updateProjectOptionsModel.Definition = projectPrototypePatchDefinitionBlockModel - updateProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteProjectEnvironmentOptions model + deleteProjectEnvironmentOptionsModel := new(projectv1.DeleteProjectEnvironmentOptions) + deleteProjectEnvironmentOptionsModel.ProjectID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.ID = core.StringPtr("testString") + deleteProjectEnvironmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := projectService.UpdateProject(updateProjectOptionsModel) + result, response, operationErr := projectService.DeleteProjectEnvironment(deleteProjectEnvironmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -1468,74 +2960,6 @@ var _ = Describe(`ProjectV1`, func() { }) }) }) - Describe(`DeleteProject(deleteProjectOptions *DeleteProjectOptions)`, func() { - deleteProjectPath := "/v1/projects/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteProjectPath)) - Expect(req.Method).To(Equal("DELETE")) - - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteProject successfully`, func() { - projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(projectService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := projectService.DeleteProject(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteProjectOptions model - deleteProjectOptionsModel := new(projectv1.DeleteProjectOptions) - deleteProjectOptionsModel.ID = core.StringPtr("testString") - deleteProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = projectService.DeleteProject(deleteProjectOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteProject with error: Operation validation and request error`, func() { - projectService, serviceErr := projectv1.NewProjectV1(&projectv1.ProjectV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(projectService).ToNot(BeNil()) - - // Construct an instance of the DeleteProjectOptions model - deleteProjectOptionsModel := new(projectv1.DeleteProjectOptions) - deleteProjectOptionsModel.ID = core.StringPtr("testString") - deleteProjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := projectService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := projectService.DeleteProject(deleteProjectOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteProjectOptions model with no property values - deleteProjectOptionsModelNew := new(projectv1.DeleteProjectOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = projectService.DeleteProject(deleteProjectOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) Describe(`CreateConfig(createConfigOptions *CreateConfigOptions) - Operation response error`, func() { createConfigPath := "/v1/projects/testString/configs" Context(`Using mock server endpoint with invalid JSON response`, func() { @@ -1559,14 +2983,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -1580,7 +2999,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -1595,16 +3014,22 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("env-stage") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace.") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"env:stage", "governance:test", "build:0"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the CreateConfigOptions model createConfigOptionsModel := new(projectv1.CreateConfigOptions) createConfigOptionsModel.ProjectID = core.StringPtr("testString") createConfigOptionsModel.Definition = projectConfigPrototypeDefinitionBlockModel + createConfigOptionsModel.Schematics = schematicsWorkspaceModel createConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := projectService.CreateConfig(createConfigOptionsModel) @@ -1657,7 +3082,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}, "approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke CreateConfig successfully with retries`, func() { @@ -1669,14 +3094,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectService).ToNot(BeNil()) projectService.EnableRetries(0, 0) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -1690,7 +3110,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -1705,16 +3125,22 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("env-stage") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace.") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"env:stage", "governance:test", "build:0"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the CreateConfigOptions model createConfigOptionsModel := new(projectv1.CreateConfigOptions) createConfigOptionsModel.ProjectID = core.StringPtr("testString") createConfigOptionsModel.Definition = projectConfigPrototypeDefinitionBlockModel + createConfigOptionsModel.Schematics = schematicsWorkspaceModel createConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -1770,7 +3196,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}, "approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke CreateConfig successfully`, func() { @@ -1787,14 +3213,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -1808,7 +3229,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -1823,16 +3244,22 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("env-stage") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace.") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"env:stage", "governance:test", "build:0"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the CreateConfigOptions model createConfigOptionsModel := new(projectv1.CreateConfigOptions) createConfigOptionsModel.ProjectID = core.StringPtr("testString") createConfigOptionsModel.Definition = projectConfigPrototypeDefinitionBlockModel + createConfigOptionsModel.Schematics = schematicsWorkspaceModel createConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -1850,14 +3277,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -1871,7 +3293,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -1886,16 +3308,22 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("env-stage") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace.") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"env:stage", "governance:test", "build:0"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the CreateConfigOptions model createConfigOptionsModel := new(projectv1.CreateConfigOptions) createConfigOptionsModel.ProjectID = core.StringPtr("testString") createConfigOptionsModel.Definition = projectConfigPrototypeDefinitionBlockModel + createConfigOptionsModel.Schematics = schematicsWorkspaceModel createConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := projectService.SetServiceURL("") @@ -1934,14 +3362,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -1955,7 +3378,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -1970,16 +3393,22 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("env-stage") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace.") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"env:stage", "governance:test", "build:0"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + // Construct an instance of the CreateConfigOptions model createConfigOptionsModel := new(projectv1.CreateConfigOptions) createConfigOptionsModel.ProjectID = core.StringPtr("testString") createConfigOptionsModel.Definition = projectConfigPrototypeDefinitionBlockModel + createConfigOptionsModel.Schematics = schematicsWorkspaceModel createConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -2057,7 +3486,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}]}`) + fmt.Fprintf(res, "%s", `{"configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}]}`) })) }) It(`Invoke ListConfigs successfully with retries`, func() { @@ -2111,7 +3540,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"configs": [{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}]}`) + fmt.Fprintf(res, "%s", `{"configs": [{"approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "href": "Href", "definition": {"name": "Name", "description": "Description"}}]}`) })) }) It(`Invoke ListConfigs successfully`, func() { @@ -2270,7 +3699,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}, "approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke GetConfig successfully with retries`, func() { @@ -2325,7 +3754,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}, "approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke GetConfig successfully`, func() { @@ -2447,14 +3876,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -2468,7 +3892,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -2483,6 +3907,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypePatchDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypePatchDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypePatchDefinitionBlockModel.LocatorID = core.StringPtr("testString") @@ -2546,7 +3971,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}, "approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke UpdateConfig successfully with retries`, func() { @@ -2558,14 +3983,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectService).ToNot(BeNil()) projectService.EnableRetries(0, 0) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -2579,7 +3999,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -2594,6 +4014,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypePatchDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypePatchDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypePatchDefinitionBlockModel.LocatorID = core.StringPtr("testString") @@ -2660,7 +4081,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}, "approved_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"needs_attention_state": ["anyValue"], "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke UpdateConfig successfully`, func() { @@ -2677,14 +4098,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -2698,7 +4114,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -2713,6 +4129,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypePatchDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypePatchDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypePatchDefinitionBlockModel.LocatorID = core.StringPtr("testString") @@ -2741,14 +4158,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -2762,7 +4174,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -2777,6 +4189,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypePatchDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypePatchDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypePatchDefinitionBlockModel.LocatorID = core.StringPtr("testString") @@ -2826,14 +4239,9 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") @@ -2847,7 +4255,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -2862,6 +4270,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypePatchDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypePatchDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypePatchDefinitionBlockModel.LocatorID = core.StringPtr("testString") @@ -3185,7 +4594,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke ForceApprove successfully with retries`, func() { @@ -3257,7 +4666,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke ForceApprove successfully`, func() { @@ -3439,7 +4848,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke Approve successfully with retries`, func() { @@ -3511,7 +4920,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke Approve successfully`, func() { @@ -3681,7 +5090,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke ValidateConfig successfully with retries`, func() { @@ -3739,7 +5148,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke ValidateConfig successfully`, func() { @@ -3904,7 +5313,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke DeployConfig successfully with retries`, func() { @@ -3959,7 +5368,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke DeployConfig successfully`, func() { @@ -4171,11 +5580,15 @@ var _ = Describe(`ProjectV1`, func() { Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("us-south.workspace.service.e0106139") + // Construct an instance of the SyncConfigOptions model syncConfigOptionsModel := new(projectv1.SyncConfigOptions) syncConfigOptionsModel.ProjectID = core.StringPtr("testString") syncConfigOptionsModel.ID = core.StringPtr("testString") - syncConfigOptionsModel.WorkspaceID = core.StringPtr("us-south.workspace.service.e0106139") + syncConfigOptionsModel.Schematics = schematicsWorkspaceModel syncConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -4191,11 +5604,15 @@ var _ = Describe(`ProjectV1`, func() { Expect(serviceErr).To(BeNil()) Expect(projectService).ToNot(BeNil()) + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("us-south.workspace.service.e0106139") + // Construct an instance of the SyncConfigOptions model syncConfigOptionsModel := new(projectv1.SyncConfigOptions) syncConfigOptionsModel.ProjectID = core.StringPtr("testString") syncConfigOptionsModel.ID = core.StringPtr("testString") - syncConfigOptionsModel.WorkspaceID = core.StringPtr("us-south.workspace.service.e0106139") + syncConfigOptionsModel.Schematics = schematicsWorkspaceModel syncConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := projectService.SetServiceURL("") @@ -4714,7 +6131,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke GetConfigVersion successfully with retries`, func() { @@ -4770,7 +6187,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "updated_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "authorizations": {"trusted_profile": {"id": "ID", "target_iam_id": "TargetIamID"}, "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "project_id": "ProjectID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "state": "approved", "update_available": false, "created_at": "2019-01-01T12:00:00.000Z", "user_modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"is_forced": true, "comment": "Comment", "timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "last_save": "2019-01-01T12:00:00.000Z", "references": {"anyKey": "anyValue"}, "last_validated": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}, "cost_estimate": {"version": "Version", "currency": "Currency", "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z", "user_id": "UserID"}, "cra_logs": {"cra_version": "CraVersion", "schema_version": "SchemaVersion", "status": "Status", "summary": {"anyKey": "anyValue"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "pre_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "post_job": {"id": "ID", "summary": {"anyKey": "anyValue"}}, "job": {"id": "ID", "summary": {"plan_summary": {"anyKey": "anyValue"}, "apply_summary": {"anyKey": "anyValue"}, "destroy_summary": {"anyKey": "anyValue"}, "message_summary": {"anyKey": "anyValue"}, "plan_messages": {"anyKey": "anyValue"}, "apply_messages": {"anyKey": "anyValue"}, "destroy_messages": {"anyKey": "anyValue"}}}}, "schematics": {"workspace_id": "WorkspaceID"}, "definition": {"name": "Name", "description": "Description", "labels": ["Labels"], "environment": "Environment", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "Method", "api_key": "ApiKey"}, "compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "input": {}, "setting": {}, "type": "terraform_template", "output": [{"name": "Name", "description": "Description", "value": "anyValue"}]}}`) })) }) It(`Invoke GetConfigVersion successfully`, func() { @@ -5116,21 +6533,13 @@ var _ = Describe(`ProjectV1`, func() { Expect(approveOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateConfigOptions successfully`, func() { - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - Expect(projectConfigAuthTrustedProfileModel).ToNot(BeNil()) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - Expect(projectConfigAuthTrustedProfileModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(projectConfigAuthTrustedProfileModel.TargetIamID).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) Expect(projectConfigAuthModel).ToNot(BeNil()) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") - Expect(projectConfigAuthModel.TrustedProfile).To(Equal(projectConfigAuthTrustedProfileModel)) + Expect(projectConfigAuthModel.TrustedProfileID).To(Equal(core.StringPtr("testString"))) Expect(projectConfigAuthModel.Method).To(Equal(core.StringPtr("testString"))) Expect(projectConfigAuthModel.ApiKey).To(Equal(core.StringPtr("testString"))) @@ -5151,7 +6560,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) Expect(inputVariableModel).ToNot(BeNil()) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -5167,7 +6576,7 @@ var _ = Describe(`ProjectV1`, func() { Expect(inputVariableModel.GetProperties()).To(BeEmpty()) inputVariableModelExpectedMap := make(map[string]interface{}) - inputVariableModelExpectedMap["account_id"] = core.StringPtr(`$configs[].name["account-stage"].input.account_id`) + inputVariableModelExpectedMap["account_id"] = core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`) inputVariableModelExpectedMap["resource_group"] = core.StringPtr("stage") inputVariableModelExpectedMap["access_tags"] = core.StringPtr(`["env:stage"]`) inputVariableModelExpectedMap["logdna_name"] = core.StringPtr("Name of the LogDNA stage service instance") @@ -5198,6 +6607,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("env-stage") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace.") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"env:stage", "governance:test", "build:0"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") @@ -5206,24 +6616,103 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectConfigPrototypeDefinitionBlockModel.Name).To(Equal(core.StringPtr("env-stage"))) Expect(projectConfigPrototypeDefinitionBlockModel.Description).To(Equal(core.StringPtr("Stage environment configuration, which includes services common to all the environment regions. There must be a blueprint configuring all the services common to the stage regions. It is a terraform_template type of configuration that points to a Github repo hosting the terraform modules that can be deployed by a Schematics Workspace."))) Expect(projectConfigPrototypeDefinitionBlockModel.Labels).To(Equal([]string{"env:stage", "governance:test", "build:0"})) + Expect(projectConfigPrototypeDefinitionBlockModel.Environment).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypeDefinitionBlockModel.Authorizations).To(Equal(projectConfigAuthModel)) Expect(projectConfigPrototypeDefinitionBlockModel.ComplianceProfile).To(Equal(projectComplianceProfileModel)) Expect(projectConfigPrototypeDefinitionBlockModel.LocatorID).To(Equal(core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"))) Expect(projectConfigPrototypeDefinitionBlockModel.Input).To(Equal(inputVariableModel)) Expect(projectConfigPrototypeDefinitionBlockModel.Setting).To(Equal(projectConfigSettingModel)) + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + Expect(schematicsWorkspaceModel).ToNot(BeNil()) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + Expect(schematicsWorkspaceModel.WorkspaceID).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the CreateConfigOptions model projectID := "testString" var createConfigOptionsDefinition *projectv1.ProjectConfigPrototypeDefinitionBlock = nil createConfigOptionsModel := projectService.NewCreateConfigOptions(projectID, createConfigOptionsDefinition) createConfigOptionsModel.SetProjectID("testString") createConfigOptionsModel.SetDefinition(projectConfigPrototypeDefinitionBlockModel) + createConfigOptionsModel.SetSchematics(schematicsWorkspaceModel) createConfigOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createConfigOptionsModel).ToNot(BeNil()) Expect(createConfigOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) Expect(createConfigOptionsModel.Definition).To(Equal(projectConfigPrototypeDefinitionBlockModel)) + Expect(createConfigOptionsModel.Schematics).To(Equal(schematicsWorkspaceModel)) Expect(createConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateProjectEnvironmentOptions successfully`, func() { + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + Expect(projectConfigAuthModel).ToNot(BeNil()) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + Expect(projectConfigAuthModel.TrustedProfileID).To(Equal(core.StringPtr("testString"))) + Expect(projectConfigAuthModel.Method).To(Equal(core.StringPtr("API_KEY"))) + Expect(projectConfigAuthModel.ApiKey).To(Equal(core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9"))) + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + Expect(inputVariableModel).ToNot(BeNil()) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + Expect(inputVariableModel.GetProperties()).ToNot(BeEmpty()) + Expect(inputVariableModel.GetProperty("resource_group")).To(Equal(core.StringPtr("stage"))) + Expect(inputVariableModel.GetProperty("region")).To(Equal(core.StringPtr("us-south"))) + + inputVariableModel.SetProperties(nil) + Expect(inputVariableModel.GetProperties()).To(BeEmpty()) + + inputVariableModelExpectedMap := make(map[string]interface{}) + inputVariableModelExpectedMap["resource_group"] = core.StringPtr("stage") + inputVariableModelExpectedMap["region"] = core.StringPtr("us-south") + inputVariableModel.SetProperties(inputVariableModelExpectedMap) + inputVariableModelActualMap := inputVariableModel.GetProperties() + Expect(inputVariableModelActualMap).To(Equal(inputVariableModelExpectedMap)) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + Expect(projectComplianceProfileModel).ToNot(BeNil()) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + Expect(projectComplianceProfileModel.ID).To(Equal(core.StringPtr("some-profile-id"))) + Expect(projectComplianceProfileModel.InstanceID).To(Equal(core.StringPtr("some-instance-id"))) + Expect(projectComplianceProfileModel.InstanceLocation).To(Equal(core.StringPtr("us-south"))) + Expect(projectComplianceProfileModel.AttachmentID).To(Equal(core.StringPtr("some-attachment-id"))) + Expect(projectComplianceProfileModel.ProfileName).To(Equal(core.StringPtr("some-profile-name"))) + + // Construct an instance of the EnvironmentDefinitionRequiredProperties model + environmentDefinitionRequiredPropertiesModel := new(projectv1.EnvironmentDefinitionRequiredProperties) + Expect(environmentDefinitionRequiredPropertiesModel).ToNot(BeNil()) + environmentDefinitionRequiredPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionRequiredPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionRequiredPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionRequiredPropertiesModel.Input = inputVariableModel + environmentDefinitionRequiredPropertiesModel.ComplianceProfile = projectComplianceProfileModel + Expect(environmentDefinitionRequiredPropertiesModel.Name).To(Equal(core.StringPtr("development"))) + Expect(environmentDefinitionRequiredPropertiesModel.Description).To(Equal(core.StringPtr("The environment 'development'"))) + Expect(environmentDefinitionRequiredPropertiesModel.Authorizations).To(Equal(projectConfigAuthModel)) + Expect(environmentDefinitionRequiredPropertiesModel.Input).To(Equal(inputVariableModel)) + Expect(environmentDefinitionRequiredPropertiesModel.ComplianceProfile).To(Equal(projectComplianceProfileModel)) + + // Construct an instance of the CreateProjectEnvironmentOptions model + projectID := "testString" + var createProjectEnvironmentOptionsDefinition *projectv1.EnvironmentDefinitionRequiredProperties = nil + createProjectEnvironmentOptionsModel := projectService.NewCreateProjectEnvironmentOptions(projectID, createProjectEnvironmentOptionsDefinition) + createProjectEnvironmentOptionsModel.SetProjectID("testString") + createProjectEnvironmentOptionsModel.SetDefinition(environmentDefinitionRequiredPropertiesModel) + createProjectEnvironmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createProjectEnvironmentOptionsModel).ToNot(BeNil()) + Expect(createProjectEnvironmentOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(createProjectEnvironmentOptionsModel.Definition).To(Equal(environmentDefinitionRequiredPropertiesModel)) + Expect(createProjectEnvironmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateProjectOptions successfully`, func() { // Construct an instance of the ProjectPrototypeDefinition model projectPrototypeDefinitionModel := new(projectv1.ProjectPrototypeDefinition) @@ -5235,21 +6724,13 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectPrototypeDefinitionModel.Description).To(Equal(core.StringPtr("A microservice to deploy on top of ACME infrastructure."))) Expect(projectPrototypeDefinitionModel.DestroyOnDelete).To(Equal(core.BoolPtr(true))) - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - Expect(projectConfigAuthTrustedProfileModel).ToNot(BeNil()) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - Expect(projectConfigAuthTrustedProfileModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(projectConfigAuthTrustedProfileModel.TargetIamID).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) Expect(projectConfigAuthModel).ToNot(BeNil()) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") - Expect(projectConfigAuthModel.TrustedProfile).To(Equal(projectConfigAuthTrustedProfileModel)) + Expect(projectConfigAuthModel.TrustedProfileID).To(Equal(core.StringPtr("testString"))) Expect(projectConfigAuthModel.Method).To(Equal(core.StringPtr("testString"))) Expect(projectConfigAuthModel.ApiKey).To(Equal(core.StringPtr("testString"))) @@ -5302,28 +6783,38 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the ProjectConfigPrototypeDefinitionBlock model projectConfigPrototypeDefinitionBlockModel := new(projectv1.ProjectConfigPrototypeDefinitionBlock) Expect(projectConfigPrototypeDefinitionBlockModel).ToNot(BeNil()) - projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("common-variables") + projectConfigPrototypeDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypeDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypeDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel - projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global") + projectConfigPrototypeDefinitionBlockModel.LocatorID = core.StringPtr("testString") projectConfigPrototypeDefinitionBlockModel.Input = inputVariableModel projectConfigPrototypeDefinitionBlockModel.Setting = projectConfigSettingModel - Expect(projectConfigPrototypeDefinitionBlockModel.Name).To(Equal(core.StringPtr("common-variables"))) + Expect(projectConfigPrototypeDefinitionBlockModel.Name).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypeDefinitionBlockModel.Description).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypeDefinitionBlockModel.Labels).To(Equal([]string{"testString"})) + Expect(projectConfigPrototypeDefinitionBlockModel.Environment).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypeDefinitionBlockModel.Authorizations).To(Equal(projectConfigAuthModel)) Expect(projectConfigPrototypeDefinitionBlockModel.ComplianceProfile).To(Equal(projectComplianceProfileModel)) - Expect(projectConfigPrototypeDefinitionBlockModel.LocatorID).To(Equal(core.StringPtr("1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"))) + Expect(projectConfigPrototypeDefinitionBlockModel.LocatorID).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypeDefinitionBlockModel.Input).To(Equal(inputVariableModel)) Expect(projectConfigPrototypeDefinitionBlockModel.Setting).To(Equal(projectConfigSettingModel)) + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + Expect(schematicsWorkspaceModel).ToNot(BeNil()) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("testString") + Expect(schematicsWorkspaceModel.WorkspaceID).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the ProjectConfigPrototype model projectConfigPrototypeModel := new(projectv1.ProjectConfigPrototype) Expect(projectConfigPrototypeModel).ToNot(BeNil()) projectConfigPrototypeModel.Definition = projectConfigPrototypeDefinitionBlockModel + projectConfigPrototypeModel.Schematics = schematicsWorkspaceModel Expect(projectConfigPrototypeModel.Definition).To(Equal(projectConfigPrototypeDefinitionBlockModel)) + Expect(projectConfigPrototypeModel.Schematics).To(Equal(schematicsWorkspaceModel)) // Construct an instance of the CreateProjectOptions model var createProjectOptionsDefinition *projectv1.ProjectPrototypeDefinition = nil @@ -5371,6 +6862,19 @@ var _ = Describe(`ProjectV1`, func() { Expect(deleteConfigVersionOptionsModel.Version).To(Equal(core.Int64Ptr(int64(38)))) Expect(deleteConfigVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteProjectEnvironmentOptions successfully`, func() { + // Construct an instance of the DeleteProjectEnvironmentOptions model + projectID := "testString" + id := "testString" + deleteProjectEnvironmentOptionsModel := projectService.NewDeleteProjectEnvironmentOptions(projectID, id) + deleteProjectEnvironmentOptionsModel.SetProjectID("testString") + deleteProjectEnvironmentOptionsModel.SetID("testString") + deleteProjectEnvironmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteProjectEnvironmentOptionsModel).ToNot(BeNil()) + Expect(deleteProjectEnvironmentOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(deleteProjectEnvironmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteProjectEnvironmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteProjectOptions successfully`, func() { // Construct an instance of the DeleteProjectOptions model id := "testString" @@ -5394,6 +6898,12 @@ var _ = Describe(`ProjectV1`, func() { Expect(deployConfigOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deployConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewEnvironmentDefinitionRequiredProperties successfully`, func() { + name := "testString" + _model, err := projectService.NewEnvironmentDefinitionRequiredProperties(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewForceApproveOptions successfully`, func() { // Construct an instance of the ForceApproveOptions model projectID := "testString" @@ -5438,6 +6948,19 @@ var _ = Describe(`ProjectV1`, func() { Expect(getConfigVersionOptionsModel.Version).To(Equal(core.Int64Ptr(int64(38)))) Expect(getConfigVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetProjectEnvironmentOptions successfully`, func() { + // Construct an instance of the GetProjectEnvironmentOptions model + projectID := "testString" + id := "testString" + getProjectEnvironmentOptionsModel := projectService.NewGetProjectEnvironmentOptions(projectID, id) + getProjectEnvironmentOptionsModel.SetProjectID("testString") + getProjectEnvironmentOptionsModel.SetID("testString") + getProjectEnvironmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getProjectEnvironmentOptionsModel).ToNot(BeNil()) + Expect(getProjectEnvironmentOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(getProjectEnvironmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getProjectEnvironmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetProjectOptions successfully`, func() { // Construct an instance of the GetProjectOptions model id := "testString" @@ -5484,6 +7007,16 @@ var _ = Describe(`ProjectV1`, func() { Expect(listConfigsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) Expect(listConfigsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListProjectEnvironmentsOptions successfully`, func() { + // Construct an instance of the ListProjectEnvironmentsOptions model + projectID := "testString" + listProjectEnvironmentsOptionsModel := projectService.NewListProjectEnvironmentsOptions(projectID) + listProjectEnvironmentsOptionsModel.SetProjectID("testString") + listProjectEnvironmentsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listProjectEnvironmentsOptionsModel).ToNot(BeNil()) + Expect(listProjectEnvironmentsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(listProjectEnvironmentsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListProjectsOptions successfully`, func() { // Construct an instance of the ListProjectsOptions model listProjectsOptionsModel := projectService.NewListProjectsOptions() @@ -5502,8 +7035,7 @@ var _ = Describe(`ProjectV1`, func() { }) It(`Invoke NewProjectConfigPrototypeDefinitionBlock successfully`, func() { name := "testString" - locatorID := "testString" - _model, err := projectService.NewProjectConfigPrototypeDefinitionBlock(name, locatorID) + _model, err := projectService.NewProjectConfigPrototypeDefinitionBlock(name) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) @@ -5514,18 +7046,24 @@ var _ = Describe(`ProjectV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewSyncConfigOptions successfully`, func() { + // Construct an instance of the SchematicsWorkspace model + schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) + Expect(schematicsWorkspaceModel).ToNot(BeNil()) + schematicsWorkspaceModel.WorkspaceID = core.StringPtr("us-south.workspace.service.e0106139") + Expect(schematicsWorkspaceModel.WorkspaceID).To(Equal(core.StringPtr("us-south.workspace.service.e0106139"))) + // Construct an instance of the SyncConfigOptions model projectID := "testString" id := "testString" syncConfigOptionsModel := projectService.NewSyncConfigOptions(projectID, id) syncConfigOptionsModel.SetProjectID("testString") syncConfigOptionsModel.SetID("testString") - syncConfigOptionsModel.SetWorkspaceID("us-south.workspace.service.e0106139") + syncConfigOptionsModel.SetSchematics(schematicsWorkspaceModel) syncConfigOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(syncConfigOptionsModel).ToNot(BeNil()) Expect(syncConfigOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) Expect(syncConfigOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(syncConfigOptionsModel.WorkspaceID).To(Equal(core.StringPtr("us-south.workspace.service.e0106139"))) + Expect(syncConfigOptionsModel.Schematics).To(Equal(schematicsWorkspaceModel)) Expect(syncConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUndeployConfigOptions successfully`, func() { @@ -5542,21 +7080,13 @@ var _ = Describe(`ProjectV1`, func() { Expect(undeployConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateConfigOptions successfully`, func() { - // Construct an instance of the ProjectConfigAuthTrustedProfile model - projectConfigAuthTrustedProfileModel := new(projectv1.ProjectConfigAuthTrustedProfile) - Expect(projectConfigAuthTrustedProfileModel).ToNot(BeNil()) - projectConfigAuthTrustedProfileModel.ID = core.StringPtr("testString") - projectConfigAuthTrustedProfileModel.TargetIamID = core.StringPtr("testString") - Expect(projectConfigAuthTrustedProfileModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(projectConfigAuthTrustedProfileModel.TargetIamID).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) Expect(projectConfigAuthModel).ToNot(BeNil()) - projectConfigAuthModel.TrustedProfile = projectConfigAuthTrustedProfileModel + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") projectConfigAuthModel.Method = core.StringPtr("testString") projectConfigAuthModel.ApiKey = core.StringPtr("testString") - Expect(projectConfigAuthModel.TrustedProfile).To(Equal(projectConfigAuthTrustedProfileModel)) + Expect(projectConfigAuthModel.TrustedProfileID).To(Equal(core.StringPtr("testString"))) Expect(projectConfigAuthModel.Method).To(Equal(core.StringPtr("testString"))) Expect(projectConfigAuthModel.ApiKey).To(Equal(core.StringPtr("testString"))) @@ -5577,7 +7107,7 @@ var _ = Describe(`ProjectV1`, func() { // Construct an instance of the InputVariable model inputVariableModel := new(projectv1.InputVariable) Expect(inputVariableModel).ToNot(BeNil()) - inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name["account-stage"].input.account_id`)) + inputVariableModel.SetProperty("account_id", core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`)) inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) inputVariableModel.SetProperty("access_tags", core.StringPtr(`["env:stage"]`)) inputVariableModel.SetProperty("logdna_name", core.StringPtr("Name of the LogDNA stage service instance")) @@ -5593,7 +7123,7 @@ var _ = Describe(`ProjectV1`, func() { Expect(inputVariableModel.GetProperties()).To(BeEmpty()) inputVariableModelExpectedMap := make(map[string]interface{}) - inputVariableModelExpectedMap["account_id"] = core.StringPtr(`$configs[].name["account-stage"].input.account_id`) + inputVariableModelExpectedMap["account_id"] = core.StringPtr(`$configs[].name[\"account-stage\"].input.account_id`) inputVariableModelExpectedMap["resource_group"] = core.StringPtr("stage") inputVariableModelExpectedMap["access_tags"] = core.StringPtr(`["env:stage"]`) inputVariableModelExpectedMap["logdna_name"] = core.StringPtr("Name of the LogDNA stage service instance") @@ -5624,6 +7154,7 @@ var _ = Describe(`ProjectV1`, func() { projectConfigPrototypePatchDefinitionBlockModel.Name = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Description = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Labels = []string{"testString"} + projectConfigPrototypePatchDefinitionBlockModel.Environment = core.StringPtr("testString") projectConfigPrototypePatchDefinitionBlockModel.Authorizations = projectConfigAuthModel projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile = projectComplianceProfileModel projectConfigPrototypePatchDefinitionBlockModel.LocatorID = core.StringPtr("testString") @@ -5632,6 +7163,7 @@ var _ = Describe(`ProjectV1`, func() { Expect(projectConfigPrototypePatchDefinitionBlockModel.Name).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypePatchDefinitionBlockModel.Description).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypePatchDefinitionBlockModel.Labels).To(Equal([]string{"testString"})) + Expect(projectConfigPrototypePatchDefinitionBlockModel.Environment).To(Equal(core.StringPtr("testString"))) Expect(projectConfigPrototypePatchDefinitionBlockModel.Authorizations).To(Equal(projectConfigAuthModel)) Expect(projectConfigPrototypePatchDefinitionBlockModel.ComplianceProfile).To(Equal(projectComplianceProfileModel)) Expect(projectConfigPrototypePatchDefinitionBlockModel.LocatorID).To(Equal(core.StringPtr("testString"))) @@ -5653,6 +7185,79 @@ var _ = Describe(`ProjectV1`, func() { Expect(updateConfigOptionsModel.Definition).To(Equal(projectConfigPrototypePatchDefinitionBlockModel)) Expect(updateConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateProjectEnvironmentOptions successfully`, func() { + // Construct an instance of the ProjectConfigAuth model + projectConfigAuthModel := new(projectv1.ProjectConfigAuth) + Expect(projectConfigAuthModel).ToNot(BeNil()) + projectConfigAuthModel.TrustedProfileID = core.StringPtr("testString") + projectConfigAuthModel.Method = core.StringPtr("API_KEY") + projectConfigAuthModel.ApiKey = core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9") + Expect(projectConfigAuthModel.TrustedProfileID).To(Equal(core.StringPtr("testString"))) + Expect(projectConfigAuthModel.Method).To(Equal(core.StringPtr("API_KEY"))) + Expect(projectConfigAuthModel.ApiKey).To(Equal(core.StringPtr("TbcdlprpFODhkpns9e0daOWnAwd2tXwSYtPn8rpEd8d9"))) + + // Construct an instance of the InputVariable model + inputVariableModel := new(projectv1.InputVariable) + Expect(inputVariableModel).ToNot(BeNil()) + inputVariableModel.SetProperty("resource_group", core.StringPtr("stage")) + inputVariableModel.SetProperty("region", core.StringPtr("us-south")) + Expect(inputVariableModel.GetProperties()).ToNot(BeEmpty()) + Expect(inputVariableModel.GetProperty("resource_group")).To(Equal(core.StringPtr("stage"))) + Expect(inputVariableModel.GetProperty("region")).To(Equal(core.StringPtr("us-south"))) + + inputVariableModel.SetProperties(nil) + Expect(inputVariableModel.GetProperties()).To(BeEmpty()) + + inputVariableModelExpectedMap := make(map[string]interface{}) + inputVariableModelExpectedMap["resource_group"] = core.StringPtr("stage") + inputVariableModelExpectedMap["region"] = core.StringPtr("us-south") + inputVariableModel.SetProperties(inputVariableModelExpectedMap) + inputVariableModelActualMap := inputVariableModel.GetProperties() + Expect(inputVariableModelActualMap).To(Equal(inputVariableModelExpectedMap)) + + // Construct an instance of the ProjectComplianceProfile model + projectComplianceProfileModel := new(projectv1.ProjectComplianceProfile) + Expect(projectComplianceProfileModel).ToNot(BeNil()) + projectComplianceProfileModel.ID = core.StringPtr("some-profile-id") + projectComplianceProfileModel.InstanceID = core.StringPtr("some-instance-id") + projectComplianceProfileModel.InstanceLocation = core.StringPtr("us-south") + projectComplianceProfileModel.AttachmentID = core.StringPtr("some-attachment-id") + projectComplianceProfileModel.ProfileName = core.StringPtr("some-profile-name") + Expect(projectComplianceProfileModel.ID).To(Equal(core.StringPtr("some-profile-id"))) + Expect(projectComplianceProfileModel.InstanceID).To(Equal(core.StringPtr("some-instance-id"))) + Expect(projectComplianceProfileModel.InstanceLocation).To(Equal(core.StringPtr("us-south"))) + Expect(projectComplianceProfileModel.AttachmentID).To(Equal(core.StringPtr("some-attachment-id"))) + Expect(projectComplianceProfileModel.ProfileName).To(Equal(core.StringPtr("some-profile-name"))) + + // Construct an instance of the EnvironmentDefinitionProperties model + environmentDefinitionPropertiesModel := new(projectv1.EnvironmentDefinitionProperties) + Expect(environmentDefinitionPropertiesModel).ToNot(BeNil()) + environmentDefinitionPropertiesModel.Name = core.StringPtr("development") + environmentDefinitionPropertiesModel.Description = core.StringPtr("The environment 'development'") + environmentDefinitionPropertiesModel.Authorizations = projectConfigAuthModel + environmentDefinitionPropertiesModel.Input = inputVariableModel + environmentDefinitionPropertiesModel.ComplianceProfile = projectComplianceProfileModel + Expect(environmentDefinitionPropertiesModel.Name).To(Equal(core.StringPtr("development"))) + Expect(environmentDefinitionPropertiesModel.Description).To(Equal(core.StringPtr("The environment 'development'"))) + Expect(environmentDefinitionPropertiesModel.Authorizations).To(Equal(projectConfigAuthModel)) + Expect(environmentDefinitionPropertiesModel.Input).To(Equal(inputVariableModel)) + Expect(environmentDefinitionPropertiesModel.ComplianceProfile).To(Equal(projectComplianceProfileModel)) + + // Construct an instance of the UpdateProjectEnvironmentOptions model + projectID := "testString" + id := "testString" + var updateProjectEnvironmentOptionsDefinition *projectv1.EnvironmentDefinitionProperties = nil + updateProjectEnvironmentOptionsModel := projectService.NewUpdateProjectEnvironmentOptions(projectID, id, updateProjectEnvironmentOptionsDefinition) + updateProjectEnvironmentOptionsModel.SetProjectID("testString") + updateProjectEnvironmentOptionsModel.SetID("testString") + updateProjectEnvironmentOptionsModel.SetDefinition(environmentDefinitionPropertiesModel) + updateProjectEnvironmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateProjectEnvironmentOptionsModel).ToNot(BeNil()) + Expect(updateProjectEnvironmentOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(updateProjectEnvironmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateProjectEnvironmentOptionsModel.Definition).To(Equal(environmentDefinitionPropertiesModel)) + Expect(updateProjectEnvironmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateProjectOptions successfully`, func() { // Construct an instance of the ProjectPrototypePatchDefinitionBlock model projectPrototypePatchDefinitionBlockModel := new(projectv1.ProjectPrototypePatchDefinitionBlock)