2016-12-03 09:42:26 +00:00
|
|
|
// +-------------------------------------------------------------------------
|
|
|
|
// | Copyright (C) 2016 Yunify, Inc.
|
|
|
|
// +-------------------------------------------------------------------------
|
|
|
|
// | Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// | you may not use this work except in compliance with the License.
|
|
|
|
// | You may obtain a copy of the License in the LICENSE file, or at:
|
|
|
|
// |
|
|
|
|
// | http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
// |
|
|
|
|
// | Unless required by applicable law or agreed to in writing, software
|
|
|
|
// | distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// | See the License for the specific language governing permissions and
|
|
|
|
// | limitations under the License.
|
|
|
|
// +-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
{{$service := .Data.Service}}
|
|
|
|
{{$subService := index .Data.SubServices .CurrentSubServiceID}}
|
|
|
|
|
2016-12-08 13:02:38 +00:00
|
|
|
package service
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/yunify/qingcloud-sdk-go/config"
|
|
|
|
"github.com/yunify/qingcloud-sdk-go/request"
|
|
|
|
"github.com/yunify/qingcloud-sdk-go/request/data"
|
2017-01-05 14:03:55 +00:00
|
|
|
"github.com/yunify/qingcloud-sdk-go/request/errors"
|
2016-12-03 09:42:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ fmt.State
|
|
|
|
var _ time.Time
|
|
|
|
|
|
|
|
type {{$subService.ID | camelCase}}Service struct {
|
|
|
|
Config *config.Config
|
|
|
|
Properties *{{$subService.ID | camelCase}}ServiceProperties
|
|
|
|
}
|
|
|
|
|
|
|
|
type {{$subService.ID | camelCase}}ServiceProperties struct {
|
|
|
|
{{template "RenderProperties" passThrough $service.Properties "" -}}
|
|
|
|
|
|
|
|
{{template "RenderProperties" passThrough $subService.Properties "" -}}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *{{$service.Name | camelCase}}Service) {{$subService.ID | camelCase}}(
|
2017-01-05 14:03:55 +00:00
|
|
|
{{- template "SubServiceInitParams" passThrough $subService.Properties true -}}
|
2016-12-03 09:42:26 +00:00
|
|
|
) (*{{$subService.ID | camelCase}}Service, error) {
|
|
|
|
properties := &{{$subService.ID | camelCase}}ServiceProperties{
|
|
|
|
{{range $_, $property := $subService.Properties.Properties -}}
|
2017-01-05 14:03:55 +00:00
|
|
|
{{$property.ID | upperFirst}}: &{{$property.ID}},
|
2016-12-03 09:42:26 +00:00
|
|
|
{{end}}
|
|
|
|
}
|
|
|
|
|
|
|
|
return &{{$subService.ID | camelCase}}Service{Config: s.Config, Properties: properties}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
{{range $_, $operation := $subService.Operations}}
|
|
|
|
{{$belongs := printf "%sService" ($subService.Name | camelCase)}}
|
|
|
|
{{template "RenderOperation" passThrough $belongs $operation}}
|
|
|
|
{{end}}
|