From 63b8c7ff91ff9115cf4817f7c3b2366b9a14148b Mon Sep 17 00:00:00 2001 From: dvesperini Date: Mon, 18 Mar 2024 14:08:59 +0100 Subject: [PATCH] new main updated Signed-off-by: dvesperini --- projectv1/project_v1.go | 883 ++++++++++++- projectv1/project_v1_examples_test.go | 131 ++ projectv1/project_v1_integration_test.go | 123 ++ projectv1/project_v1_test.go | 1445 +++++++++++++++++++++- 4 files changed, 2545 insertions(+), 37 deletions(-) diff --git a/projectv1/project_v1.go b/projectv1/project_v1.go index c54330b..8ca63dc 100644 --- a/projectv1/project_v1.go +++ b/projectv1/project_v1.go @@ -1674,6 +1674,286 @@ func (project *ProjectV1) ListConfigResourcesWithContext(ctx context.Context, li return } +// CreateConfigTemplate : Add a template to the configuration +// Add a template to the configuration of type stack. +func (project *ProjectV1) CreateConfigTemplate(createConfigTemplateOptions *CreateConfigTemplateOptions) (result *StackTemplate, response *core.DetailedResponse, err error) { + return project.CreateConfigTemplateWithContext(context.Background(), createConfigTemplateOptions) +} + +// CreateConfigTemplateWithContext is an alternate form of the CreateConfigTemplate method which supports a Context parameter +func (project *ProjectV1) CreateConfigTemplateWithContext(ctx context.Context, createConfigTemplateOptions *CreateConfigTemplateOptions) (result *StackTemplate, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createConfigTemplateOptions, "createConfigTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createConfigTemplateOptions, "createConfigTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *createConfigTemplateOptions.ProjectID, + "id": *createConfigTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/configs/{id}/template`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createConfigTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "CreateConfigTemplate") + 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 createConfigTemplateOptions.Definition != nil { + body["definition"] = createConfigTemplateOptions.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, UnmarshalStackTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetConfigTemplate : Get a configuration template +// Retrieve the template that is associated to the configuration. +func (project *ProjectV1) GetConfigTemplate(getConfigTemplateOptions *GetConfigTemplateOptions) (result *StackTemplate, response *core.DetailedResponse, err error) { + return project.GetConfigTemplateWithContext(context.Background(), getConfigTemplateOptions) +} + +// GetConfigTemplateWithContext is an alternate form of the GetConfigTemplate method which supports a Context parameter +func (project *ProjectV1) GetConfigTemplateWithContext(ctx context.Context, getConfigTemplateOptions *GetConfigTemplateOptions) (result *StackTemplate, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getConfigTemplateOptions, "getConfigTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getConfigTemplateOptions, "getConfigTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *getConfigTemplateOptions.ProjectID, + "id": *getConfigTemplateOptions.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}/configs/{id}/template`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getConfigTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "GetConfigTemplate") + 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, UnmarshalStackTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateConfigTemplate : Update a configuration template +// Update the template that is associated to the configuration. +func (project *ProjectV1) UpdateConfigTemplate(updateConfigTemplateOptions *UpdateConfigTemplateOptions) (result *StackTemplate, response *core.DetailedResponse, err error) { + return project.UpdateConfigTemplateWithContext(context.Background(), updateConfigTemplateOptions) +} + +// UpdateConfigTemplateWithContext is an alternate form of the UpdateConfigTemplate method which supports a Context parameter +func (project *ProjectV1) UpdateConfigTemplateWithContext(ctx context.Context, updateConfigTemplateOptions *UpdateConfigTemplateOptions) (result *StackTemplate, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateConfigTemplateOptions, "updateConfigTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateConfigTemplateOptions, "updateConfigTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *updateConfigTemplateOptions.ProjectID, + "id": *updateConfigTemplateOptions.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}/configs/{id}/template`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateConfigTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "UpdateConfigTemplate") + 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 updateConfigTemplateOptions.Definition != nil { + body["definition"] = updateConfigTemplateOptions.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, UnmarshalStackTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// PublishConfigTemplate : Publish a configuration template +// Publish a configuration template to the private catalog. +func (project *ProjectV1) PublishConfigTemplate(publishConfigTemplateOptions *PublishConfigTemplateOptions) (result *SuccessfulResponse, response *core.DetailedResponse, err error) { + return project.PublishConfigTemplateWithContext(context.Background(), publishConfigTemplateOptions) +} + +// PublishConfigTemplateWithContext is an alternate form of the PublishConfigTemplate method which supports a Context parameter +func (project *ProjectV1) PublishConfigTemplateWithContext(ctx context.Context, publishConfigTemplateOptions *PublishConfigTemplateOptions) (result *SuccessfulResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(publishConfigTemplateOptions, "publishConfigTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(publishConfigTemplateOptions, "publishConfigTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "project_id": *publishConfigTemplateOptions.ProjectID, + "id": *publishConfigTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = project.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/configs/{id}/template/publish`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range publishConfigTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("project", "V1", "PublishConfigTemplate") + 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 publishConfigTemplateOptions.CatalogID != nil { + body["catalog_id"] = publishConfigTemplateOptions.CatalogID + } + if publishConfigTemplateOptions.OfferingID != nil { + body["offering_id"] = publishConfigTemplateOptions.OfferingID + } + if publishConfigTemplateOptions.TargetVersion != nil { + body["target_version"] = publishConfigTemplateOptions.TargetVersion + } + _, 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, UnmarshalSuccessfulResponse) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListConfigVersions : Get a list of project configuration versions // Retrieve a list of previous and current versions of a project configuration in a specific project. func (project *ProjectV1) ListConfigVersions(listConfigVersionsOptions *ListConfigVersionsOptions) (result *ProjectConfigVersionSummaryCollection, response *core.DetailedResponse, err error) { @@ -2330,6 +2610,23 @@ func UnmarshalCodeRiskAnalyzerLogsSummary(m map[string]json.RawMessage, result i return } +// ConfigDefinitionReference : The definition of the config reference. +type ConfigDefinitionReference struct { + // The name of the configuration. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalConfigDefinitionReference unmarshals an instance of ConfigDefinitionReference from the specified map of raw messages. +func UnmarshalConfigDefinitionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigDefinitionReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CreateConfigOptions : The CreateConfig options. type CreateConfigOptions struct { // The unique project ID. @@ -2389,51 +2686,99 @@ func (options *CreateConfigOptions) SetHeaders(param map[string]string) *CreateC return options } -// CreateProjectEnvironmentOptions : The CreateProjectEnvironment options. -type CreateProjectEnvironmentOptions struct { +// CreateConfigTemplateOptions : The CreateConfigTemplate options. +type CreateConfigTemplateOptions struct { // The unique project ID. ProjectID *string `json:"project_id" validate:"required,ne="` - // The environment definition. - Definition *EnvironmentDefinitionRequiredProperties `json:"definition" validate:"required"` + // The unique configuration ID. + ID *string `json:"id" validate:"required,ne="` + + // The definition block for a stack configuration template. + Definition *StackTemplateDefinitionBlockPrototype `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{ +// NewCreateConfigTemplateOptions : Instantiate CreateConfigTemplateOptions +func (*ProjectV1) NewCreateConfigTemplateOptions(projectID string, id string, definition *StackTemplateDefinitionBlockPrototype) *CreateConfigTemplateOptions { + return &CreateConfigTemplateOptions{ ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), Definition: definition, } } // SetProjectID : Allow user to set ProjectID -func (_options *CreateProjectEnvironmentOptions) SetProjectID(projectID string) *CreateProjectEnvironmentOptions { +func (_options *CreateConfigTemplateOptions) SetProjectID(projectID string) *CreateConfigTemplateOptions { _options.ProjectID = core.StringPtr(projectID) return _options } +// SetID : Allow user to set ID +func (_options *CreateConfigTemplateOptions) SetID(id string) *CreateConfigTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + // SetDefinition : Allow user to set Definition -func (_options *CreateProjectEnvironmentOptions) SetDefinition(definition *EnvironmentDefinitionRequiredProperties) *CreateProjectEnvironmentOptions { +func (_options *CreateConfigTemplateOptions) SetDefinition(definition *StackTemplateDefinitionBlockPrototype) *CreateConfigTemplateOptions { _options.Definition = definition return _options } // SetHeaders : Allow user to set Headers -func (options *CreateProjectEnvironmentOptions) SetHeaders(param map[string]string) *CreateProjectEnvironmentOptions { +func (options *CreateConfigTemplateOptions) SetHeaders(param map[string]string) *CreateConfigTemplateOptions { options.Headers = param return options } -// CreateProjectOptions : The CreateProject options. -type CreateProjectOptions struct { - // The definition of the project. - Definition *ProjectPrototypeDefinition `json:"definition" validate:"required"` +// CreateProjectEnvironmentOptions : The CreateProjectEnvironment options. +type CreateProjectEnvironmentOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` - // The IBM Cloud location where a resource is deployed. - Location *string `json:"location" validate:"required"` + // 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. + Definition *ProjectPrototypeDefinition `json:"definition" validate:"required"` + + // The IBM Cloud location where a resource is deployed. + Location *string `json:"location" validate:"required"` // The resource group name where the project's data and tools are created. ResourceGroup *string `json:"resource_group" validate:"required"` @@ -3109,6 +3454,44 @@ func (options *GetConfigOptions) SetHeaders(param map[string]string) *GetConfigO return options } +// GetConfigTemplateOptions : The GetConfigTemplate options. +type GetConfigTemplateOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The unique configuration ID. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetConfigTemplateOptions : Instantiate GetConfigTemplateOptions +func (*ProjectV1) NewGetConfigTemplateOptions(projectID string, id string) *GetConfigTemplateOptions { + return &GetConfigTemplateOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *GetConfigTemplateOptions) SetProjectID(projectID string) *GetConfigTemplateOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetConfigTemplateOptions) SetID(id string) *GetConfigTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetConfigTemplateOptions) SetHeaders(param map[string]string) *GetConfigTemplateOptions { + options.Headers = param + return options +} + // GetConfigVersionOptions : The GetConfigVersion options. type GetConfigVersionOptions struct { // The unique project ID. @@ -3664,7 +4047,7 @@ type OutputValue struct { Description *string `json:"description,omitempty"` // This property can be any value - a string, number, boolean, array, or object. - Value map[string]interface{} `json:"value,omitempty"` + Value interface{} `json:"value,omitempty"` } // UnmarshalOutputValue unmarshals an instance of OutputValue from the specified map of raw messages. @@ -4078,7 +4461,7 @@ type ProjectConfig struct { IsDraft *bool `json:"is_draft" validate:"required"` // The needs attention state of a configuration. - NeedsAttentionState []map[string]interface{} `json:"needs_attention_state" validate:"required"` + NeedsAttentionState []interface{} `json:"needs_attention_state" validate:"required"` // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ to match the date and time // format as specified by RFC 3339. @@ -5114,7 +5497,7 @@ type ProjectConfigVersion struct { IsDraft *bool `json:"is_draft" validate:"required"` // The needs attention state of a configuration. - NeedsAttentionState []map[string]interface{} `json:"needs_attention_state" validate:"required"` + NeedsAttentionState []interface{} `json:"needs_attention_state" validate:"required"` // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ to match the date and time // format as specified by RFC 3339. @@ -5880,6 +6263,72 @@ func UnmarshalProjectSummary(m map[string]json.RawMessage, result interface{}) ( return } +// PublishConfigTemplateOptions : The PublishConfigTemplate options. +type PublishConfigTemplateOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The unique configuration ID. + ID *string `json:"id" validate:"required,ne="` + + // The catalog ID to publish. + CatalogID *string `json:"catalog_id" validate:"required"` + + // The offering ID to publish. + OfferingID *string `json:"offering_id,omitempty"` + + // The semver value for this new version if the offering_id is supplied. + TargetVersion *string `json:"target_version,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewPublishConfigTemplateOptions : Instantiate PublishConfigTemplateOptions +func (*ProjectV1) NewPublishConfigTemplateOptions(projectID string, id string, catalogID string) *PublishConfigTemplateOptions { + return &PublishConfigTemplateOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + CatalogID: core.StringPtr(catalogID), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *PublishConfigTemplateOptions) SetProjectID(projectID string) *PublishConfigTemplateOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *PublishConfigTemplateOptions) SetID(id string) *PublishConfigTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCatalogID : Allow user to set CatalogID +func (_options *PublishConfigTemplateOptions) SetCatalogID(catalogID string) *PublishConfigTemplateOptions { + _options.CatalogID = core.StringPtr(catalogID) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *PublishConfigTemplateOptions) SetOfferingID(offeringID string) *PublishConfigTemplateOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetTargetVersion : Allow user to set TargetVersion +func (_options *PublishConfigTemplateOptions) SetTargetVersion(targetVersion string) *PublishConfigTemplateOptions { + _options.TargetVersion = core.StringPtr(targetVersion) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PublishConfigTemplateOptions) SetHeaders(param map[string]string) *PublishConfigTemplateOptions { + options.Headers = param + return options +} + // SchematicsMetadata : A Schematics workspace that is associated to a project configuration, with scripts. type SchematicsMetadata struct { // An IBM Cloud resource name that uniquely identifies a resource. @@ -6005,6 +6454,354 @@ func UnmarshalScript(m map[string]json.RawMessage, result interface{}) (err erro return } +// StackInputVariable : The input variables for a stack configuration template. +type StackInputVariable struct { + // The variable name. + Name *string `json:"name" validate:"required"` + + // The variable type. + Type *string `json:"type" validate:"required"` + + // The description of the variable. + Description *string `json:"description,omitempty"` + + // This property can be any value - a string, number, boolean, array, or object. + Default interface{} `json:"default,omitempty"` + + // A boolean value to denote if the property is required. + Required *bool `json:"required,omitempty"` + + // A boolean value to denote whether the property is hidden, as in not exposed to the user. + Hidden *bool `json:"hidden,omitempty"` +} + +// Constants associated with the StackInputVariable.Type property. +// The variable type. +const ( + StackInputVariable_Type_Array = "array" + StackInputVariable_Type_Boolean = "boolean" + StackInputVariable_Type_Float = "float" + StackInputVariable_Type_Int = "int" + StackInputVariable_Type_Number = "number" + StackInputVariable_Type_Object = "object" + StackInputVariable_Type_Password = "password" + StackInputVariable_Type_String = "string" +) + +// NewStackInputVariable : Instantiate StackInputVariable (Generic Model Constructor) +func (*ProjectV1) NewStackInputVariable(name string, typeVar string) (_model *StackInputVariable, err error) { + _model = &StackInputVariable{ + Name: core.StringPtr(name), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalStackInputVariable unmarshals an instance of StackInputVariable from the specified map of raw messages. +func UnmarshalStackInputVariable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StackInputVariable) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "required", &obj.Required) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StackOutputVariable : The output variables for a stack configuration template. +type StackOutputVariable struct { + // The variable name. + Name *string `json:"name" validate:"required"` + + // The value of the output variable. + Value *string `json:"value" validate:"required"` +} + +// NewStackOutputVariable : Instantiate StackOutputVariable (Generic Model Constructor) +func (*ProjectV1) NewStackOutputVariable(name string, value string) (_model *StackOutputVariable, err error) { + _model = &StackOutputVariable{ + Name: core.StringPtr(name), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalStackOutputVariable unmarshals an instance of StackOutputVariable from the specified map of raw messages. +func UnmarshalStackOutputVariable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StackOutputVariable) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StackTemplate : The input of a stack configuration template. +type StackTemplate struct { + // The inputs associated with this stack definition. + Inputs []StackInputVariable `json:"inputs,omitempty"` + + // The outputs associated with this stack definition. + Outputs []StackOutputVariable `json:"outputs,omitempty"` + + // The outputs that are associated with this stack definition. + MemberInputs []StackTemplateMemberInput `json:"member_inputs,omitempty"` + + // The ID of the template. + ID *string `json:"id" validate:"required"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ to match the date and time + // format as specified by RFC 3339. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // A date and time value in the format YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.sssZ to match the date and time + // format as specified by RFC 3339. + ModifiedAt *strfmt.DateTime `json:"modified_at" validate:"required"` + + // The state for the stack template. + State *string `json:"state" validate:"required"` + + // The configuration reference. + Configuration *StackTemplateMetadataConfiguration `json:"configuration" validate:"required"` + + // A URL. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the StackTemplate.State property. +// The state for the stack template. +const ( + StackTemplate_State_Draft = "draft" + StackTemplate_State_Published = "published" +) + +// UnmarshalStackTemplate unmarshals an instance of StackTemplate from the specified map of raw messages. +func UnmarshalStackTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StackTemplate) + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalStackInputVariable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalStackOutputVariable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "member_inputs", &obj.MemberInputs, UnmarshalStackTemplateMemberInput) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalStackTemplateMetadataConfiguration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StackTemplateDefinitionBlockPrototype : The definition block for a stack configuration template. +type StackTemplateDefinitionBlockPrototype struct { + // The inputs associated with this stack definition. + Inputs []StackInputVariable `json:"inputs,omitempty"` + + // The outputs associated with this stack definition. + Outputs []StackOutputVariable `json:"outputs,omitempty"` + + // The outputs that are associated with this stack definition. + MemberInputs []StackTemplateMemberInput `json:"member_inputs,omitempty"` +} + +// UnmarshalStackTemplateDefinitionBlockPrototype unmarshals an instance of StackTemplateDefinitionBlockPrototype from the specified map of raw messages. +func UnmarshalStackTemplateDefinitionBlockPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StackTemplateDefinitionBlockPrototype) + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalStackInputVariable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalStackOutputVariable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "member_inputs", &obj.MemberInputs, UnmarshalStackTemplateMemberInput) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StackTemplateMemberInput : The member definition associated with this stack template. +type StackTemplateMemberInput struct { + // The unique ID. + ConfigID *string `json:"config_id" validate:"required"` + + // The member inputs to expose in the stack template. + Inputs []string `json:"inputs" validate:"required"` +} + +// NewStackTemplateMemberInput : Instantiate StackTemplateMemberInput (Generic Model Constructor) +func (*ProjectV1) NewStackTemplateMemberInput(configID string, inputs []string) (_model *StackTemplateMemberInput, err error) { + _model = &StackTemplateMemberInput{ + ConfigID: core.StringPtr(configID), + Inputs: inputs, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalStackTemplateMemberInput unmarshals an instance of StackTemplateMemberInput from the specified map of raw messages. +func UnmarshalStackTemplateMemberInput(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StackTemplateMemberInput) + err = core.UnmarshalPrimitive(m, "config_id", &obj.ConfigID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "inputs", &obj.Inputs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StackTemplateMetadataConfiguration : The configuration reference. +type StackTemplateMetadataConfiguration struct { + // The unique ID. + ID *string `json:"id" validate:"required"` + + // A URL. + Href *string `json:"href" validate:"required"` + + // The definition of the config reference. + Definition *ConfigDefinitionReference `json:"definition" validate:"required"` +} + +// UnmarshalStackTemplateMetadataConfiguration unmarshals an instance of StackTemplateMetadataConfiguration from the specified map of raw messages. +func UnmarshalStackTemplateMetadataConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StackTemplateMetadataConfiguration) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "definition", &obj.Definition, UnmarshalConfigDefinitionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SuccessfulResponse : SuccessfulResponse struct +type SuccessfulResponse struct { + + // Allows users to set arbitrary properties + additionalProperties map[string]interface{} +} + +// SetProperty allows the user to set an arbitrary property on an instance of SuccessfulResponse +func (o *SuccessfulResponse) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) + } + o.additionalProperties[key] = value +} + +// SetProperties allows the user to set a map of arbitrary properties on an instance of SuccessfulResponse +func (o *SuccessfulResponse) SetProperties(m map[string]interface{}) { + o.additionalProperties = make(map[string]interface{}) + for k, v := range m { + o.additionalProperties[k] = v + } +} + +// GetProperty allows the user to retrieve an arbitrary property from an instance of SuccessfulResponse +func (o *SuccessfulResponse) GetProperty(key string) interface{} { + return o.additionalProperties[key] +} + +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of SuccessfulResponse +func (o *SuccessfulResponse) GetProperties() map[string]interface{} { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of SuccessfulResponse +func (o *SuccessfulResponse) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalSuccessfulResponse unmarshals an instance of SuccessfulResponse from the specified map of raw messages. +func UnmarshalSuccessfulResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SuccessfulResponse) + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SyncConfigOptions : The SyncConfig options. type SyncConfigOptions struct { // The unique project ID. @@ -6242,6 +7039,54 @@ func (options *UpdateConfigOptions) SetHeaders(param map[string]string) *UpdateC return options } +// UpdateConfigTemplateOptions : The UpdateConfigTemplate options. +type UpdateConfigTemplateOptions struct { + // The unique project ID. + ProjectID *string `json:"project_id" validate:"required,ne="` + + // The unique configuration ID. + ID *string `json:"id" validate:"required,ne="` + + // The definition block for a stack configuration template. + Definition *StackTemplateDefinitionBlockPrototype `json:"definition" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateConfigTemplateOptions : Instantiate UpdateConfigTemplateOptions +func (*ProjectV1) NewUpdateConfigTemplateOptions(projectID string, id string, definition *StackTemplateDefinitionBlockPrototype) *UpdateConfigTemplateOptions { + return &UpdateConfigTemplateOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), + Definition: definition, + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *UpdateConfigTemplateOptions) SetProjectID(projectID string) *UpdateConfigTemplateOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateConfigTemplateOptions) SetID(id string) *UpdateConfigTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDefinition : Allow user to set Definition +func (_options *UpdateConfigTemplateOptions) SetDefinition(definition *StackTemplateDefinitionBlockPrototype) *UpdateConfigTemplateOptions { + _options.Definition = definition + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateConfigTemplateOptions) SetHeaders(param map[string]string) *UpdateConfigTemplateOptions { + options.Headers = param + return options +} + // UpdateProjectEnvironmentOptions : The UpdateProjectEnvironment options. type UpdateProjectEnvironmentOptions struct { // The unique project ID. diff --git a/projectv1/project_v1_examples_test.go b/projectv1/project_v1_examples_test.go index 7011a6b..6454eae 100644 --- a/projectv1/project_v1_examples_test.go +++ b/projectv1/project_v1_examples_test.go @@ -642,6 +642,137 @@ var _ = Describe(`ProjectV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(200)) Expect(projectConfigResourceCollection).ToNot(BeNil()) }) + It(`CreateConfigTemplate request example`, func() { + fmt.Println("\nCreateConfigTemplate() result:") + // begin-create_config_template + + stackInputVariableModel := &projectv1.StackInputVariable{ + Name: core.StringPtr("region"), + Type: core.StringPtr("string"), + Required: core.BoolPtr(true), + Hidden: core.BoolPtr(false), + } + + stackOutputVariableModel := &projectv1.StackOutputVariable{ + Name: core.StringPtr("vpc_cluster_id"), + Value: core.StringPtr("cluster_id"), + } + + stackTemplateMemberInputModel := &projectv1.StackTemplateMemberInput{ + ConfigID: core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX"), + Inputs: []string{"region", "cluster_name"}, + } + + stackTemplateDefinitionBlockPrototypeModel := &projectv1.StackTemplateDefinitionBlockPrototype{ + Inputs: []projectv1.StackInputVariable{*stackInputVariableModel}, + Outputs: []projectv1.StackOutputVariable{*stackOutputVariableModel}, + MemberInputs: []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel}, + } + + createConfigTemplateOptions := projectService.NewCreateConfigTemplateOptions( + projectIdLink, + configIdLink, + stackTemplateDefinitionBlockPrototypeModel, + ) + + stackTemplate, response, err := projectService.CreateConfigTemplate(createConfigTemplateOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(stackTemplate, "", " ") + fmt.Println(string(b)) + + // end-create_config_template + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(stackTemplate).ToNot(BeNil()) + }) + It(`GetConfigTemplate request example`, func() { + fmt.Println("\nGetConfigTemplate() result:") + // begin-get_config_template + + getConfigTemplateOptions := projectService.NewGetConfigTemplateOptions( + projectIdLink, + configIdLink, + ) + + stackTemplate, response, err := projectService.GetConfigTemplate(getConfigTemplateOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(stackTemplate, "", " ") + fmt.Println(string(b)) + + // end-get_config_template + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(stackTemplate).ToNot(BeNil()) + }) + It(`UpdateConfigTemplate request example`, func() { + fmt.Println("\nUpdateConfigTemplate() result:") + // begin-update_config_template + + stackInputVariableModel := &projectv1.StackInputVariable{ + Name: core.StringPtr("region"), + Type: core.StringPtr("string"), + Required: core.BoolPtr(true), + Hidden: core.BoolPtr(false), + } + + stackTemplateMemberInputModel := &projectv1.StackTemplateMemberInput{ + ConfigID: core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX"), + Inputs: []string{"cluster_name"}, + } + + stackTemplateDefinitionBlockPrototypeModel := &projectv1.StackTemplateDefinitionBlockPrototype{ + Inputs: []projectv1.StackInputVariable{*stackInputVariableModel}, + MemberInputs: []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel}, + } + + updateConfigTemplateOptions := projectService.NewUpdateConfigTemplateOptions( + projectIdLink, + configIdLink, + stackTemplateDefinitionBlockPrototypeModel, + ) + + stackTemplate, response, err := projectService.UpdateConfigTemplate(updateConfigTemplateOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(stackTemplate, "", " ") + fmt.Println(string(b)) + + // end-update_config_template + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(stackTemplate).ToNot(BeNil()) + }) + It(`PublishConfigTemplate request example`, func() { + fmt.Println("\nPublishConfigTemplate() result:") + // begin-publish_config_template + + publishConfigTemplateOptions := projectService.NewPublishConfigTemplateOptions( + projectIdLink, + configIdLink, + "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c", + ) + + successfulResponse, response, err := projectService.PublishConfigTemplate(publishConfigTemplateOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(successfulResponse, "", " ") + fmt.Println(string(b)) + + // end-publish_config_template + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(successfulResponse).ToNot(BeNil()) + }) It(`ListConfigVersions request example`, func() { fmt.Println("\nListConfigVersions() result:") // begin-list_config_versions diff --git a/projectv1/project_v1_integration_test.go b/projectv1/project_v1_integration_test.go index 0c9387a..b3f8863 100644 --- a/projectv1/project_v1_integration_test.go +++ b/projectv1/project_v1_integration_test.go @@ -796,6 +796,129 @@ var _ = Describe(`ProjectV1 Integration Tests`, func() { }) }) + Describe(`CreateConfigTemplate - Add a template to the configuration`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateConfigTemplate(createConfigTemplateOptions *CreateConfigTemplateOptions)`, func() { + stackInputVariableModel := &projectv1.StackInputVariable{ + Name: core.StringPtr("region"), + Type: core.StringPtr("string"), + Description: core.StringPtr("testString"), + Default: core.StringPtr("testString"), + Required: core.BoolPtr(true), + Hidden: core.BoolPtr(false), + } + + stackOutputVariableModel := &projectv1.StackOutputVariable{ + Name: core.StringPtr("vpc_cluster_id"), + Value: core.StringPtr("cluster_id"), + } + + stackTemplateMemberInputModel := &projectv1.StackTemplateMemberInput{ + ConfigID: core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX"), + Inputs: []string{"region", "cluster_name"}, + } + + stackTemplateDefinitionBlockPrototypeModel := &projectv1.StackTemplateDefinitionBlockPrototype{ + Inputs: []projectv1.StackInputVariable{*stackInputVariableModel}, + Outputs: []projectv1.StackOutputVariable{*stackOutputVariableModel}, + MemberInputs: []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel}, + } + + createConfigTemplateOptions := &projectv1.CreateConfigTemplateOptions{ + ProjectID: &projectIdLink, + ID: &configIdLink, + Definition: stackTemplateDefinitionBlockPrototypeModel, + } + + stackTemplate, response, err := projectService.CreateConfigTemplate(createConfigTemplateOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(stackTemplate).ToNot(BeNil()) + }) + }) + + Describe(`GetConfigTemplate - Get a configuration template`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetConfigTemplate(getConfigTemplateOptions *GetConfigTemplateOptions)`, func() { + getConfigTemplateOptions := &projectv1.GetConfigTemplateOptions{ + ProjectID: &projectIdLink, + ID: &configIdLink, + } + + stackTemplate, response, err := projectService.GetConfigTemplate(getConfigTemplateOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(stackTemplate).ToNot(BeNil()) + }) + }) + + Describe(`UpdateConfigTemplate - Update a configuration template`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`UpdateConfigTemplate(updateConfigTemplateOptions *UpdateConfigTemplateOptions)`, func() { + stackInputVariableModel := &projectv1.StackInputVariable{ + Name: core.StringPtr("region"), + Type: core.StringPtr("string"), + Description: core.StringPtr("testString"), + Default: core.StringPtr("testString"), + Required: core.BoolPtr(true), + Hidden: core.BoolPtr(false), + } + + stackOutputVariableModel := &projectv1.StackOutputVariable{ + Name: core.StringPtr("testString"), + Value: core.StringPtr("testString"), + } + + stackTemplateMemberInputModel := &projectv1.StackTemplateMemberInput{ + ConfigID: core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX"), + Inputs: []string{"cluster_name"}, + } + + stackTemplateDefinitionBlockPrototypeModel := &projectv1.StackTemplateDefinitionBlockPrototype{ + Inputs: []projectv1.StackInputVariable{*stackInputVariableModel}, + Outputs: []projectv1.StackOutputVariable{*stackOutputVariableModel}, + MemberInputs: []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel}, + } + + updateConfigTemplateOptions := &projectv1.UpdateConfigTemplateOptions{ + ProjectID: &projectIdLink, + ID: &configIdLink, + Definition: stackTemplateDefinitionBlockPrototypeModel, + } + + stackTemplate, response, err := projectService.UpdateConfigTemplate(updateConfigTemplateOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(stackTemplate).ToNot(BeNil()) + }) + }) + + Describe(`PublishConfigTemplate - Publish a configuration template`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`PublishConfigTemplate(publishConfigTemplateOptions *PublishConfigTemplateOptions)`, func() { + publishConfigTemplateOptions := &projectv1.PublishConfigTemplateOptions{ + ProjectID: &projectIdLink, + ID: &configIdLink, + CatalogID: core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c"), + OfferingID: core.StringPtr("testString"), + TargetVersion: core.StringPtr("testString"), + } + + successfulResponse, response, err := projectService.PublishConfigTemplate(publishConfigTemplateOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(successfulResponse).ToNot(BeNil()) + }) + }) + Describe(`ListConfigVersions - Get a list of project configuration versions`, func() { BeforeEach(func() { shouldSkipTest() diff --git a/projectv1/project_v1_test.go b/projectv1/project_v1_test.go index 1fc9d9d..81c2a16 100644 --- a/projectv1/project_v1_test.go +++ b/projectv1/project_v1_test.go @@ -3639,7 +3639,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke CreateConfig successfully with retries`, func() { @@ -3740,7 +3740,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke CreateConfig successfully`, func() { @@ -4321,7 +4321,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke GetConfig successfully with retries`, func() { @@ -4376,7 +4376,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke GetConfig successfully`, func() { @@ -4580,7 +4580,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke UpdateConfig successfully with retries`, func() { @@ -4677,7 +4677,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "approved_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}, "deployed_version": {"definition": {"environment_id": "EnvironmentID", "locator_id": "LocatorID"}, "state": "approved", "version": 7, "href": "Href"}}`) })) }) It(`Invoke UpdateConfig successfully`, func() { @@ -5151,7 +5151,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke ForceApprove successfully with retries`, func() { @@ -5223,7 +5223,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke ForceApprove successfully`, func() { @@ -5405,7 +5405,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke Approve successfully with retries`, func() { @@ -5477,7 +5477,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke Approve successfully`, func() { @@ -5642,7 +5642,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke ValidateConfig successfully with retries`, func() { @@ -5697,7 +5697,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke ValidateConfig successfully`, func() { @@ -5859,7 +5859,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke DeployConfig successfully with retries`, func() { @@ -5914,7 +5914,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke DeployConfig successfully`, func() { @@ -6076,7 +6076,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke UndeployConfig successfully with retries`, func() { @@ -6131,7 +6131,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke UndeployConfig successfully`, func() { @@ -6543,6 +6543,1245 @@ var _ = Describe(`ProjectV1`, func() { }) }) }) + Describe(`CreateConfigTemplate(createConfigTemplateOptions *CreateConfigTemplateOptions) - Operation response error`, func() { + createConfigTemplatePath := "/v1/projects/testString/configs/testString/template" + 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(createConfigTemplatePath)) + 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 CreateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("vpc_cluster_id") + stackOutputVariableModel.Value = core.StringPtr("cluster_id") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"region", "cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the CreateConfigTemplateOptions model + createConfigTemplateOptionsModel := new(projectv1.CreateConfigTemplateOptions) + createConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + createConfigTemplateOptionsModel.ID = core.StringPtr("testString") + createConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + createConfigTemplateOptionsModel.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.CreateConfigTemplate(createConfigTemplateOptionsModel) + 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.CreateConfigTemplate(createConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateConfigTemplate(createConfigTemplateOptions *CreateConfigTemplateOptions)`, func() { + createConfigTemplatePath := "/v1/projects/testString/configs/testString/template" + 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(createConfigTemplatePath)) + 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", `{"inputs": [{"name": "Name", "type": "array", "description": "Description", "default": "anyValue", "required": true, "hidden": true}], "outputs": [{"name": "Name", "value": "Value"}], "member_inputs": [{"config_id": "ConfigID", "inputs": ["Inputs"]}], "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "state": "draft", "configuration": {"id": "ID", "href": "Href", "definition": {"name": "Name"}}, "href": "Href"}`) + })) + }) + It(`Invoke CreateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("vpc_cluster_id") + stackOutputVariableModel.Value = core.StringPtr("cluster_id") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"region", "cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the CreateConfigTemplateOptions model + createConfigTemplateOptionsModel := new(projectv1.CreateConfigTemplateOptions) + createConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + createConfigTemplateOptionsModel.ID = core.StringPtr("testString") + createConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + createConfigTemplateOptionsModel.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.CreateConfigTemplateWithContext(ctx, createConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.CreateConfigTemplate(createConfigTemplateOptionsModel) + 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.CreateConfigTemplateWithContext(ctx, createConfigTemplateOptionsModel) + 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(createConfigTemplatePath)) + 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", `{"inputs": [{"name": "Name", "type": "array", "description": "Description", "default": "anyValue", "required": true, "hidden": true}], "outputs": [{"name": "Name", "value": "Value"}], "member_inputs": [{"config_id": "ConfigID", "inputs": ["Inputs"]}], "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "state": "draft", "configuration": {"id": "ID", "href": "Href", "definition": {"name": "Name"}}, "href": "Href"}`) + })) + }) + It(`Invoke CreateConfigTemplate 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.CreateConfigTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("vpc_cluster_id") + stackOutputVariableModel.Value = core.StringPtr("cluster_id") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"region", "cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the CreateConfigTemplateOptions model + createConfigTemplateOptionsModel := new(projectv1.CreateConfigTemplateOptions) + createConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + createConfigTemplateOptionsModel.ID = core.StringPtr("testString") + createConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + createConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.CreateConfigTemplate(createConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("vpc_cluster_id") + stackOutputVariableModel.Value = core.StringPtr("cluster_id") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"region", "cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the CreateConfigTemplateOptions model + createConfigTemplateOptionsModel := new(projectv1.CreateConfigTemplateOptions) + createConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + createConfigTemplateOptionsModel.ID = core.StringPtr("testString") + createConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + createConfigTemplateOptionsModel.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.CreateConfigTemplate(createConfigTemplateOptionsModel) + 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 CreateConfigTemplateOptions model with no property values + createConfigTemplateOptionsModelNew := new(projectv1.CreateConfigTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.CreateConfigTemplate(createConfigTemplateOptionsModelNew) + 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 CreateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("vpc_cluster_id") + stackOutputVariableModel.Value = core.StringPtr("cluster_id") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"region", "cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the CreateConfigTemplateOptions model + createConfigTemplateOptionsModel := new(projectv1.CreateConfigTemplateOptions) + createConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + createConfigTemplateOptionsModel.ID = core.StringPtr("testString") + createConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + createConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.CreateConfigTemplate(createConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetConfigTemplate(getConfigTemplateOptions *GetConfigTemplateOptions) - Operation response error`, func() { + getConfigTemplatePath := "/v1/projects/testString/configs/testString/template" + 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(getConfigTemplatePath)) + 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 GetConfigTemplate 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 GetConfigTemplateOptions model + getConfigTemplateOptionsModel := new(projectv1.GetConfigTemplateOptions) + getConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + getConfigTemplateOptionsModel.ID = core.StringPtr("testString") + getConfigTemplateOptionsModel.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.GetConfigTemplate(getConfigTemplateOptionsModel) + 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.GetConfigTemplate(getConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetConfigTemplate(getConfigTemplateOptions *GetConfigTemplateOptions)`, func() { + getConfigTemplatePath := "/v1/projects/testString/configs/testString/template" + 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(getConfigTemplatePath)) + 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", `{"inputs": [{"name": "Name", "type": "array", "description": "Description", "default": "anyValue", "required": true, "hidden": true}], "outputs": [{"name": "Name", "value": "Value"}], "member_inputs": [{"config_id": "ConfigID", "inputs": ["Inputs"]}], "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "state": "draft", "configuration": {"id": "ID", "href": "Href", "definition": {"name": "Name"}}, "href": "Href"}`) + })) + }) + It(`Invoke GetConfigTemplate 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 GetConfigTemplateOptions model + getConfigTemplateOptionsModel := new(projectv1.GetConfigTemplateOptions) + getConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + getConfigTemplateOptionsModel.ID = core.StringPtr("testString") + getConfigTemplateOptionsModel.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.GetConfigTemplateWithContext(ctx, getConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.GetConfigTemplate(getConfigTemplateOptionsModel) + 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.GetConfigTemplateWithContext(ctx, getConfigTemplateOptionsModel) + 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(getConfigTemplatePath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"inputs": [{"name": "Name", "type": "array", "description": "Description", "default": "anyValue", "required": true, "hidden": true}], "outputs": [{"name": "Name", "value": "Value"}], "member_inputs": [{"config_id": "ConfigID", "inputs": ["Inputs"]}], "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "state": "draft", "configuration": {"id": "ID", "href": "Href", "definition": {"name": "Name"}}, "href": "Href"}`) + })) + }) + It(`Invoke GetConfigTemplate 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.GetConfigTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetConfigTemplateOptions model + getConfigTemplateOptionsModel := new(projectv1.GetConfigTemplateOptions) + getConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + getConfigTemplateOptionsModel.ID = core.StringPtr("testString") + getConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.GetConfigTemplate(getConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetConfigTemplate 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 GetConfigTemplateOptions model + getConfigTemplateOptionsModel := new(projectv1.GetConfigTemplateOptions) + getConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + getConfigTemplateOptionsModel.ID = core.StringPtr("testString") + getConfigTemplateOptionsModel.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.GetConfigTemplate(getConfigTemplateOptionsModel) + 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 GetConfigTemplateOptions model with no property values + getConfigTemplateOptionsModelNew := new(projectv1.GetConfigTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.GetConfigTemplate(getConfigTemplateOptionsModelNew) + 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 GetConfigTemplate 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 GetConfigTemplateOptions model + getConfigTemplateOptionsModel := new(projectv1.GetConfigTemplateOptions) + getConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + getConfigTemplateOptionsModel.ID = core.StringPtr("testString") + getConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.GetConfigTemplate(getConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateConfigTemplate(updateConfigTemplateOptions *UpdateConfigTemplateOptions) - Operation response error`, func() { + updateConfigTemplatePath := "/v1/projects/testString/configs/testString/template" + 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(updateConfigTemplatePath)) + 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 UpdateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("testString") + stackOutputVariableModel.Value = core.StringPtr("testString") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the UpdateConfigTemplateOptions model + updateConfigTemplateOptionsModel := new(projectv1.UpdateConfigTemplateOptions) + updateConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.ID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + updateConfigTemplateOptionsModel.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.UpdateConfigTemplate(updateConfigTemplateOptionsModel) + 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.UpdateConfigTemplate(updateConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateConfigTemplate(updateConfigTemplateOptions *UpdateConfigTemplateOptions)`, func() { + updateConfigTemplatePath := "/v1/projects/testString/configs/testString/template" + 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(updateConfigTemplatePath)) + 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", `{"inputs": [{"name": "Name", "type": "array", "description": "Description", "default": "anyValue", "required": true, "hidden": true}], "outputs": [{"name": "Name", "value": "Value"}], "member_inputs": [{"config_id": "ConfigID", "inputs": ["Inputs"]}], "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "state": "draft", "configuration": {"id": "ID", "href": "Href", "definition": {"name": "Name"}}, "href": "Href"}`) + })) + }) + It(`Invoke UpdateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("testString") + stackOutputVariableModel.Value = core.StringPtr("testString") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the UpdateConfigTemplateOptions model + updateConfigTemplateOptionsModel := new(projectv1.UpdateConfigTemplateOptions) + updateConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.ID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + updateConfigTemplateOptionsModel.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.UpdateConfigTemplateWithContext(ctx, updateConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.UpdateConfigTemplate(updateConfigTemplateOptionsModel) + 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.UpdateConfigTemplateWithContext(ctx, updateConfigTemplateOptionsModel) + 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(updateConfigTemplatePath)) + 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", `{"inputs": [{"name": "Name", "type": "array", "description": "Description", "default": "anyValue", "required": true, "hidden": true}], "outputs": [{"name": "Name", "value": "Value"}], "member_inputs": [{"config_id": "ConfigID", "inputs": ["Inputs"]}], "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "state": "draft", "configuration": {"id": "ID", "href": "Href", "definition": {"name": "Name"}}, "href": "Href"}`) + })) + }) + It(`Invoke UpdateConfigTemplate 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.UpdateConfigTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("testString") + stackOutputVariableModel.Value = core.StringPtr("testString") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the UpdateConfigTemplateOptions model + updateConfigTemplateOptionsModel := new(projectv1.UpdateConfigTemplateOptions) + updateConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.ID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + updateConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.UpdateConfigTemplate(updateConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("testString") + stackOutputVariableModel.Value = core.StringPtr("testString") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the UpdateConfigTemplateOptions model + updateConfigTemplateOptionsModel := new(projectv1.UpdateConfigTemplateOptions) + updateConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.ID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + updateConfigTemplateOptionsModel.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.UpdateConfigTemplate(updateConfigTemplateOptionsModel) + 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 UpdateConfigTemplateOptions model with no property values + updateConfigTemplateOptionsModelNew := new(projectv1.UpdateConfigTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.UpdateConfigTemplate(updateConfigTemplateOptionsModelNew) + 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 UpdateConfigTemplate 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 StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + stackOutputVariableModel.Name = core.StringPtr("testString") + stackOutputVariableModel.Value = core.StringPtr("testString") + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"cluster_name"} + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + + // Construct an instance of the UpdateConfigTemplateOptions model + updateConfigTemplateOptionsModel := new(projectv1.UpdateConfigTemplateOptions) + updateConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.ID = core.StringPtr("testString") + updateConfigTemplateOptionsModel.Definition = stackTemplateDefinitionBlockPrototypeModel + updateConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.UpdateConfigTemplate(updateConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PublishConfigTemplate(publishConfigTemplateOptions *PublishConfigTemplateOptions) - Operation response error`, func() { + publishConfigTemplatePath := "/v1/projects/testString/configs/testString/template/publish" + 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(publishConfigTemplatePath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke PublishConfigTemplate 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 PublishConfigTemplateOptions model + publishConfigTemplateOptionsModel := new(projectv1.PublishConfigTemplateOptions) + publishConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.ID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.CatalogID = core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c") + publishConfigTemplateOptionsModel.OfferingID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.TargetVersion = core.StringPtr("testString") + publishConfigTemplateOptionsModel.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.PublishConfigTemplate(publishConfigTemplateOptionsModel) + 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.PublishConfigTemplate(publishConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PublishConfigTemplate(publishConfigTemplateOptions *PublishConfigTemplateOptions)`, func() { + publishConfigTemplatePath := "/v1/projects/testString/configs/testString/template/publish" + 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(publishConfigTemplatePath)) + 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(200) + fmt.Fprintf(res, "%s", `{}`) + })) + }) + It(`Invoke PublishConfigTemplate 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 PublishConfigTemplateOptions model + publishConfigTemplateOptionsModel := new(projectv1.PublishConfigTemplateOptions) + publishConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.ID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.CatalogID = core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c") + publishConfigTemplateOptionsModel.OfferingID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.TargetVersion = core.StringPtr("testString") + publishConfigTemplateOptionsModel.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.PublishConfigTemplateWithContext(ctx, publishConfigTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + projectService.DisableRetries() + result, response, operationErr := projectService.PublishConfigTemplate(publishConfigTemplateOptionsModel) + 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.PublishConfigTemplateWithContext(ctx, publishConfigTemplateOptionsModel) + 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(publishConfigTemplatePath)) + 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(200) + fmt.Fprintf(res, "%s", `{}`) + })) + }) + It(`Invoke PublishConfigTemplate 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.PublishConfigTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the PublishConfigTemplateOptions model + publishConfigTemplateOptionsModel := new(projectv1.PublishConfigTemplateOptions) + publishConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.ID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.CatalogID = core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c") + publishConfigTemplateOptionsModel.OfferingID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.TargetVersion = core.StringPtr("testString") + publishConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = projectService.PublishConfigTemplate(publishConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke PublishConfigTemplate 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 PublishConfigTemplateOptions model + publishConfigTemplateOptionsModel := new(projectv1.PublishConfigTemplateOptions) + publishConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.ID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.CatalogID = core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c") + publishConfigTemplateOptionsModel.OfferingID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.TargetVersion = core.StringPtr("testString") + publishConfigTemplateOptionsModel.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.PublishConfigTemplate(publishConfigTemplateOptionsModel) + 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 PublishConfigTemplateOptions model with no property values + publishConfigTemplateOptionsModelNew := new(projectv1.PublishConfigTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = projectService.PublishConfigTemplate(publishConfigTemplateOptionsModelNew) + 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 PublishConfigTemplate 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 PublishConfigTemplateOptions model + publishConfigTemplateOptionsModel := new(projectv1.PublishConfigTemplateOptions) + publishConfigTemplateOptionsModel.ProjectID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.ID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.CatalogID = core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c") + publishConfigTemplateOptionsModel.OfferingID = core.StringPtr("testString") + publishConfigTemplateOptionsModel.TargetVersion = core.StringPtr("testString") + publishConfigTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := projectService.PublishConfigTemplate(publishConfigTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) Describe(`ListConfigVersions(listConfigVersionsOptions *ListConfigVersionsOptions) - Operation response error`, func() { listConfigVersionsPath := "/v1/projects/testString/configs/testString/versions" Context(`Using mock server endpoint with invalid JSON response`, func() { @@ -6824,7 +8063,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke GetConfigVersion successfully with retries`, func() { @@ -6880,7 +8119,7 @@ var _ = Describe(`ProjectV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": [{"anyKey": "anyValue"}], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": {"anyKey": "anyValue"}}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "version": 7, "is_draft": false, "needs_attention_state": ["anyValue"], "created_at": "2019-01-01T12:00:00.000Z", "modified_at": "2019-01-01T12:00:00.000Z", "last_approved": {"at": "2019-01-01T12:00:00.000Z", "comment": "Comment", "is_forced": true, "user_id": "UserID"}, "last_saved_at": "2019-01-01T12:00:00.000Z", "last_validated": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "cost_estimate": {"version": "Version", "currency": "USD", "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": "2.0.4", "schema_version": "SchemaVersion", "status": "passed", "summary": {"total": "Total", "passed": "Passed", "failed": "Failed", "skipped": "Skipped"}, "timestamp": "2019-01-01T12:00:00.000Z"}}, "last_deployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_undeployed": {"href": "Href", "result": "failed", "job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}, "pre_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}, "post_job": {"id": "ID", "summary": {"job_id": "JobID", "start_time": "2019-01-01T12:00:00.000Z", "end_time": "2019-01-01T12:00:00.000Z", "tasks": 5, "ok": 2, "failed": 6, "skipped": 7, "changed": 7, "project_error": {"timestamp": "2019-01-01T12:00:00.000Z", "user_id": "UserID", "status_code": "StatusCode", "description": "Description", "error_response": "ErrorResponse"}}}}, "last_monitoring": {"href": "Href", "result": "failed", "drift_detection": {"job": {"id": "ID", "summary": {"version": "Version", "plan_summary": {"add": 3, "failed": 6, "update": 6, "destroy": 7, "add_resources": ["AddResources"], "failed_resources": ["FailedResources"], "updated_resources": ["UpdatedResources"], "destroy_resources": ["DestroyResources"]}, "apply_summary": {"success": 7, "failed": 6, "success_resources": ["SuccessResources"], "failed_resources": ["FailedResources"]}, "destroy_summary": {"success": 7, "failed": 6, "tainted": 7, "resources": {"success": ["Success"], "failed": ["Failed"], "tainted": ["Tainted"]}}, "message_summary": {"info": 4, "debug": 5, "error": 5}, "plan_messages": {"error_messages": [{}], "success_messages": ["SuccessMessages"], "update_messages": ["UpdateMessages"], "destroy_messages": ["DestroyMessages"]}, "apply_messages": {"error_messages": [{}], "success_messages": [{"resource_type": "ResourceType", "time-taken": "TimeTaken", "id": "ID"}]}, "destroy_messages": {"error_messages": [{}]}}}}}, "outputs": [{"name": "Name", "description": "Description", "value": "anyValue"}], "project": {"id": "ID", "href": "Href", "definition": {"name": "Name"}, "crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}, "references": {"anyKey": "anyValue"}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::", "validate_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "validate_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "deploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_pre_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}, "undeploy_post_script": {"type": "ansible", "path": "scripts/validate-post-ansible-playbook.yaml", "short_description": "ShortDescription"}}, "state": "approved", "update_available": false, "href": "Href", "definition": {"compliance_profile": {"id": "ID", "instance_id": "InstanceID", "instance_location": "InstanceLocation", "attachment_id": "AttachmentID", "profile_name": "ProfileName"}, "locator_id": "LocatorID", "description": "Description", "name": "Name", "environment_id": "EnvironmentID", "authorizations": {"trusted_profile_id": "TrustedProfileID", "method": "api_key", "api_key": "ApiKey"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}}`) })) }) It(`Invoke GetConfigVersion successfully`, func() { @@ -7290,6 +8529,64 @@ var _ = Describe(`ProjectV1`, func() { Expect(createConfigOptionsModel.Schematics).To(Equal(schematicsWorkspaceModel)) Expect(createConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateConfigTemplateOptions successfully`, func() { + // Construct an instance of the StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + Expect(stackInputVariableModel).ToNot(BeNil()) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + Expect(stackInputVariableModel.Name).To(Equal(core.StringPtr("region"))) + Expect(stackInputVariableModel.Type).To(Equal(core.StringPtr("string"))) + Expect(stackInputVariableModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(stackInputVariableModel.Default).To(Equal(core.StringPtr("testString"))) + Expect(stackInputVariableModel.Required).To(Equal(core.BoolPtr(true))) + Expect(stackInputVariableModel.Hidden).To(Equal(core.BoolPtr(false))) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + Expect(stackOutputVariableModel).ToNot(BeNil()) + stackOutputVariableModel.Name = core.StringPtr("vpc_cluster_id") + stackOutputVariableModel.Value = core.StringPtr("cluster_id") + Expect(stackOutputVariableModel.Name).To(Equal(core.StringPtr("vpc_cluster_id"))) + Expect(stackOutputVariableModel.Value).To(Equal(core.StringPtr("cluster_id"))) + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + Expect(stackTemplateMemberInputModel).ToNot(BeNil()) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"region", "cluster_name"} + Expect(stackTemplateMemberInputModel.ConfigID).To(Equal(core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX"))) + Expect(stackTemplateMemberInputModel.Inputs).To(Equal([]string{"region", "cluster_name"})) + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + Expect(stackTemplateDefinitionBlockPrototypeModel).ToNot(BeNil()) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + Expect(stackTemplateDefinitionBlockPrototypeModel.Inputs).To(Equal([]projectv1.StackInputVariable{*stackInputVariableModel})) + Expect(stackTemplateDefinitionBlockPrototypeModel.Outputs).To(Equal([]projectv1.StackOutputVariable{*stackOutputVariableModel})) + Expect(stackTemplateDefinitionBlockPrototypeModel.MemberInputs).To(Equal([]projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel})) + + // Construct an instance of the CreateConfigTemplateOptions model + projectID := "testString" + id := "testString" + var createConfigTemplateOptionsDefinition *projectv1.StackTemplateDefinitionBlockPrototype = nil + createConfigTemplateOptionsModel := projectService.NewCreateConfigTemplateOptions(projectID, id, createConfigTemplateOptionsDefinition) + createConfigTemplateOptionsModel.SetProjectID("testString") + createConfigTemplateOptionsModel.SetID("testString") + createConfigTemplateOptionsModel.SetDefinition(stackTemplateDefinitionBlockPrototypeModel) + createConfigTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createConfigTemplateOptionsModel).ToNot(BeNil()) + Expect(createConfigTemplateOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(createConfigTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(createConfigTemplateOptionsModel.Definition).To(Equal(stackTemplateDefinitionBlockPrototypeModel)) + Expect(createConfigTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateProjectEnvironmentOptions successfully`, func() { // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth) @@ -7556,6 +8853,19 @@ var _ = Describe(`ProjectV1`, func() { Expect(getConfigOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetConfigTemplateOptions successfully`, func() { + // Construct an instance of the GetConfigTemplateOptions model + projectID := "testString" + id := "testString" + getConfigTemplateOptionsModel := projectService.NewGetConfigTemplateOptions(projectID, id) + getConfigTemplateOptionsModel.SetProjectID("testString") + getConfigTemplateOptionsModel.SetID("testString") + getConfigTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getConfigTemplateOptionsModel).ToNot(BeNil()) + Expect(getConfigTemplateOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(getConfigTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getConfigTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetConfigVersionOptions successfully`, func() { // Construct an instance of the GetConfigVersionOptions model projectID := "testString" @@ -7685,6 +8995,47 @@ var _ = Describe(`ProjectV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewPublishConfigTemplateOptions successfully`, func() { + // Construct an instance of the PublishConfigTemplateOptions model + projectID := "testString" + id := "testString" + publishConfigTemplateOptionsCatalogID := "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c" + publishConfigTemplateOptionsModel := projectService.NewPublishConfigTemplateOptions(projectID, id, publishConfigTemplateOptionsCatalogID) + publishConfigTemplateOptionsModel.SetProjectID("testString") + publishConfigTemplateOptionsModel.SetID("testString") + publishConfigTemplateOptionsModel.SetCatalogID("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c") + publishConfigTemplateOptionsModel.SetOfferingID("testString") + publishConfigTemplateOptionsModel.SetTargetVersion("testString") + publishConfigTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(publishConfigTemplateOptionsModel).ToNot(BeNil()) + Expect(publishConfigTemplateOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(publishConfigTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(publishConfigTemplateOptionsModel.CatalogID).To(Equal(core.StringPtr("01e1a9ad-534b-4ab9-996a-b8f2a8653d5c"))) + Expect(publishConfigTemplateOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(publishConfigTemplateOptionsModel.TargetVersion).To(Equal(core.StringPtr("testString"))) + Expect(publishConfigTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewStackInputVariable successfully`, func() { + name := "testString" + typeVar := "array" + _model, err := projectService.NewStackInputVariable(name, typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewStackOutputVariable successfully`, func() { + name := "testString" + value := "testString" + _model, err := projectService.NewStackOutputVariable(name, value) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewStackTemplateMemberInput successfully`, func() { + configID := "testString" + inputs := []string{"testString"} + _model, err := projectService.NewStackTemplateMemberInput(configID, inputs) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewSyncConfigOptions successfully`, func() { // Construct an instance of the SchematicsWorkspace model schematicsWorkspaceModel := new(projectv1.SchematicsWorkspace) @@ -7779,6 +9130,64 @@ var _ = Describe(`ProjectV1`, func() { Expect(updateConfigOptionsModel.Definition).To(Equal(projectConfigDefinitionPatchModel)) Expect(updateConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateConfigTemplateOptions successfully`, func() { + // Construct an instance of the StackInputVariable model + stackInputVariableModel := new(projectv1.StackInputVariable) + Expect(stackInputVariableModel).ToNot(BeNil()) + stackInputVariableModel.Name = core.StringPtr("region") + stackInputVariableModel.Type = core.StringPtr("string") + stackInputVariableModel.Description = core.StringPtr("testString") + stackInputVariableModel.Default = core.StringPtr("testString") + stackInputVariableModel.Required = core.BoolPtr(true) + stackInputVariableModel.Hidden = core.BoolPtr(false) + Expect(stackInputVariableModel.Name).To(Equal(core.StringPtr("region"))) + Expect(stackInputVariableModel.Type).To(Equal(core.StringPtr("string"))) + Expect(stackInputVariableModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(stackInputVariableModel.Default).To(Equal(core.StringPtr("testString"))) + Expect(stackInputVariableModel.Required).To(Equal(core.BoolPtr(true))) + Expect(stackInputVariableModel.Hidden).To(Equal(core.BoolPtr(false))) + + // Construct an instance of the StackOutputVariable model + stackOutputVariableModel := new(projectv1.StackOutputVariable) + Expect(stackOutputVariableModel).ToNot(BeNil()) + stackOutputVariableModel.Name = core.StringPtr("testString") + stackOutputVariableModel.Value = core.StringPtr("testString") + Expect(stackOutputVariableModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(stackOutputVariableModel.Value).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the StackTemplateMemberInput model + stackTemplateMemberInputModel := new(projectv1.StackTemplateMemberInput) + Expect(stackTemplateMemberInputModel).ToNot(BeNil()) + stackTemplateMemberInputModel.ConfigID = core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX") + stackTemplateMemberInputModel.Inputs = []string{"cluster_name"} + Expect(stackTemplateMemberInputModel.ConfigID).To(Equal(core.StringPtr("293c3c36-a094-4115-a12b-de0a9ca39beX"))) + Expect(stackTemplateMemberInputModel.Inputs).To(Equal([]string{"cluster_name"})) + + // Construct an instance of the StackTemplateDefinitionBlockPrototype model + stackTemplateDefinitionBlockPrototypeModel := new(projectv1.StackTemplateDefinitionBlockPrototype) + Expect(stackTemplateDefinitionBlockPrototypeModel).ToNot(BeNil()) + stackTemplateDefinitionBlockPrototypeModel.Inputs = []projectv1.StackInputVariable{*stackInputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.Outputs = []projectv1.StackOutputVariable{*stackOutputVariableModel} + stackTemplateDefinitionBlockPrototypeModel.MemberInputs = []projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel} + Expect(stackTemplateDefinitionBlockPrototypeModel.Inputs).To(Equal([]projectv1.StackInputVariable{*stackInputVariableModel})) + Expect(stackTemplateDefinitionBlockPrototypeModel.Outputs).To(Equal([]projectv1.StackOutputVariable{*stackOutputVariableModel})) + Expect(stackTemplateDefinitionBlockPrototypeModel.MemberInputs).To(Equal([]projectv1.StackTemplateMemberInput{*stackTemplateMemberInputModel})) + + // Construct an instance of the UpdateConfigTemplateOptions model + projectID := "testString" + id := "testString" + var updateConfigTemplateOptionsDefinition *projectv1.StackTemplateDefinitionBlockPrototype = nil + updateConfigTemplateOptionsModel := projectService.NewUpdateConfigTemplateOptions(projectID, id, updateConfigTemplateOptionsDefinition) + updateConfigTemplateOptionsModel.SetProjectID("testString") + updateConfigTemplateOptionsModel.SetID("testString") + updateConfigTemplateOptionsModel.SetDefinition(stackTemplateDefinitionBlockPrototypeModel) + updateConfigTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateConfigTemplateOptionsModel).ToNot(BeNil()) + Expect(updateConfigTemplateOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(updateConfigTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateConfigTemplateOptionsModel.Definition).To(Equal(stackTemplateDefinitionBlockPrototypeModel)) + Expect(updateConfigTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateProjectEnvironmentOptions successfully`, func() { // Construct an instance of the ProjectConfigAuth model projectConfigAuthModel := new(projectv1.ProjectConfigAuth)