yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/ecloud/instancenic.go (about)

     1  // Copyright 2019 Yunion
     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 ecloud
    16  
    17  import (
    18  	"time"
    19  
    20  	"yunion.io/x/cloudmux/pkg/cloudprovider"
    21  )
    22  
    23  type SInstanceNic struct {
    24  	cloudprovider.DummyICloudNic
    25  	SInstanceNicDetail
    26  
    27  	instance *SInstance
    28  
    29  	Id               string
    30  	PrivateIp        string
    31  	FipAddress       string
    32  	FipBandwidthSize int
    33  	PortId           string
    34  	PortName         string
    35  	FixedIpDetails   []SFixedIpDetail
    36  	RouterId         string
    37  }
    38  
    39  type SInstanceNicDetail struct {
    40  	MacAddress     string
    41  	SecurityGroups []SSecurityGroupRef
    42  	Status         int
    43  	ResourceId     string
    44  	CreaetTime     time.Time
    45  	PublicIp       string
    46  	IpId           string
    47  	NetworkId      string
    48  }
    49  
    50  type SSecurityGroupRef struct {
    51  	Id   string
    52  	Name string
    53  }
    54  
    55  type SFixedIpDetail struct {
    56  	IpAddress     string
    57  	IpVersion     string
    58  	PublicIp      string
    59  	BandWidthSize int
    60  	BandWidthType string
    61  	SubnetId      string
    62  	SubnetName    string
    63  }
    64  
    65  func (in *SInstanceNic) GetIP() string {
    66  	return in.PrivateIp
    67  }
    68  
    69  func (in *SInstanceNic) GetMAC() string {
    70  	return in.MacAddress
    71  }
    72  
    73  func (in *SInstanceNic) GetId() string {
    74  	return in.PortId
    75  }
    76  
    77  func (in *SInstanceNic) GetDriver() string {
    78  	return "virtio"
    79  }
    80  
    81  func (in *SInstanceNic) InClassicNetwork() bool {
    82  	return false
    83  }
    84  
    85  func (in *SInstanceNic) GetINetworkId() string {
    86  	return in.NetworkId
    87  }