github.com/sacloud/iaas-api-go@v1.12.0/types/instance_status.go (about)

     1  // Copyright 2022-2023 The sacloud/iaas-api-go 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  package types
    16  
    17  // EServerInstanceStatus サーバーインスタンスステータス
    18  type EServerInstanceStatus string
    19  
    20  // ServerInstanceStatuses サーバーインスタンスステータス
    21  var ServerInstanceStatuses = &struct {
    22  	Unknown  EServerInstanceStatus
    23  	Up       EServerInstanceStatus
    24  	Cleaning EServerInstanceStatus
    25  	Down     EServerInstanceStatus
    26  }{
    27  	Unknown:  EServerInstanceStatus(""),
    28  	Up:       EServerInstanceStatus("up"),
    29  	Cleaning: EServerInstanceStatus("cleaning"),
    30  	Down:     EServerInstanceStatus("down"),
    31  }
    32  
    33  // IsUp インスタンスが起動しているか判定
    34  func (e EServerInstanceStatus) IsUp() bool {
    35  	return e == ServerInstanceStatuses.Up
    36  }
    37  
    38  // IsDown インスタンスがダウンしているか確認
    39  func (e EServerInstanceStatus) IsDown() bool {
    40  	return e == ServerInstanceStatuses.Down
    41  }