From 189c0ac1213738aa65c9bb2ecb18c9c2ab655bfd Mon Sep 17 00:00:00 2001 From: ecrupper Date: Tue, 13 Aug 2024 07:20:52 -0500 Subject: [PATCH] updates --- library/step.go | 27 ++++++++++++++++++++++++ pipeline/container.go | 49 +++++++++++++++++++++++-------------------- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/library/step.go b/library/step.go index 293efd36..719ce809 100644 --- a/library/step.go +++ b/library/step.go @@ -33,6 +33,7 @@ type Step struct { Distribution *string `json:"distribution,omitempty"` CheckID *int64 `json:"check_id,omitempty"` ReportAs *string `json:"report_as,omitempty"` + Report *Report `json:"report,omitempty"` } // Duration calculates and returns the total amount of @@ -319,6 +320,19 @@ func (s *Step) GetReportAs() string { return *s.ReportAs } +// GetReport returns the Report field. +// +// When the provided Step type is nil, or the field within +// the type is nil, it returns the zero value for the field. +func (s *Step) GetReport() *Report { + // return zero value if Step type or Report field is nil + if s == nil || s.Report == nil { + return new(Report) + } + + return s.Report +} + // SetID sets the ID field. // // When the provided Step type is nil, it @@ -553,6 +567,19 @@ func (s *Step) SetReportAs(v string) { s.ReportAs = &v } +// SetReport sets the Report field. +// +// When the provided Step type is nil, it +// will set nothing and immediately return. +func (s *Step) SetReport(v *Report) { + // return if Step type is nil + if s == nil { + return + } + + s.Report = v +} + // String implements the Stringer interface for the Step type. func (s *Step) String() string { return fmt.Sprintf(`{ diff --git a/pipeline/container.go b/pipeline/container.go index 8e2e55f1..25447804 100644 --- a/pipeline/container.go +++ b/pipeline/container.go @@ -31,28 +31,30 @@ type ( // // swagger:model PipelineContainer Container struct { - ID string `json:"id,omitempty" yaml:"id,omitempty"` - Commands []string `json:"commands,omitempty" yaml:"commands,omitempty"` - Detach bool `json:"detach,omitempty" yaml:"detach,omitempty"` - Directory string `json:"directory,omitempty" yaml:"directory,omitempty"` - Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` - Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"` - ExitCode int `json:"exit_code,omitempty" yaml:"exit_code,omitempty"` - Image string `json:"image,omitempty" yaml:"image,omitempty"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Needs []string `json:"needs,omitempty" yaml:"needs,omitempty"` - Networks []string `json:"networks,omitempty" yaml:"networks,omitempty"` - Number int `json:"number,omitempty" yaml:"number,omitempty"` - Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` - Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` - Pull string `json:"pull,omitempty" yaml:"pull,omitempty"` - Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"` - Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` - Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` - Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"` - User string `json:"user,omitempty" yaml:"user,omitempty"` - ReportAs string `json:"report_as,omitempty" yaml:"report_as,omitempty"` - IDRequest string `json:"id_request,omitempty" yaml:"id_request,omitempty"` + ID string `json:"id,omitempty" yaml:"id,omitempty"` + Commands []string `json:"commands,omitempty" yaml:"commands,omitempty"` + Detach bool `json:"detach,omitempty" yaml:"detach,omitempty"` + Directory string `json:"directory,omitempty" yaml:"directory,omitempty"` + Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` + Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"` + ExitCode int `json:"exit_code,omitempty" yaml:"exit_code,omitempty"` + Image string `json:"image,omitempty" yaml:"image,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Needs []string `json:"needs,omitempty" yaml:"needs,omitempty"` + Networks []string `json:"networks,omitempty" yaml:"networks,omitempty"` + Number int `json:"number,omitempty" yaml:"number,omitempty"` + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` + Pull string `json:"pull,omitempty" yaml:"pull,omitempty"` + Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"` + Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` + Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` + Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"` + User string `json:"user,omitempty" yaml:"user,omitempty"` + ReportAs string `json:"report_as,omitempty" yaml:"report_as,omitempty"` + IDRequest string `json:"id_request,omitempty" yaml:"id_request,omitempty"` + ReportStatus bool `json:"report_status,omitempty" yaml:"report_status,omitempty"` + ReportPath string `json:"report_path,omitempty" yaml:"report_path,omitempty"` } ) @@ -137,7 +139,8 @@ func (c *Container) Empty() bool { len(c.Volumes) == 0 && len(c.User) == 0 && len(c.ReportAs) == 0 && - len(c.IDRequest) == 0 { + len(c.IDRequest) == 0 && + len(c.ReportPath) == 0 { return true }