yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/cloudprovider/nat.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 cloudprovider
    16  
    17  import "yunion.io/x/onecloud/pkg/util/billing"
    18  
    19  // These two structures are designed for modifying snat table and dnat table.
    20  // There is a so strange point that they have both field of ExternalIP and ExternalIPID.
    21  // The reason is that you must pass ExternalIPID to modify in Huawei Cloud for now.
    22  // So please construct a valid parameter ExternalIPID instead of ExternalIP in Huawei Cloud.
    23  // A more general approach is to pass both valid parameters.
    24  
    25  type SNatSRule struct {
    26  	SourceCIDR string
    27  	NetworkID  string
    28  
    29  	ExternalIP   string
    30  	ExternalIPID string
    31  }
    32  
    33  type SNatDRule struct {
    34  	Protocol string
    35  
    36  	InternalIP   string
    37  	InternalPort int
    38  
    39  	ExternalIP   string
    40  	ExternalIPID string
    41  	ExternalPort int
    42  }
    43  
    44  type NatGatewayCreateOptions struct {
    45  	Name      string
    46  	VpcId     string
    47  	NetworkId string
    48  	Desc      string
    49  	NatSpec   string
    50  
    51  	BillingCycle *billing.SBillingCycle
    52  }