62 lines
2.1 KiB
Cheetah
62 lines
2.1 KiB
Cheetah
|
// +-------------------------------------------------------------------------
|
||
|
// | 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}}
|
||
|
|
||
|
package service
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"time"
|
||
|
|
||
|
"github.com/yunify/qingstor-sdk-go/config"
|
||
|
"github.com/yunify/qingstor-sdk-go/request"
|
||
|
"github.com/yunify/qingstor-sdk-go/request/data"
|
||
|
"github.com/yunify/qingstor-sdk-go/request/errors"
|
||
|
)
|
||
|
|
||
|
var _ fmt.State
|
||
|
var _ io.Reader
|
||
|
var _ time.Time
|
||
|
var _ config.Config
|
||
|
|
||
|
{{if ne $subService.Name "Object"}}
|
||
|
// {{$subService.ID | camelCase}} presents {{$subService.ID | snakeCase}}.
|
||
|
type {{$subService.ID | camelCase}} struct {
|
||
|
Config *config.Config
|
||
|
Properties *Properties
|
||
|
}
|
||
|
|
||
|
// {{$subService.ID | camelCase}} initializes a new {{$subService.ID | snakeCase}}.
|
||
|
func (s *Service) {{$subService.ID | camelCase}}(
|
||
|
{{- template "SubServiceInitParams" passThrough $subService.Properties true -}}
|
||
|
) (*{{$subService.ID | camelCase}}, error) {
|
||
|
properties := &Properties{
|
||
|
{{range $_, $property := $subService.Properties.Properties -}}
|
||
|
{{$property.ID | upperFirst}}: &{{$property.ID}},
|
||
|
{{end -}}
|
||
|
}
|
||
|
|
||
|
return &{{$subService.ID | camelCase}}{Config: s.Config, Properties: properties}, nil
|
||
|
}
|
||
|
{{end}}
|
||
|
|
||
|
{{range $_, $operation := $subService.Operations}}
|
||
|
{{template "RenderOperation" passThrough $subService $operation}}
|
||
|
{{end}}
|