1// Copyright 2016-2020 The Libsacloud 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 15package sacloud 16 17// IPv6Addr IPアドレス(IPv6) 18type IPv6Addr struct { 19 HostName string `json:",omitempty"` // ホスト名 20 IPv6Addr string `json:",omitempty"` // IPv6アドレス 21 Interface *Interface `json:",omitempty"` // インターフェース 22 IPv6Net *IPv6Net `json:",omitempty"` // IPv6サブネット 23 24} 25 26// GetIPv6NetID IPv6アドレスが所属するIPv6NetのIDを取得 27func (a *IPv6Addr) GetIPv6NetID() ID { 28 if a.IPv6Net != nil { 29 return a.IPv6Net.ID 30 } 31 return 0 32} 33 34// GetInternetID IPv6アドレスを所有するルータ+スイッチ(Internet)のIDを取得 35func (a *IPv6Addr) GetInternetID() ID { 36 if a.IPv6Net != nil && a.IPv6Net.Switch != nil && a.IPv6Net.Switch.Internet != nil { 37 return a.IPv6Net.Switch.Internet.ID 38 } 39 return 0 40} 41 42// CreateNewIPv6Addr IPv6アドレス作成 43func CreateNewIPv6Addr() *IPv6Addr { 44 return &IPv6Addr{ 45 IPv6Net: &IPv6Net{ 46 Resource: &Resource{}, 47 }, 48 } 49} 50