github.com/sacloud/iaas-api-go@v1.12.0/types/database_plan.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  // DatabasePlans データベースプラン
    18  var DatabasePlans = struct {
    19  	// DB10GB 10GB
    20  	DB10GB ID
    21  	// DB30GB 30GB
    22  	DB30GB ID
    23  	// DB90GB 90GB
    24  	DB90GB ID
    25  	// DB240GB 240GB
    26  	DB240GB ID
    27  	// DB500GB 500GB
    28  	DB500GB ID
    29  	// DB1TB 1TB
    30  	DB1TB ID
    31  }{
    32  	DB10GB:  ID(10),
    33  	DB30GB:  ID(30),
    34  	DB90GB:  ID(90),
    35  	DB240GB: ID(240),
    36  	DB500GB: ID(500),
    37  	DB1TB:   ID(1000),
    38  }
    39  
    40  // SlaveDatabasePlanID マスター側のプランIDからスレーブのプランIDを算出
    41  func SlaveDatabasePlanID(masterPlanID ID) ID {
    42  	return ID(int64(masterPlanID) + 1)
    43  }
    44  
    45  // DatabasePlanIDs データベースプランのID
    46  var DatabasePlanIDs = []ID{
    47  	DatabasePlans.DB10GB,
    48  	DatabasePlans.DB30GB,
    49  	DatabasePlans.DB90GB,
    50  	DatabasePlans.DB240GB,
    51  	DatabasePlans.DB500GB,
    52  	DatabasePlans.DB1TB,
    53  }
    54  
    55  // DatabasePlanStrings データベースプランを示す文字列
    56  var DatabasePlanStrings = []string{"10g", "30g", "90g", "240g", "500g", "1t"}
    57  
    58  // DatabasePlanIDMap 文字列とデータベースプランのマップ、キーはDatabasePlanStringsから参照すること
    59  var DatabasePlanIDMap = map[string]ID{
    60  	"10g":  DatabasePlans.DB10GB,
    61  	"30g":  DatabasePlans.DB30GB,
    62  	"90g":  DatabasePlans.DB90GB,
    63  	"240g": DatabasePlans.DB240GB,
    64  	"500g": DatabasePlans.DB500GB,
    65  	"1t":   DatabasePlans.DB1TB,
    66  }
    67  
    68  // DatabasePlanNameMap プランIDと名称のマップ
    69  var DatabasePlanNameMap = map[ID]string{
    70  	DatabasePlans.DB10GB:  "10g",
    71  	DatabasePlans.DB30GB:  "30g",
    72  	DatabasePlans.DB90GB:  "90g",
    73  	DatabasePlans.DB240GB: "240g",
    74  	DatabasePlans.DB500GB: "500g",
    75  	DatabasePlans.DB1TB:   "1t",
    76  }