...

Source file src/github.com/chaos-mesh/chaos-mesh/pkg/dashboard/apiserver/types/types.go

Documentation: github.com/chaos-mesh/chaos-mesh/pkg/dashboard/apiserver/types

     1  // Copyright 2022 Chaos Mesh Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  // http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  
    16  package types
    17  
    18  import (
    19  	"github.com/chaos-mesh/chaos-mesh/api/v1alpha1"
    20  	"github.com/chaos-mesh/chaos-mesh/pkg/dashboard/core"
    21  	"github.com/chaos-mesh/chaos-mesh/pkg/status"
    22  )
    23  
    24  // Archive defines the basic information of an archive.
    25  type Archive = core.ObjectBase
    26  
    27  /*
    28  ArchiveDetail represents an archive instance.
    29  
    30  It inherits `Archive` and adds complete definition of an experiment.
    31  */
    32  type ArchiveDetail struct {
    33  	Archive
    34  	KubeObject core.KubeObjectDesc `json:"kube_object"`
    35  }
    36  
    37  // Experiment defines the basic information of an experiment.
    38  type Experiment struct {
    39  	core.ObjectBase
    40  	Status        status.ChaosStatus `json:"status"`
    41  	FailedMessage string             `json:"failed_message,omitempty"`
    42  }
    43  
    44  /*
    45  ExperimentDetail represents an experiment instance.
    46  
    47  It inherits `Experiment` and adds complete definition of an experiment.
    48  */
    49  type ExperimentDetail struct {
    50  	Experiment
    51  	KubeObject core.KubeObjectDesc `json:"kube_object"`
    52  }
    53  
    54  // PhysicalMachine defines the basic information of a physical machine.
    55  type PhysicalMachine struct {
    56  	Name      string `json:"name"`
    57  	Namespace string `json:"namespace"`
    58  	Address   string `json:"address"`
    59  }
    60  
    61  // Pod defines the basic information of a pod.
    62  type Pod struct {
    63  	IP        string `json:"ip"`
    64  	Name      string `json:"name"`
    65  	Namespace string `json:"namespace"`
    66  	State     string `json:"state"`
    67  }
    68  
    69  // Schedule defines the basic information of a schedule.
    70  type Schedule struct {
    71  	core.ObjectBase
    72  	Status status.ScheduleStatus `json:"status"`
    73  }
    74  
    75  /*
    76  ScheduleDetail represents an archive instance.
    77  
    78  It inherits `Schedule` and adds complete definition of a schedule.
    79  */
    80  type ScheduleDetail struct {
    81  	Schedule
    82  	ExperimentUIDs []string            `json:"experiment_uids"`
    83  	KubeObject     core.KubeObjectDesc `json:"kube_object"`
    84  }
    85  
    86  type StatusCheckTemplateBase struct {
    87  	Namespace   string `json:"namespace"`
    88  	Name        string `json:"name"`
    89  	UID         string `json:"uid"`
    90  	Description string `json:"description,omitempty"`
    91  	Created     string `json:"created_at"`
    92  }
    93  
    94  /*
    95  StatusCheckTemplateDetail represents an archive instance.
    96  
    97  It inherits `StatusCheckTemplateBase` and adds complete definition of a Status Check template.
    98  */
    99  type StatusCheckTemplateDetail struct {
   100  	StatusCheckTemplateBase `json:",inline,omitempty"`
   101  	Spec                    v1alpha1.StatusCheckTemplate `json:"spec"`
   102  }
   103  
   104  type StatusCheckTemplate struct {
   105  	Namespace   string                       `json:"namespace"`
   106  	Name        string                       `json:"name"`
   107  	Description string                       `json:"description,omitempty"`
   108  	Spec        v1alpha1.StatusCheckTemplate `json:"spec"`
   109  }
   110