...

Source file src/github.com/chaos-mesh/chaos-mesh/pkg/ctrl/server/model/models_gen.go

Documentation: github.com/chaos-mesh/chaos-mesh/pkg/ctrl/server/model

     1  // Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
     2  
     3  package model
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  	"strconv"
     9  
    10  	v1 "k8s.io/api/core/v1"
    11  
    12  	"github.com/chaos-mesh/chaos-mesh/api/v1alpha1"
    13  )
    14  
    15  type Cgroups struct {
    16  	Raw    string         `json:"raw"`
    17  	CPU    *CgroupsCPU    `json:"cpu"`
    18  	Memory *CgroupsMemory `json:"memory"`
    19  }
    20  
    21  type CgroupsCPU struct {
    22  	Quota  int `json:"quota"`
    23  	Period int `json:"period"`
    24  }
    25  
    26  type CgroupsMemory struct {
    27  	Limit int64 `json:"limit"`
    28  }
    29  
    30  type Fd struct {
    31  	Fd     string `json:"fd"`
    32  	Target string `json:"target"`
    33  }
    34  
    35  type KillProcessResult struct {
    36  	Pid     string `json:"pid"`
    37  	Command string `json:"command"`
    38  }
    39  
    40  type MutablePod struct {
    41  	Pod           *v1.Pod              `json:"pod"`
    42  	KillProcesses []*KillProcessResult `json:"killProcesses"`
    43  	CleanTcs      []string             `json:"cleanTcs"`
    44  	CleanIptables []string             `json:"cleanIptables"`
    45  }
    46  
    47  type Namespace struct {
    48  	Ns              string                      `json:"ns"`
    49  	Component       []*v1.Pod                   `json:"component"`
    50  	Pod             []*v1.Pod                   `json:"pod"`
    51  	Stresschaos     []*v1alpha1.StressChaos     `json:"stresschaos"`
    52  	Iochaos         []*v1alpha1.IOChaos         `json:"iochaos"`
    53  	Podiochaos      []*v1alpha1.PodIOChaos      `json:"podiochaos"`
    54  	Httpchaos       []*v1alpha1.HTTPChaos       `json:"httpchaos"`
    55  	Podhttpchaos    []*v1alpha1.PodHttpChaos    `json:"podhttpchaos"`
    56  	Networkchaos    []*v1alpha1.NetworkChaos    `json:"networkchaos"`
    57  	Podnetworkchaos []*v1alpha1.PodNetworkChaos `json:"podnetworkchaos"`
    58  }
    59  
    60  type PodSelectorInput struct {
    61  	Namespaces          []string               `json:"namespaces"`
    62  	Nodes               []string               `json:"nodes"`
    63  	Pods                map[string]interface{} `json:"pods"`
    64  	NodeSelectors       map[string]interface{} `json:"nodeSelectors"`
    65  	FieldSelectors      map[string]interface{} `json:"fieldSelectors"`
    66  	LabelSelectors      map[string]interface{} `json:"labelSelectors"`
    67  	AnnotationSelectors map[string]interface{} `json:"annotationSelectors"`
    68  	PodPhaseSelectors   []string               `json:"podPhaseSelectors"`
    69  }
    70  
    71  type PodStressChaos struct {
    72  	StressChaos   *v1alpha1.StressChaos `json:"stressChaos"`
    73  	Pod           *v1.Pod               `json:"pod"`
    74  	Cgroups       *Cgroups              `json:"cgroups"`
    75  	ProcessStress []*ProcessStress      `json:"processStress"`
    76  }
    77  
    78  type Process struct {
    79  	Pod     *v1.Pod `json:"pod"`
    80  	Pid     string  `json:"pid"`
    81  	Command string  `json:"command"`
    82  	Fds     []*Fd   `json:"fds"`
    83  }
    84  
    85  type ProcessStress struct {
    86  	Process *Process `json:"process"`
    87  	Cgroup  string   `json:"cgroup"`
    88  }
    89  
    90  type Component string
    91  
    92  const (
    93  	ComponentManager   Component = "MANAGER"
    94  	ComponentDaemon    Component = "DAEMON"
    95  	ComponentDashboard Component = "DASHBOARD"
    96  	ComponentDNSServer Component = "DNSSERVER"
    97  )
    98  
    99  var AllComponent = []Component{
   100  	ComponentManager,
   101  	ComponentDaemon,
   102  	ComponentDashboard,
   103  	ComponentDNSServer,
   104  }
   105  
   106  func (e Component) IsValid() bool {
   107  	switch e {
   108  	case ComponentManager, ComponentDaemon, ComponentDashboard, ComponentDNSServer:
   109  		return true
   110  	}
   111  	return false
   112  }
   113  
   114  func (e Component) String() string {
   115  	return string(e)
   116  }
   117  
   118  func (e *Component) UnmarshalGQL(v interface{}) error {
   119  	str, ok := v.(string)
   120  	if !ok {
   121  		return fmt.Errorf("enums must be strings")
   122  	}
   123  
   124  	*e = Component(str)
   125  	if !e.IsValid() {
   126  		return fmt.Errorf("%s is not a valid Component", str)
   127  	}
   128  	return nil
   129  }
   130  
   131  func (e Component) MarshalGQL(w io.Writer) {
   132  	fmt.Fprint(w, strconv.Quote(e.String()))
   133  }
   134