github.com/sacloud/libsacloud/v2@v2.32.3/helper/service/certificateauthority/apply_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 certificateauthority 16 17 import ( 18 "time" 19 20 "github.com/sacloud/libsacloud/v2/helper/validate" 21 "github.com/sacloud/libsacloud/v2/sacloud" 22 "github.com/sacloud/libsacloud/v2/sacloud/types" 23 ) 24 25 type ApplyRequest struct { 26 ID types.ID `request:"-"` 27 28 Name string `validate:"required"` 29 Description string `validate:"min=0,max=512"` 30 Tags types.Tags 31 IconID types.ID 32 33 Country string 34 Organization string 35 OrganizationUnit []string 36 CommonName string 37 NotAfter time.Time 38 39 Clients []*ClientCert // Note: API的に証明書の削除はできないため、指定した以上の証明書が存在する可能性がある 40 Servers []*ServerCert // Note: API的に証明書の削除はできないため、指定した以上の証明書が存在する可能性がある 41 42 PollingTimeout time.Duration // 証明書発行待ちのタイムアウト 43 PollingInterval time.Duration // 証明書発行待ちのポーリング間隔 44 } 45 46 func (req *ApplyRequest) Validate() error { 47 return validate.Struct(req) 48 } 49 50 func (req *ApplyRequest) Builder(caller sacloud.APICaller) (*Builder, error) { 51 return &Builder{ 52 ID: req.ID, 53 Name: req.Name, 54 Description: req.Description, 55 Tags: req.Tags, 56 IconID: req.IconID, 57 Country: req.Country, 58 Organization: req.Organization, 59 OrganizationUnit: req.OrganizationUnit, 60 CommonName: req.CommonName, 61 NotAfter: req.NotAfter, 62 Clients: req.Clients, 63 Servers: req.Servers, 64 Client: sacloud.NewCertificateAuthorityOp(caller), 65 PollingTimeout: req.PollingTimeout, 66 PollingInterval: req.PollingInterval, 67 }, nil 68 }