Best Gauge code snippet using execution.String
zz_generated_pipeline_execution_controller.go
Source:zz_generated_pipeline_execution_controller.go
1package v32import (3 "context"4 "github.com/rancher/norman/controller"5 "github.com/rancher/norman/objectclient"6 "github.com/rancher/norman/resource"7 "k8s.io/apimachinery/pkg/api/errors"8 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"9 "k8s.io/apimachinery/pkg/labels"10 "k8s.io/apimachinery/pkg/runtime"11 "k8s.io/apimachinery/pkg/runtime/schema"12 "k8s.io/apimachinery/pkg/types"13 "k8s.io/apimachinery/pkg/watch"14 "k8s.io/client-go/tools/cache"15)16var (17 PipelineExecutionGroupVersionKind = schema.GroupVersionKind{18 Version: Version,19 Group: GroupName,20 Kind: "PipelineExecution",21 }22 PipelineExecutionResource = metav1.APIResource{23 Name: "pipelineexecutions",24 SingularName: "pipelineexecution",25 Namespaced: true,26 Kind: PipelineExecutionGroupVersionKind.Kind,27 }28 PipelineExecutionGroupVersionResource = schema.GroupVersionResource{29 Group: GroupName,30 Version: Version,31 Resource: "pipelineexecutions",32 }33)34func init() {35 resource.Put(PipelineExecutionGroupVersionResource)36}37func NewPipelineExecution(namespace, name string, obj PipelineExecution) *PipelineExecution {38 obj.APIVersion, obj.Kind = PipelineExecutionGroupVersionKind.ToAPIVersionAndKind()39 obj.Name = name40 obj.Namespace = namespace41 return &obj42}43type PipelineExecutionList struct {44 metav1.TypeMeta `json:",inline"`45 metav1.ListMeta `json:"metadata,omitempty"`46 Items []PipelineExecution `json:"items"`47}48type PipelineExecutionHandlerFunc func(key string, obj *PipelineExecution) (runtime.Object, error)49type PipelineExecutionChangeHandlerFunc func(obj *PipelineExecution) (runtime.Object, error)50type PipelineExecutionLister interface {51 List(namespace string, selector labels.Selector) (ret []*PipelineExecution, err error)52 Get(namespace, name string) (*PipelineExecution, error)53}54type PipelineExecutionController interface {55 Generic() controller.GenericController56 Informer() cache.SharedIndexInformer57 Lister() PipelineExecutionLister58 AddHandler(ctx context.Context, name string, handler PipelineExecutionHandlerFunc)59 AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync PipelineExecutionHandlerFunc)60 AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler PipelineExecutionHandlerFunc)61 AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler PipelineExecutionHandlerFunc)62 Enqueue(namespace, name string)63 Sync(ctx context.Context) error64 Start(ctx context.Context, threadiness int) error65}66type PipelineExecutionInterface interface {67 ObjectClient() *objectclient.ObjectClient68 Create(*PipelineExecution) (*PipelineExecution, error)69 GetNamespaced(namespace, name string, opts metav1.GetOptions) (*PipelineExecution, error)70 Get(name string, opts metav1.GetOptions) (*PipelineExecution, error)71 Update(*PipelineExecution) (*PipelineExecution, error)72 Delete(name string, options *metav1.DeleteOptions) error73 DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error74 List(opts metav1.ListOptions) (*PipelineExecutionList, error)75 Watch(opts metav1.ListOptions) (watch.Interface, error)76 DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error77 Controller() PipelineExecutionController78 AddHandler(ctx context.Context, name string, sync PipelineExecutionHandlerFunc)79 AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync PipelineExecutionHandlerFunc)80 AddLifecycle(ctx context.Context, name string, lifecycle PipelineExecutionLifecycle)81 AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle PipelineExecutionLifecycle)82 AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PipelineExecutionHandlerFunc)83 AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync PipelineExecutionHandlerFunc)84 AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PipelineExecutionLifecycle)85 AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle PipelineExecutionLifecycle)86}87type pipelineExecutionLister struct {88 controller *pipelineExecutionController89}90func (l *pipelineExecutionLister) List(namespace string, selector labels.Selector) (ret []*PipelineExecution, err error) {91 err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {92 ret = append(ret, obj.(*PipelineExecution))93 })94 return95}96func (l *pipelineExecutionLister) Get(namespace, name string) (*PipelineExecution, error) {97 var key string98 if namespace != "" {99 key = namespace + "/" + name100 } else {101 key = name102 }103 obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)104 if err != nil {105 return nil, err106 }107 if !exists {108 return nil, errors.NewNotFound(schema.GroupResource{109 Group: PipelineExecutionGroupVersionKind.Group,110 Resource: "pipelineExecution",111 }, key)112 }113 return obj.(*PipelineExecution), nil114}115type pipelineExecutionController struct {116 controller.GenericController117}118func (c *pipelineExecutionController) Generic() controller.GenericController {119 return c.GenericController120}121func (c *pipelineExecutionController) Lister() PipelineExecutionLister {122 return &pipelineExecutionLister{123 controller: c,124 }125}126func (c *pipelineExecutionController) AddHandler(ctx context.Context, name string, handler PipelineExecutionHandlerFunc) {127 c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {128 if obj == nil {129 return handler(key, nil)130 } else if v, ok := obj.(*PipelineExecution); ok {131 return handler(key, v)132 } else {133 return nil, nil134 }135 })136}137func (c *pipelineExecutionController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler PipelineExecutionHandlerFunc) {138 c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {139 if !enabled() {140 return nil, nil141 } else if obj == nil {142 return handler(key, nil)143 } else if v, ok := obj.(*PipelineExecution); ok {144 return handler(key, v)145 } else {146 return nil, nil147 }148 })149}150func (c *pipelineExecutionController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler PipelineExecutionHandlerFunc) {151 c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {152 if obj == nil {153 return handler(key, nil)154 } else if v, ok := obj.(*PipelineExecution); ok && controller.ObjectInCluster(cluster, obj) {155 return handler(key, v)156 } else {157 return nil, nil158 }159 })160}161func (c *pipelineExecutionController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler PipelineExecutionHandlerFunc) {162 c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {163 if !enabled() {164 return nil, nil165 } else if obj == nil {166 return handler(key, nil)167 } else if v, ok := obj.(*PipelineExecution); ok && controller.ObjectInCluster(cluster, obj) {168 return handler(key, v)169 } else {170 return nil, nil171 }172 })173}174type pipelineExecutionFactory struct {175}176func (c pipelineExecutionFactory) Object() runtime.Object {177 return &PipelineExecution{}178}179func (c pipelineExecutionFactory) List() runtime.Object {180 return &PipelineExecutionList{}181}182func (s *pipelineExecutionClient) Controller() PipelineExecutionController {183 s.client.Lock()184 defer s.client.Unlock()185 c, ok := s.client.pipelineExecutionControllers[s.ns]186 if ok {187 return c188 }189 genericController := controller.NewGenericController(PipelineExecutionGroupVersionKind.Kind+"Controller",190 s.objectClient)191 c = &pipelineExecutionController{192 GenericController: genericController,193 }194 s.client.pipelineExecutionControllers[s.ns] = c195 s.client.starters = append(s.client.starters, c)196 return c197}198type pipelineExecutionClient struct {199 client *Client200 ns string201 objectClient *objectclient.ObjectClient202 controller PipelineExecutionController203}204func (s *pipelineExecutionClient) ObjectClient() *objectclient.ObjectClient {205 return s.objectClient206}207func (s *pipelineExecutionClient) Create(o *PipelineExecution) (*PipelineExecution, error) {208 obj, err := s.objectClient.Create(o)209 return obj.(*PipelineExecution), err210}211func (s *pipelineExecutionClient) Get(name string, opts metav1.GetOptions) (*PipelineExecution, error) {212 obj, err := s.objectClient.Get(name, opts)213 return obj.(*PipelineExecution), err214}215func (s *pipelineExecutionClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*PipelineExecution, error) {216 obj, err := s.objectClient.GetNamespaced(namespace, name, opts)217 return obj.(*PipelineExecution), err218}219func (s *pipelineExecutionClient) Update(o *PipelineExecution) (*PipelineExecution, error) {220 obj, err := s.objectClient.Update(o.Name, o)221 return obj.(*PipelineExecution), err222}223func (s *pipelineExecutionClient) Delete(name string, options *metav1.DeleteOptions) error {224 return s.objectClient.Delete(name, options)225}226func (s *pipelineExecutionClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {227 return s.objectClient.DeleteNamespaced(namespace, name, options)228}229func (s *pipelineExecutionClient) List(opts metav1.ListOptions) (*PipelineExecutionList, error) {230 obj, err := s.objectClient.List(opts)231 return obj.(*PipelineExecutionList), err232}233func (s *pipelineExecutionClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {234 return s.objectClient.Watch(opts)235}236// Patch applies the patch and returns the patched deployment.237func (s *pipelineExecutionClient) Patch(o *PipelineExecution, patchType types.PatchType, data []byte, subresources ...string) (*PipelineExecution, error) {238 obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)239 return obj.(*PipelineExecution), err240}241func (s *pipelineExecutionClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {242 return s.objectClient.DeleteCollection(deleteOpts, listOpts)243}244func (s *pipelineExecutionClient) AddHandler(ctx context.Context, name string, sync PipelineExecutionHandlerFunc) {245 s.Controller().AddHandler(ctx, name, sync)246}247func (s *pipelineExecutionClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync PipelineExecutionHandlerFunc) {248 s.Controller().AddFeatureHandler(ctx, enabled, name, sync)249}250func (s *pipelineExecutionClient) AddLifecycle(ctx context.Context, name string, lifecycle PipelineExecutionLifecycle) {251 sync := NewPipelineExecutionLifecycleAdapter(name, false, s, lifecycle)252 s.Controller().AddHandler(ctx, name, sync)253}254func (s *pipelineExecutionClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle PipelineExecutionLifecycle) {255 sync := NewPipelineExecutionLifecycleAdapter(name, false, s, lifecycle)256 s.Controller().AddFeatureHandler(ctx, enabled, name, sync)257}258func (s *pipelineExecutionClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PipelineExecutionHandlerFunc) {259 s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)260}261func (s *pipelineExecutionClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync PipelineExecutionHandlerFunc) {262 s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)263}264func (s *pipelineExecutionClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PipelineExecutionLifecycle) {265 sync := NewPipelineExecutionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)266 s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)267}268func (s *pipelineExecutionClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle PipelineExecutionLifecycle) {269 sync := NewPipelineExecutionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)270 s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)271}272type PipelineExecutionIndexer func(obj *PipelineExecution) ([]string, error)273type PipelineExecutionClientCache interface {274 Get(namespace, name string) (*PipelineExecution, error)275 List(namespace string, selector labels.Selector) ([]*PipelineExecution, error)276 Index(name string, indexer PipelineExecutionIndexer)277 GetIndexed(name, key string) ([]*PipelineExecution, error)278}279type PipelineExecutionClient interface {280 Create(*PipelineExecution) (*PipelineExecution, error)281 Get(namespace, name string, opts metav1.GetOptions) (*PipelineExecution, error)282 Update(*PipelineExecution) (*PipelineExecution, error)283 Delete(namespace, name string, options *metav1.DeleteOptions) error284 List(namespace string, opts metav1.ListOptions) (*PipelineExecutionList, error)285 Watch(opts metav1.ListOptions) (watch.Interface, error)286 Cache() PipelineExecutionClientCache287 OnCreate(ctx context.Context, name string, sync PipelineExecutionChangeHandlerFunc)288 OnChange(ctx context.Context, name string, sync PipelineExecutionChangeHandlerFunc)289 OnRemove(ctx context.Context, name string, sync PipelineExecutionChangeHandlerFunc)290 Enqueue(namespace, name string)291 Generic() controller.GenericController292 ObjectClient() *objectclient.ObjectClient293 Interface() PipelineExecutionInterface294}295type pipelineExecutionClientCache struct {296 client *pipelineExecutionClient2297}298type pipelineExecutionClient2 struct {299 iface PipelineExecutionInterface300 controller PipelineExecutionController301}302func (n *pipelineExecutionClient2) Interface() PipelineExecutionInterface {303 return n.iface304}305func (n *pipelineExecutionClient2) Generic() controller.GenericController {306 return n.iface.Controller().Generic()307}308func (n *pipelineExecutionClient2) ObjectClient() *objectclient.ObjectClient {309 return n.Interface().ObjectClient()310}311func (n *pipelineExecutionClient2) Enqueue(namespace, name string) {312 n.iface.Controller().Enqueue(namespace, name)313}314func (n *pipelineExecutionClient2) Create(obj *PipelineExecution) (*PipelineExecution, error) {315 return n.iface.Create(obj)316}317func (n *pipelineExecutionClient2) Get(namespace, name string, opts metav1.GetOptions) (*PipelineExecution, error) {318 return n.iface.GetNamespaced(namespace, name, opts)319}320func (n *pipelineExecutionClient2) Update(obj *PipelineExecution) (*PipelineExecution, error) {321 return n.iface.Update(obj)322}323func (n *pipelineExecutionClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {324 return n.iface.DeleteNamespaced(namespace, name, options)325}326func (n *pipelineExecutionClient2) List(namespace string, opts metav1.ListOptions) (*PipelineExecutionList, error) {327 return n.iface.List(opts)328}329func (n *pipelineExecutionClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {330 return n.iface.Watch(opts)331}332func (n *pipelineExecutionClientCache) Get(namespace, name string) (*PipelineExecution, error) {333 return n.client.controller.Lister().Get(namespace, name)334}335func (n *pipelineExecutionClientCache) List(namespace string, selector labels.Selector) ([]*PipelineExecution, error) {336 return n.client.controller.Lister().List(namespace, selector)337}338func (n *pipelineExecutionClient2) Cache() PipelineExecutionClientCache {339 n.loadController()340 return &pipelineExecutionClientCache{341 client: n,342 }343}344func (n *pipelineExecutionClient2) OnCreate(ctx context.Context, name string, sync PipelineExecutionChangeHandlerFunc) {345 n.loadController()346 n.iface.AddLifecycle(ctx, name+"-create", &pipelineExecutionLifecycleDelegate{create: sync})347}348func (n *pipelineExecutionClient2) OnChange(ctx context.Context, name string, sync PipelineExecutionChangeHandlerFunc) {349 n.loadController()350 n.iface.AddLifecycle(ctx, name+"-change", &pipelineExecutionLifecycleDelegate{update: sync})351}352func (n *pipelineExecutionClient2) OnRemove(ctx context.Context, name string, sync PipelineExecutionChangeHandlerFunc) {353 n.loadController()354 n.iface.AddLifecycle(ctx, name, &pipelineExecutionLifecycleDelegate{remove: sync})355}356func (n *pipelineExecutionClientCache) Index(name string, indexer PipelineExecutionIndexer) {357 err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{358 name: func(obj interface{}) ([]string, error) {359 if v, ok := obj.(*PipelineExecution); ok {360 return indexer(v)361 }362 return nil, nil363 },364 })365 if err != nil {366 panic(err)367 }368}369func (n *pipelineExecutionClientCache) GetIndexed(name, key string) ([]*PipelineExecution, error) {370 var result []*PipelineExecution371 objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)372 if err != nil {373 return nil, err374 }375 for _, obj := range objs {376 if v, ok := obj.(*PipelineExecution); ok {377 result = append(result, v)378 }379 }380 return result, nil381}382func (n *pipelineExecutionClient2) loadController() {383 if n.controller == nil {384 n.controller = n.iface.Controller()385 }386}387type pipelineExecutionLifecycleDelegate struct {388 create PipelineExecutionChangeHandlerFunc389 update PipelineExecutionChangeHandlerFunc390 remove PipelineExecutionChangeHandlerFunc391}392func (n *pipelineExecutionLifecycleDelegate) HasCreate() bool {393 return n.create != nil394}395func (n *pipelineExecutionLifecycleDelegate) Create(obj *PipelineExecution) (runtime.Object, error) {396 if n.create == nil {397 return obj, nil398 }399 return n.create(obj)400}401func (n *pipelineExecutionLifecycleDelegate) HasFinalize() bool {402 return n.remove != nil403}404func (n *pipelineExecutionLifecycleDelegate) Remove(obj *PipelineExecution) (runtime.Object, error) {405 if n.remove == nil {406 return obj, nil407 }408 return n.remove(obj)409}410func (n *pipelineExecutionLifecycleDelegate) Updated(obj *PipelineExecution) (runtime.Object, error) {411 if n.update == nil {412 return obj, nil413 }414 return n.update(obj)415}...
zz_generated_pipeline_execution.go
Source:zz_generated_pipeline_execution.go
1package client2import (3 "github.com/rancher/norman/types"4)5const (6 PipelineExecutionType = "pipelineExecution"7 PipelineExecutionFieldAnnotations = "annotations"8 PipelineExecutionFieldAuthor = "author"9 PipelineExecutionFieldAvatarURL = "avatarUrl"10 PipelineExecutionFieldBranch = "branch"11 PipelineExecutionFieldCommit = "commit"12 PipelineExecutionFieldConditions = "conditions"13 PipelineExecutionFieldCreated = "created"14 PipelineExecutionFieldCreatorID = "creatorId"15 PipelineExecutionFieldEmail = "email"16 PipelineExecutionFieldEnded = "ended"17 PipelineExecutionFieldEvent = "event"18 PipelineExecutionFieldExecutionState = "executionState"19 PipelineExecutionFieldHTMLLink = "htmlLink"20 PipelineExecutionFieldLabels = "labels"21 PipelineExecutionFieldMessage = "message"22 PipelineExecutionFieldName = "name"23 PipelineExecutionFieldNamespaceId = "namespaceId"24 PipelineExecutionFieldOwnerReferences = "ownerReferences"25 PipelineExecutionFieldPipelineConfig = "pipelineConfig"26 PipelineExecutionFieldPipelineID = "pipelineId"27 PipelineExecutionFieldProjectID = "projectId"28 PipelineExecutionFieldRef = "ref"29 PipelineExecutionFieldRemoved = "removed"30 PipelineExecutionFieldRepositoryURL = "repositoryUrl"31 PipelineExecutionFieldRun = "run"32 PipelineExecutionFieldStages = "stages"33 PipelineExecutionFieldStarted = "started"34 PipelineExecutionFieldState = "state"35 PipelineExecutionFieldTitle = "title"36 PipelineExecutionFieldTransitioning = "transitioning"37 PipelineExecutionFieldTransitioningMessage = "transitioningMessage"38 PipelineExecutionFieldTriggerUserID = "triggerUserId"39 PipelineExecutionFieldTriggeredBy = "triggeredBy"40 PipelineExecutionFieldUUID = "uuid"41)42type PipelineExecution struct {43 types.Resource44 Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`45 Author string `json:"author,omitempty" yaml:"author,omitempty"`46 AvatarURL string `json:"avatarUrl,omitempty" yaml:"avatarUrl,omitempty"`47 Branch string `json:"branch,omitempty" yaml:"branch,omitempty"`48 Commit string `json:"commit,omitempty" yaml:"commit,omitempty"`49 Conditions []PipelineCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`50 Created string `json:"created,omitempty" yaml:"created,omitempty"`51 CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`52 Email string `json:"email,omitempty" yaml:"email,omitempty"`53 Ended string `json:"ended,omitempty" yaml:"ended,omitempty"`54 Event string `json:"event,omitempty" yaml:"event,omitempty"`55 ExecutionState string `json:"executionState,omitempty" yaml:"executionState,omitempty"`56 HTMLLink string `json:"htmlLink,omitempty" yaml:"htmlLink,omitempty"`57 Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`58 Message string `json:"message,omitempty" yaml:"message,omitempty"`59 Name string `json:"name,omitempty" yaml:"name,omitempty"`60 NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"`61 OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`62 PipelineConfig *PipelineConfig `json:"pipelineConfig,omitempty" yaml:"pipelineConfig,omitempty"`63 PipelineID string `json:"pipelineId,omitempty" yaml:"pipelineId,omitempty"`64 ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`65 Ref string `json:"ref,omitempty" yaml:"ref,omitempty"`66 Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`67 RepositoryURL string `json:"repositoryUrl,omitempty" yaml:"repositoryUrl,omitempty"`68 Run int64 `json:"run,omitempty" yaml:"run,omitempty"`69 Stages []StageStatus `json:"stages,omitempty" yaml:"stages,omitempty"`70 Started string `json:"started,omitempty" yaml:"started,omitempty"`71 State string `json:"state,omitempty" yaml:"state,omitempty"`72 Title string `json:"title,omitempty" yaml:"title,omitempty"`73 Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`74 TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`75 TriggerUserID string `json:"triggerUserId,omitempty" yaml:"triggerUserId,omitempty"`76 TriggeredBy string `json:"triggeredBy,omitempty" yaml:"triggeredBy,omitempty"`77 UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`78}79type PipelineExecutionCollection struct {80 types.Collection81 Data []PipelineExecution `json:"data,omitempty"`82 client *PipelineExecutionClient83}84type PipelineExecutionClient struct {85 apiClient *Client86}87type PipelineExecutionOperations interface {88 List(opts *types.ListOpts) (*PipelineExecutionCollection, error)89 Create(opts *PipelineExecution) (*PipelineExecution, error)90 Update(existing *PipelineExecution, updates interface{}) (*PipelineExecution, error)91 Replace(existing *PipelineExecution) (*PipelineExecution, error)92 ByID(id string) (*PipelineExecution, error)93 Delete(container *PipelineExecution) error94 ActionRerun(resource *PipelineExecution) error95 ActionStop(resource *PipelineExecution) error96}97func newPipelineExecutionClient(apiClient *Client) *PipelineExecutionClient {98 return &PipelineExecutionClient{99 apiClient: apiClient,100 }101}102func (c *PipelineExecutionClient) Create(container *PipelineExecution) (*PipelineExecution, error) {103 resp := &PipelineExecution{}104 err := c.apiClient.Ops.DoCreate(PipelineExecutionType, container, resp)105 return resp, err106}107func (c *PipelineExecutionClient) Update(existing *PipelineExecution, updates interface{}) (*PipelineExecution, error) {108 resp := &PipelineExecution{}109 err := c.apiClient.Ops.DoUpdate(PipelineExecutionType, &existing.Resource, updates, resp)110 return resp, err111}112func (c *PipelineExecutionClient) Replace(obj *PipelineExecution) (*PipelineExecution, error) {113 resp := &PipelineExecution{}114 err := c.apiClient.Ops.DoReplace(PipelineExecutionType, &obj.Resource, obj, resp)115 return resp, err116}117func (c *PipelineExecutionClient) List(opts *types.ListOpts) (*PipelineExecutionCollection, error) {118 resp := &PipelineExecutionCollection{}119 err := c.apiClient.Ops.DoList(PipelineExecutionType, opts, resp)120 resp.client = c121 return resp, err122}123func (cc *PipelineExecutionCollection) Next() (*PipelineExecutionCollection, error) {124 if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {125 resp := &PipelineExecutionCollection{}126 err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)127 resp.client = cc.client128 return resp, err129 }130 return nil, nil131}132func (c *PipelineExecutionClient) ByID(id string) (*PipelineExecution, error) {133 resp := &PipelineExecution{}134 err := c.apiClient.Ops.DoByID(PipelineExecutionType, id, resp)135 return resp, err136}137func (c *PipelineExecutionClient) Delete(container *PipelineExecution) error {138 return c.apiClient.Ops.DoResourceDelete(PipelineExecutionType, &container.Resource)139}140func (c *PipelineExecutionClient) ActionRerun(resource *PipelineExecution) error {141 err := c.apiClient.Ops.DoAction(PipelineExecutionType, "rerun", &resource.Resource, nil, nil)142 return err143}144func (c *PipelineExecutionClient) ActionStop(resource *PipelineExecution) error {145 err := c.apiClient.Ops.DoAction(PipelineExecutionType, "stop", &resource.Resource, nil, nil)146 return err147}...
summary.go
Source:summary.go
...32 "errors": SummarizeErrors,33 "output": SummarizeOutput,34 "all": SummarizeAll,35}36func (s Summary) String() string {37 if s == SummarizeNone {38 return "none"39 }40 var result []string41 for v := Summary(1); v <= s; v <<= 1 {42 if s.Includes(v) {43 result = append(result, summaryValues[v])44 }45 }46 return strings.Join(result, ",")47}48// Includes returns true if Summary includes all the values set by other.49func (s Summary) Includes(other Summary) bool {50 return s&other == other51}52// NewSummary returns a new Summary from a string value. If the string does not53// match any known values returns false for the second value.54func NewSummary(value string) (Summary, bool) {55 s, ok := summaryFromValue[value]56 return s, ok57}58// PrintSummary of a test Execution. Prints a section for each summary type59// followed by a DONE line.60func PrintSummary(out io.Writer, execution *Execution, opts Summary) error {61 execSummary := newExecSummary(execution, opts)62 if opts.Includes(SummarizeSkipped) {63 writeTestCaseSummary(out, execSummary, formatSkipped())64 }65 if opts.Includes(SummarizeFailed) {66 writeTestCaseSummary(out, execSummary, formatFailed())67 }68 errors := execution.Errors()69 if opts.Includes(SummarizeErrors) {70 writeErrorSummary(out, errors)71 }72 fmt.Fprintf(out, "\n%s %d tests%s%s%s in %s\n",73 "DONE", // TODO: maybe color this?74 execution.Total(),75 formatTestCount(len(execution.Skipped()), "skipped", ""),76 formatTestCount(len(execution.Failed()), "failure", "s"),77 formatTestCount(countErrors(errors), "error", "s"),78 FormatDurationAsSeconds(execution.Elapsed(), 3))79 return nil80}81func formatTestCount(count int, category string, pluralize string) string {82 switch count {83 case 0:84 return ""85 case 1:86 default:87 category += pluralize88 }89 return fmt.Sprintf(", %d %s", count, category)90}91// FormatDurationAsSeconds formats a time.Duration as a float with an s suffix.92func FormatDurationAsSeconds(d time.Duration, precision int) string {93 return fmt.Sprintf("%.[2]*[1]fs", d.Seconds(), precision)94}95func writeErrorSummary(out io.Writer, errors []string) {96 if len(errors) > 0 {97 fmt.Fprintln(out, color.MagentaString("\n=== Errors"))98 }99 for _, err := range errors {100 fmt.Fprintln(out, err)101 }102}103// countErrors in stderr lines. Build errors may include multiple lines where104// subsequent lines are indented.105// FIXME: Panics will include multiple lines, and are still overcounted.106func countErrors(errors []string) int {107 var count int108 for _, line := range errors {109 r, _ := utf8.DecodeRuneInString(line)110 if !unicode.IsSpace(r) {111 count++112 }113 }114 return count115}116type executionSummary interface {117 Failed() []TestCase118 Skipped() []TestCase119 OutputLines(pkg, test string) []string120}121type noOutputSummary struct {122 Execution123}124func (s *noOutputSummary) OutputLines(_, _ string) []string {125 return nil126}127func newExecSummary(execution *Execution, opts Summary) executionSummary {128 if opts.Includes(SummarizeOutput) {129 return execution130 }131 return &noOutputSummary{Execution: *execution}132}133func writeTestCaseSummary(out io.Writer, execution executionSummary, conf testCaseFormatConfig) {134 testCases := conf.getter(execution)135 if len(testCases) == 0 {136 return137 }138 fmt.Fprintln(out, "\n=== "+conf.header)139 for _, tc := range testCases {140 fmt.Fprintf(out, "=== %s: %s %s (%s)\n",141 conf.prefix,142 relativePackagePath(tc.Package),143 tc.Test,144 FormatDurationAsSeconds(tc.Elapsed, 2))145 for _, line := range execution.OutputLines(tc.Package, tc.Test) {146 if isRunLine(line) || conf.filter(line) {147 continue148 }149 fmt.Fprint(out, line)150 }151 fmt.Fprintln(out)152 }153}154type testCaseFormatConfig struct {155 header string156 prefix string157 filter func(string) bool158 getter func(executionSummary) []TestCase159}160func formatFailed() testCaseFormatConfig {161 withColor := color.RedString162 return testCaseFormatConfig{163 header: withColor("Failed"),164 prefix: withColor("FAIL"),165 filter: func(line string) bool {166 return strings.HasPrefix(line, "--- FAIL: Test")167 },168 getter: func(execution executionSummary) []TestCase {169 return execution.Failed()170 },171 }172}173func formatSkipped() testCaseFormatConfig {174 withColor := color.YellowString175 return testCaseFormatConfig{176 header: withColor("Skipped"),177 prefix: withColor("SKIP"),178 filter: func(line string) bool {179 return strings.HasPrefix(line, "--- SKIP: Test")180 },181 getter: func(execution executionSummary) []TestCase {182 return execution.Skipped()183 },184 }185}186func isRunLine(line string) bool {187 return strings.HasPrefix(line, "=== RUN Test")188}...
String
Using AI Code Generation
1import (2func main() {3 cmd := exec.Command("ls", "-l")4 out, err := cmd.Output()5 if err != nil {6 fmt.Println(err)7 os.Exit(1)8 }9 fmt.Println(string(out))10}11import (12func main() {13 cmd := exec.Command("ls", "-l")14 out, err := cmd.CombinedOutput()15 if err != nil {16 fmt.Println(err)17 os.Exit(1)18 }19 fmt.Println(string(out))20}21import (22func main() {23 cmd := exec.Command("ls", "-l")24 err := cmd.Start()25 if err != nil {26 fmt.Println(err)27 os.Exit(1)28 }
String
Using AI Code Generation
1import (2func main() {3 cmd := exec.Command("ls", "-l")4 out, err := cmd.Output()5 if err != nil {6 fmt.Println(err)7 os.Exit(1)8 }9 fmt.Println(string(out))10}
String
Using AI Code Generation
1import (2func main() {3 cmd := exec.Command("ls", "-l")4 output, err := cmd.Output()5 if err != nil {6 fmt.Println(err.Error())7 os.Exit(1)8 }9 fmt.Println(string(output))10}
String
Using AI Code Generation
1import (2func main() {3 cmd := exec.Command("ls", "-l")4 output, err := cmd.Output()5 if err != nil {6 fmt.Println(err)7 os.Exit(1)8 }9 fmt.Println(string(output))10}11import (12func main() {13 cmd := exec.Command("ls", "-l")14 output, err := cmd.CombinedOutput()15 if err != nil {16 fmt.Println(err)17 os.Exit(1)18 }19 fmt.Println(string(output))20}
String
Using AI Code Generation
1import (2func main() {3 cmd := exec.Command("ls", "-l")4 output, err := cmd.Output()5 if err != nil {6 fmt.Println("Error: ", err)7 os.Exit(1)8 }9 fmt.Println("Output: ", string(output))10}11import (12func main() {13 cmd := exec.Command("ls", "-l")14 output, err := cmd.CombinedOutput()15 if err != nil {16 fmt.Println("Error: ", err)17 os.Exit(1)18 }19 fmt.Println("Output: ", string(output))20}21import (22func main() {23 cmd := exec.Command("ls", "-l")24 output, err := cmd.CombinedOutput()25 if err != nil {26 fmt.Println("Error: ", err)27 os.Exit(1)28 }29 fmt.Println("Output: ", string(output))30}31import (32func main() {33 cmd := exec.Command("ls", "-l")34 output, err := cmd.CombinedOutput()35 if err != nil {36 fmt.Println("Error: ", err)37 os.Exit(1)38 }39 fmt.Println("Output: ", string(output))40}41import (42func main() {43 cmd := exec.Command("ls", "-l")44 output, err := cmd.CombinedOutput()45 if err != nil {46 fmt.Println("Error: ", err)47 os.Exit(1)48 }49 fmt.Println("Output: ", string(output))50}51import (52func main() {53 cmd := exec.Command("ls", "-l")54 output, err := cmd.CombinedOutput()55 if err != nil {56 fmt.Println("Error: ", err)57 os.Exit(1)58 }59 fmt.Println("Output: ", string(output))60}61import (62func main() {63 cmd := exec.Command("ls",
String
Using AI Code Generation
1import "fmt"2func main() {3 fmt.Println("Hello World")4}5import "fmt"6func main() {7 fmt.Println("Hello World")8}9import "fmt"10func main() {11 fmt.Println("Hello World")12}13import "fmt"14func main() {15 fmt.Println("Hello World")16}17import "fmt"18func main() {19 fmt.Println("Hello World")20}21import "fmt"22func main() {23 fmt.Println("Hello World")24}25import "fmt"26func main() {27 fmt.Println("Hello World")28}29import "fmt"30func main() {31 fmt.Println("Hello World")32}33import "fmt"34func main() {35 fmt.Println("Hello World")36}37import "fmt"38func main() {39 fmt.Println("Hello World")40}41import "fmt"42func main() {43 fmt.Println("Hello World")44}45import "fmt"46func main() {47 fmt.Println("Hello World")48}49import "fmt"50func main() {51 fmt.Println("Hello World")52}53import "fmt"54func main() {55 fmt.Println("Hello World")56}
String
Using AI Code Generation
1import (2func main() {3out, err := exec.Command("echo", "hello world").Output()4if err != nil {5fmt.Printf("%s", err)6}7fmt.Println("Command Successfully Executed")8output := string(out[:])9fmt.Println(output)10output = strings.Trim(output, " ")11fmt.Println(output)12}13import (14func main() {15out, err := exec.Command("echo", "hello world").Output()16if err != nil {17fmt.Printf("%s", err)18}19fmt.Println("Command Successfully Executed")20output := string(out[:])21fmt.Println(output)22}23import (24func main() {25out, err := exec.Command("echo", "hello world").Output()26if err != nil {27fmt.Printf("%s", err)28}29fmt.Println("Command Successfully Executed")30output := string(out[:])31fmt.Println(output)32}33import (34func main() {35out, err := exec.Command("echo", "hello world").Output()36if err != nil {37fmt.Printf("%s", err)38}39fmt.Println("Command Successfully Executed")40output := string(out[:])41fmt.Println(output)42}43import (44func main() {45out, err := exec.Command("echo", "hello world").Output()46if err != nil {47fmt.Printf("%s", err)48}49fmt.Println("Command Successfully Executed")50output := string(out[:])51fmt.Println(output)52}53import (54func main() {55out, err := exec.Command("echo", "hello world").Output()56if err != nil {57fmt.Printf("%s", err
String
Using AI Code Generation
1import (2func main() {3 out, err := exec.Command("ls", "-l").Output()4 if err != nil {5 fmt.Println(err)6 }7 fmt.Println(string(out))8}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!