github.com/sacloud/iaas-api-go@v1.12.0/internal/define/ipv6net.go (about)

     1  // Copyright 2022-2023 The sacloud/iaas-api-go 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 define
    16  
    17  import (
    18  	"github.com/sacloud/iaas-api-go/internal/define/ops"
    19  	"github.com/sacloud/iaas-api-go/internal/dsl"
    20  	"github.com/sacloud/iaas-api-go/internal/dsl/meta"
    21  	"github.com/sacloud/iaas-api-go/naked"
    22  )
    23  
    24  const (
    25  	ipv6netAPIName     = "IPv6Net"
    26  	ipv6netAPIPathName = "ipv6net"
    27  )
    28  
    29  var ipv6netAPI = &dsl.Resource{
    30  	Name:       ipv6netAPIName,
    31  	PathName:   ipv6netAPIPathName,
    32  	PathSuffix: dsl.CloudAPISuffix,
    33  	Operations: dsl.Operations{
    34  		// list Note: Findのパラメータなしと同等だが、後方互換のために残しておく
    35  		ops.List(ipv6netAPIName, ipv6netNakedType, ipv6netView),
    36  
    37  		// find
    38  		ops.Find(ipv6netAPIName, ipv6netNakedType, findParameter, ipv6netView),
    39  
    40  		// read
    41  		ops.Read(ipv6netAPIName, ipv6netNakedType, ipv6netView),
    42  	},
    43  }
    44  var (
    45  	ipv6netNakedType = meta.Static(naked.IPv6Net{})
    46  
    47  	ipv6netView = &dsl.Model{
    48  		Name:      ipv6netAPIName,
    49  		NakedType: ipv6netNakedType,
    50  		Fields: []*dsl.FieldDesc{
    51  			fields.ID(),
    52  			fields.Def("ServiceID", meta.TypeID),
    53  			fields.Def("IPv6Prefix", meta.TypeString),
    54  			fields.Def("IPv6PrefixLen", meta.TypeInt),
    55  			fields.Def("IPv6PrefixTail", meta.TypeString),
    56  			fields.Def("ServiceClass", meta.TypeString),
    57  			fields.Def("IPv6TableID", meta.TypeID, mapConvTag("IPv6Table.ID")),
    58  			fields.Def("NamedIPv6AddrCount", meta.TypeInt),
    59  			fields.CreatedAt(),
    60  			fields.SwitchID(),
    61  		},
    62  	}
    63  )