github.com/profzone/eden-framework@v1.0.10/internal/project/drone/volume.go (about)

     1  package drone
     2  
     3  type PipelineVolumeHost struct {
     4  	Path string `yaml:"path" json:"path"`
     5  }
     6  
     7  func (vh *PipelineVolumeHost) WithPath(p string) *PipelineVolumeHost {
     8  	vh.Path = p
     9  	return vh
    10  }
    11  
    12  type PipelineVolume struct {
    13  	Name string              `yaml:"name" json:"name"`
    14  	Host *PipelineVolumeHost `yaml:"host,omitempty" json:"host,omitempty"`
    15  	Temp *struct{}           `yaml:"temp,omitempty" json:"temp,omitempty"`
    16  }
    17  
    18  func NewPipelineVolume() *PipelineVolume {
    19  	return &PipelineVolume{}
    20  }
    21  
    22  func (v *PipelineVolume) WithName(n string) *PipelineVolume {
    23  	v.Name = n
    24  	return v
    25  }
    26  
    27  func (v *PipelineVolume) WithHost(h *PipelineVolumeHost) *PipelineVolume {
    28  	v.Host = h
    29  	v.Temp = nil
    30  	return v
    31  }
    32  
    33  func (v *PipelineVolume) WithTemp() *PipelineVolume {
    34  	v.Host = nil
    35  	v.Temp = &struct{}{}
    36  	return v
    37  }
    38  
    39  type PipelineStepVolume struct {
    40  	Name string `yaml:"name" json:"name"`
    41  	Path string `yaml:"path" json:"path"`
    42  }
    43  
    44  func NewPipelineStepVolume() *PipelineStepVolume {
    45  	return &PipelineStepVolume{}
    46  }
    47  
    48  func (v *PipelineStepVolume) WithName(n string) *PipelineStepVolume {
    49  	v.Name = n
    50  	return v
    51  }
    52  
    53  func (v *PipelineStepVolume) WithPath(p string) *PipelineStepVolume {
    54  	v.Path = p
    55  	return v
    56  }