podman

Форк
0
56 строк · 1.5 Кб
1
// Copyright 2015 go-swagger maintainers
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 spec
16

17
import (
18
	"encoding/json"
19

20
	"github.com/go-openapi/swag"
21
)
22

23
// License information for the exposed API.
24
//
25
// For more information: http://goo.gl/8us55a#licenseObject
26
type License struct {
27
	LicenseProps
28
	VendorExtensible
29
}
30

31
// LicenseProps holds the properties of a License object
32
type LicenseProps struct {
33
	Name string `json:"name,omitempty"`
34
	URL  string `json:"url,omitempty"`
35
}
36

37
// UnmarshalJSON hydrates License from json
38
func (l *License) UnmarshalJSON(data []byte) error {
39
	if err := json.Unmarshal(data, &l.LicenseProps); err != nil {
40
		return err
41
	}
42
	return json.Unmarshal(data, &l.VendorExtensible)
43
}
44

45
// MarshalJSON produces License as json
46
func (l License) MarshalJSON() ([]byte, error) {
47
	b1, err := json.Marshal(l.LicenseProps)
48
	if err != nil {
49
		return nil, err
50
	}
51
	b2, err := json.Marshal(l.VendorExtensible)
52
	if err != nil {
53
		return nil, err
54
	}
55
	return swag.ConcatJSON(b1, b2), nil
56
}
57

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.