github.com/sacloud/iaas-api-go@v1.12.0/types/nfs_size.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  import "fmt"
    18  
    19  // ENFSSize NFSサイズ
    20  type ENFSSize int
    21  
    22  func (s ENFSSize) Int() int {
    23  	return int(s)
    24  }
    25  
    26  func (s ENFSSize) Int64() int64 {
    27  	return int64(s)
    28  }
    29  
    30  func (s ENFSSize) String() string {
    31  	return fmt.Sprintf("%d", s.Int())
    32  }
    33  
    34  // NFSHDDSizes NFSのHDDプランで指定可能なサイズ
    35  var NFSHDDSizes = struct {
    36  	Size100GB ENFSSize
    37  	Size500GB ENFSSize
    38  	Size1TB   ENFSSize
    39  	Size2TB   ENFSSize
    40  	Size4TB   ENFSSize
    41  	Size8TB   ENFSSize
    42  	Size12TB  ENFSSize
    43  }{
    44  	Size100GB: ENFSSize(100),
    45  	Size500GB: ENFSSize(500),
    46  	Size1TB:   ENFSSize(1024 * 1),
    47  	Size2TB:   ENFSSize(1024 * 2),
    48  	Size4TB:   ENFSSize(1024 * 4),
    49  	Size8TB:   ENFSSize(1024 * 8),
    50  	Size12TB:  ENFSSize(1024 * 12),
    51  }
    52  
    53  // NFSSSDSizes NFSのSSDプランで指定可能なサイズ
    54  var NFSSSDSizes = struct {
    55  	Size20GB  ENFSSize
    56  	Size100GB ENFSSize
    57  	Size500GB ENFSSize
    58  	Size1TB   ENFSSize
    59  	Size2TB   ENFSSize
    60  	Size4TB   ENFSSize
    61  }{
    62  	Size20GB:  ENFSSize(20),
    63  	Size100GB: ENFSSize(100),
    64  	Size500GB: ENFSSize(500),
    65  	Size1TB:   ENFSSize(1024 * 1),
    66  	Size2TB:   ENFSSize(1024 * 2),
    67  	Size4TB:   ENFSSize(1024 * 4),
    68  }
    69  
    70  // NFSIntSizes NFSで使用可能なサイズの一覧
    71  var NFSIntSizes = []int{
    72  	int(NFSHDDSizes.Size100GB),
    73  	int(NFSHDDSizes.Size500GB),
    74  	int(NFSHDDSizes.Size1TB),
    75  	int(NFSHDDSizes.Size2TB),
    76  	int(NFSHDDSizes.Size4TB),
    77  	int(NFSHDDSizes.Size8TB),
    78  	int(NFSHDDSizes.Size12TB),
    79  }