mirror of
https://github.com/rclone/rclone.git
synced 2024-12-04 22:34:48 +01:00
71 lines
2.5 KiB
Cheetah
71 lines
2.5 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"
|
|
"net/http"
|
|
"strings"
|
|
"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 _ http.Header
|
|
var _ strings.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) {
|
|
{{- range $_, $property := $subService.Properties.Properties -}}
|
|
{{if eq $property.ID "zone"}}
|
|
{{$property.ID}} = strings.ToLower({{$property.ID}})
|
|
{{end}}
|
|
{{- end -}}
|
|
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}}
|