gslb.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 // GSLB GSLB
24 type GSLB 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 ServiceClass string `json:",omitempty" yaml:"service_class,omitempty" structs:",omitempty"`
34 Provider *Provider `json:",omitempty" yaml:"provider,omitempty" structs:",omitempty"`
35 Settings *GSLBSettings `json:",omitempty" yaml:"settings,omitempty" structs:",omitempty"`
36 SettingsHash string `json:",omitempty" yaml:"settings_hash,omitempty" structs:",omitempty"`
37 Status *GSLBStatus `json:",omitempty" yaml:"status,omitempty" structs:",omitempty"`
38 }
39
40 // GSLBSettingsUpdate GSLB
41 type GSLBSettingsUpdate struct {
42 Settings *GSLBSettings `json:",omitempty" yaml:"settings,omitempty" structs:",omitempty"`
43 SettingsHash string `json:",omitempty" yaml:"settings_hash,omitempty" structs:",omitempty"`
44 }
45
46 // GSLBSettings GSLBの設定
47 type GSLBSettings struct {
48 GSLB *GSLBSetting `json:",omitempty" yaml:"gslb,omitempty" structs:",omitempty"`
49 }
50
51 // GSLBSetting GSLBの設定
52 type GSLBSetting struct {
53 DelayLoop int `json:",omitempty" yaml:"delay_loop,omitempty" structs:",omitempty"`
54 HealthCheck *GSLBHealthCheck `json:",omitempty" yaml:"health_check,omitempty" structs:",omitempty"`
55 Weighted types.StringFlag `yaml:"weighted"`
56 Servers []*GSLBServer `yaml:"servers"`
57 SorryServer string `json:",omitempty" yaml:",omitempty" structs:",omitempty"` // ソーリーサーバー
58 MonitoringSuiteLog *MonitoringSuiteLogString `json:",omitempty" yaml:"monitoring_suite_log,omitempty" structs:",omitempty"`
59 }
60
61 // GSLBHealthCheck ヘルスチェック
62 type GSLBHealthCheck struct {
63 Protocol types.Protocol `json:",omitempty" yaml:"protocol,omitempty" structs:""` // プロトコル
64 Host string `json:",omitempty" yaml:"host,omitempty" structs:""` // 対象ホスト
65 Path string `json:",omitempty" yaml:"path,omitempty" structs:""` // HTTP/HTTPSの場合のリクエストパス
66 Status types.StringNumber `json:",omitempty" yaml:"status,omitempty" structs:""` // 期待するステータスコード
67 Port types.StringNumber `json:",omitempty" yaml:"port,omitempty" structs:""` // ポート番号
68 }
69
70 // GSLBServer GSLB配下のサーバー
71 type GSLBServer struct {
72 IPAddress string `json:",omitempty" yaml:"ip_address,omitempty" structs:",omitempty"` // IPアドレス
73 Enabled types.StringFlag `yaml:"enabled" ` // 有効/無効
74 Weight types.StringNumber `json:",omitempty" yaml:"weight,omitempty" structs:",omitempty"` // ウェイト
75 }
76
77 // GSLBStatus GSLBステータス
78 type GSLBStatus struct {
79 FQDN string `json:",omitempty" yaml:"fqdn,omitempty" structs:",omitempty"`
80 }
81