github.com/sacloud/libsacloud/v2@v2.32.3/helper/service/mobilegateway/create_request.go (about) 1 // Copyright 2016-2022 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 15 package mobilegateway 16 17 import ( 18 "github.com/sacloud/libsacloud/v2/helper/validate" 19 "github.com/sacloud/libsacloud/v2/sacloud" 20 "github.com/sacloud/libsacloud/v2/sacloud/types" 21 ) 22 23 type CreateRequest struct { 24 Zone string `validate:"required"` 25 26 Name string `validate:"required"` 27 Description string `validate:"min=0,max=512"` 28 Tags types.Tags 29 IconID types.ID 30 PrivateInterface *PrivateInterfaceSetting `validate:"omitempty"` 31 StaticRoutes []*sacloud.MobileGatewayStaticRoute 32 SIMRoutes []*SIMRouteSetting 33 InternetConnectionEnabled bool 34 InterDeviceCommunicationEnabled bool 35 DNS *DNSSetting 36 SIMs []*SIMSetting 37 TrafficConfig *TrafficConfig 38 39 NoWait bool 40 BootAfterCreate bool 41 } 42 43 func (req *CreateRequest) Validate() error { 44 return validate.Struct(req) 45 } 46 47 func (req *CreateRequest) ApplyRequest() *ApplyRequest { 48 return &ApplyRequest{ 49 Zone: req.Zone, 50 Name: req.Name, 51 Description: req.Description, 52 Tags: req.Tags, 53 IconID: req.IconID, 54 PrivateInterface: req.PrivateInterface, 55 StaticRoutes: req.StaticRoutes, 56 SIMRoutes: req.SIMRoutes, 57 InternetConnectionEnabled: req.InternetConnectionEnabled, 58 InterDeviceCommunicationEnabled: req.InterDeviceCommunicationEnabled, 59 DNS: req.DNS, 60 SIMs: req.SIMs, 61 TrafficConfig: req.TrafficConfig, 62 NoWait: req.NoWait, 63 BootAfterCreate: req.BootAfterCreate, 64 } 65 }