server.go raw
1 // Copyright 2022-2025 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 naked
16
17 import (
18 "time"
19
20 "github.com/sacloud/iaas-api-go/types"
21 )
22
23 // Server サーバ
24 type Server struct {
25 ID types.ID `json:",omitempty" yaml:"id,omitempty" structs:",omitempty"`
26 Name string `json:",omitempty" yaml:"name,omitempty" structs:",omitempty"`
27 Description string `yaml:"description"`
28 Tags types.Tags `yaml:"tags"`
29 Icon *Icon `json:",omitempty" yaml:"icon,omitempty" structs:",omitempty"`
30 CreatedAt *time.Time `json:",omitempty" yaml:"created_at,omitempty" structs:",omitempty"`
31 ModifiedAt *time.Time `json:",omitempty" yaml:"modified_at,omitempty" structs:",omitempty"`
32 Availability types.EAvailability `json:",omitempty" yaml:"availability,omitempty" structs:",omitempty"`
33 HostName string `json:",omitempty" yaml:"host_name,omitempty" structs:",omitempty"`
34 ServiceClass string `json:",omitempty" yaml:"service_class,omitempty" structs:",omitempty"`
35 InterfaceDriver types.EInterfaceDriver `json:",omitempty" yaml:"interface_driver,omitempty" structs:",omitempty"`
36 ServerPlan *ServerPlan `json:",omitempty" yaml:"server_plan,omitempty" structs:",omitempty"`
37 Zone *Zone `json:",omitempty" yaml:"zone,omitempty" structs:",omitempty"`
38 Instance *Instance `json:",omitempty" yaml:"instance,omitempty" structs:",omitempty"`
39 Disks []*Disk `json:",omitempty" yaml:"disks,omitempty" structs:",omitempty"`
40 Interfaces []*Interface `json:",omitempty" yaml:"interfaces,omitempty" structs:",omitempty"`
41 PrivateHost *PrivateHost `json:",omitempty" yaml:"private_host,omitempty" structs:",omitempty"`
42 WaitDiskMigration bool `yaml:"wait_disk_migration"`
43 ConnectedSwitches []*ConnectedSwitch `json:",omitempty" yaml:"connected_switches,omitempty" structs:",omitempty"`
44 }
45
46 // ConnectedSwitch サーバ作成時に指定する接続先スイッチ
47 type ConnectedSwitch struct {
48 ID types.ID `json:",omitempty" yaml:"id,omitempty" structs:",omitempty"`
49 Scope types.EScope `json:",omitempty" yaml:"scope,omitempty" structs:",omitempty"`
50 }
51
52 // MouseRequestButtons マウスボタン
53 type MouseRequestButtons struct {
54 L bool // 左ボタン
55 R bool // 右ボタン
56 M bool // 中ボタン
57 }
58
59 // DeleteServerWithDiskParameter サーバ削除時に接続されているディスクを削除するためのパラメータ
60 type DeleteServerWithDiskParameter struct {
61 WithDisk []types.ID
62 }
63
64 // ServerBootParameter サーバ起動時に指定可能なパラメータ
65 type ServerBootParameter struct {
66 UserBootVariables *ServerBootVariables
67 }
68
69 // ServerBootVariables サーバ起動時に指定可能なパラメータ、現時点ではcloud-initにのみ対応
70 type ServerBootVariables struct {
71 CloudInit *CloudInitParameter
72 }
73
74 // CloudInitParameter cloud-initに渡すUserData
75 //
76 // Note: libsacloudレベルではUserData(cloud-config)は文字列として扱い中身までは関知しない
77 type CloudInitParameter struct {
78 UserData string
79 }
80