mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-29 13:57:33 +02:00
exec dep ensure
Signed-off-by: Steven Zou <szou@vmware.com>
This commit is contained in:
parent
8e734407c0
commit
c6a509b3dd
56
src/vendor/github.com/goharbor/harbor/AUTHORS
generated
vendored
56
src/vendor/github.com/goharbor/harbor/AUTHORS
generated
vendored
@ -1,56 +0,0 @@
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
|
||||
Alexander Zeitler <alexander.zeitler at pdmlab.com>
|
||||
Alexey Erkak <eryigin at mail.ru>
|
||||
Allen Heavey <xheavey at gmail.com>
|
||||
Amanda Zhang <amzhang at vmware.com>
|
||||
Andre Cruz <andre at brpx.com>
|
||||
Aron Parsons <aron at knackworks.com>
|
||||
Benniu Ji <benniuji at gmail.com>
|
||||
Bin Liu <liubin0329 at gmail.com>
|
||||
BhEaN <bhean at vandalsweb.com>
|
||||
Bobby Zhang <junzhang at vmware.com>
|
||||
Brian Christner <brian.christner at gmail.com>
|
||||
Chaofeng Wu <chaofengw at vmware.com>
|
||||
Casey Peel < >
|
||||
Daniel Jiang <jiangd at vmware.com>
|
||||
Deshi Xiao <xiaods at gmail.com>
|
||||
Dmitry Lazurkin <dilaz03 at gmail.com>
|
||||
Fangyuan Li <maplainfly at gmail.com>
|
||||
Feileng Cui <feilengcui008 at gmail.com>
|
||||
Fuhui Peng <srqh1120 at sina.com>
|
||||
Guangping Fu <krystism at gmail.com>
|
||||
Haining Henry Zhang <henryzhang at vmware.com>
|
||||
Hao Xia <haox at vmware.com>
|
||||
Haoyuan <harryge00 at gmail.com>
|
||||
Jack Liu <ljack at vmware.com>
|
||||
Jessy Zhang <jessyz at vmware.com>
|
||||
Jianye Li <li.jianye at gmail.com>
|
||||
Kira <me at imkira.com>
|
||||
Kun Wang <kunw at vmware.com>
|
||||
Mahesh Paolini-Subramanya <mahesh at dieswaytoofast.com>
|
||||
Maxwell <710028463 at qq.com>
|
||||
Meng Wei <weim at vmware.com>
|
||||
Mizukoshi Masataka <m.mizukoshi.wakuwaku at gmail.com>
|
||||
Nagarjun G <nagarjung.g at gmail.com>
|
||||
Peng Zhao <zhaopeng1988 at gmail.com>
|
||||
Penghao Cen <scorpiocph at gmail.com>
|
||||
Phillip Gomez <gomez.phillip at gmail.com>
|
||||
Robin Naundorf <r.naundorf at fh-muenster.de>
|
||||
Samuel Archambault <sarchambault at lapresse.ca>
|
||||
Shan Zhu <zhus at vmware.com>
|
||||
Steven Zou <szou at vmware.com>
|
||||
Ricardo Katz <rikatz at users.noreply.github.com>
|
||||
Robin Yue <jmyue at hotmail.com>
|
||||
Tim Chen Xiaoyu <837829664 at qq.com>
|
||||
Tobe Chen <tobeg3oogle at gmail.com>
|
||||
Victoria Zheng <vzheng at vmware.com>
|
||||
Wenkai Yin <yinw at vmware.com>
|
||||
Xiaoxiao Zhou <xiaoxiaoz at vmware.com>
|
||||
Xinkun Xu <xuxinkun at gmail.com>
|
||||
Yahao He <bhe at vmware.com>
|
||||
Yan Wang <wangyan at vmware.com>
|
||||
Yixing Jia <yixingj at vmware.com>
|
||||
Yong Hua <yhua at vmware.com>
|
||||
Yufei Ma <myufei at vmware.com>
|
||||
|
210
src/vendor/github.com/goharbor/harbor/LICENSE
generated
vendored
210
src/vendor/github.com/goharbor/harbor/LICENSE
generated
vendored
@ -1,210 +0,0 @@
|
||||
LICENSE
|
||||
|
||||
Harbor
|
||||
|
||||
Copyright (c) 2016-2018 VMware, Inc. All rights reserved.
|
||||
|
||||
This product is licensed to you under the Apache License version 2.0 (the “License”).
|
||||
You may not use this product except in compliance with the License.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License 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.
|
10
src/vendor/github.com/goharbor/harbor/NOTICE
generated
vendored
10
src/vendor/github.com/goharbor/harbor/NOTICE
generated
vendored
@ -1,10 +0,0 @@
|
||||
NOTICE
|
||||
|
||||
Harbor
|
||||
|
||||
Copyright (c) 2016-2018 VMware, Inc. All Rights Reserved.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License"). You may not use this product except in compliance with the License.
|
||||
|
||||
This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
3
src/vendor/github.com/goharbor/harbor/src/ui_ng/lib/AUTHORS
generated
vendored
3
src/vendor/github.com/goharbor/harbor/src/ui_ng/lib/AUTHORS
generated
vendored
@ -1,3 +0,0 @@
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
|
||||
Steven zou <szou@vmware.com>
|
4122
src/vendor/github.com/goharbor/harbor/src/ui_ng/lib/LICENSE
generated
vendored
4122
src/vendor/github.com/goharbor/harbor/src/ui_ng/lib/LICENSE
generated
vendored
File diff suppressed because it is too large
Load Diff
41
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/access_log.go
generated
vendored
41
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/access_log.go
generated
vendored
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type AccessLog struct {
|
||||
|
||||
// The ID of the log entry.
|
||||
LogId int32 `json:"log_id,omitempty"`
|
||||
|
||||
// Name of the repository in this log entry.
|
||||
RepoName string `json:"repo_name,omitempty"`
|
||||
|
||||
// Tag of the repository in this log entry.
|
||||
RepoTag string `json:"repo_tag,omitempty"`
|
||||
|
||||
// The operation against the repository in this log entry.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
|
||||
// The time when this operation is triggered.
|
||||
OpTime string `json:"op_time,omitempty"`
|
||||
}
|
34
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/access_log_filter.go
generated
vendored
34
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/access_log_filter.go
generated
vendored
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type LogQuery struct {
|
||||
Username string `url:"username,omitempty"`
|
||||
Repository string `url:"repository,omitempty"`
|
||||
Tag string `url:"tag,omitempty"`
|
||||
Operation []string `url:"operation,omitempty"`
|
||||
BeginTimestamp int64 `url:"begin_timestamp,omitempty"`
|
||||
EndTimestamp int64 `url:"end_timestamp,omitempty"`
|
||||
Page int64 `url:"page,omitempty"`
|
||||
PageSize int64 `url:"page_size,omitempty"`
|
||||
}
|
35
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/admin_job.go
generated
vendored
35
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/admin_job.go
generated
vendored
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
// AdminJob ...
|
||||
type AdminJob struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"job_name,omitempty"`
|
||||
Kind string `json:"job_kind,omitempty"`
|
||||
Status string `json:"job_status,omitempty"`
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
CreationTime string `json:"creation_time,omitempty"`
|
||||
UpdateTime string `json:"update_time,omitempty"`
|
||||
}
|
37
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/admin_job_req.go
generated
vendored
37
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/admin_job_req.go
generated
vendored
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
// GCReq holds request information for admin job
|
||||
type GCReq struct {
|
||||
Schedule *ScheduleParam `json:"schedule,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// ScheduleParam ...
|
||||
type ScheduleParam struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
Weekday int8 `json:"Weekday,omitempty"`
|
||||
Offtime int64 `json:"Offtime,omitempty"`
|
||||
}
|
224
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harborapi.go
generated
vendored
224
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harborapi.go
generated
vendored
@ -1,224 +0,0 @@
|
||||
//Package apilib
|
||||
//These APIs provide services for manipulating Harbor project.
|
||||
package apilib
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
//"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/dghubble/sling"
|
||||
)
|
||||
|
||||
type HarborAPI struct {
|
||||
basePath string
|
||||
}
|
||||
|
||||
func NewHarborAPI() *HarborAPI {
|
||||
return &HarborAPI{
|
||||
basePath: "http://localhost",
|
||||
}
|
||||
}
|
||||
|
||||
func NewHarborAPIWithBasePath(basePath string) *HarborAPI {
|
||||
return &HarborAPI{
|
||||
basePath: basePath,
|
||||
}
|
||||
}
|
||||
|
||||
type UsrInfo struct {
|
||||
Name string
|
||||
Passwd string
|
||||
}
|
||||
|
||||
//Search for projects and repositories
|
||||
//Implementation Notes
|
||||
//The Search endpoint returns information about the projects and repositories
|
||||
//offered at public status or related to the current logged in user.
|
||||
//The response includes the project and repository list in a proper display order.
|
||||
//@param q Search parameter for project and repository name.
|
||||
//@return []Search
|
||||
//func (a HarborAPI) SearchGet (q string) (Search, error) {
|
||||
func (a HarborAPI) SearchGet(q string) (Search, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/api/search"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
Query string `url:"q,omitempty"`
|
||||
}
|
||||
|
||||
_sling = _sling.QueryStruct(&QueryParams{Query: q})
|
||||
|
||||
// accept header
|
||||
accepts := []string{"application/json", "text/plain"}
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
req, err := _sling.Request()
|
||||
|
||||
client := &http.Client{}
|
||||
httpResponse, err := client.Do(req)
|
||||
defer httpResponse.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(httpResponse.Body)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
var successPayload = new(Search)
|
||||
err = json.Unmarshal(body, &successPayload)
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
//Create a new project.
|
||||
//Implementation Notes
|
||||
//This endpoint is for user to create a new project.
|
||||
//@param project New created project.
|
||||
//@return void
|
||||
//func (a HarborAPI) ProjectsPost (prjUsr UsrInfo, project Project) (int, error) {
|
||||
func (a HarborAPI) ProjectsPost(prjUsr UsrInfo, project Project) (int, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/api/projects"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string{"application/json", "text/plain"}
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(project)
|
||||
|
||||
req, err := _sling.Request()
|
||||
req.SetBasicAuth(prjUsr.Name, prjUsr.Passwd)
|
||||
|
||||
client := &http.Client{}
|
||||
httpResponse, err := client.Do(req)
|
||||
defer httpResponse.Body.Close()
|
||||
|
||||
return httpResponse.StatusCode, err
|
||||
}
|
||||
|
||||
//Delete a repository or a tag in a repository.
|
||||
//Delete a repository or a tag in a repository.
|
||||
//This endpoint let user delete repositories and tags with repo name and tag.\n
|
||||
//@param repoName The name of repository which will be deleted.
|
||||
//@param tag Tag of a repository.
|
||||
//@return void
|
||||
//func (a HarborAPI) RepositoriesDelete(prjUsr UsrInfo, repoName string, tag string) (int, error) {
|
||||
func (a HarborAPI) RepositoriesDelete(prjUsr UsrInfo, repoName string, tag string) (int, error) {
|
||||
_sling := sling.New().Delete(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/api/repositories"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
RepoName string `url:"repo_name,omitempty"`
|
||||
Tag string `url:"tag,omitempty"`
|
||||
}
|
||||
|
||||
_sling = _sling.QueryStruct(&QueryParams{RepoName: repoName, Tag: tag})
|
||||
// accept header
|
||||
accepts := []string{"application/json", "text/plain"}
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
req, err := _sling.Request()
|
||||
req.SetBasicAuth(prjUsr.Name, prjUsr.Passwd)
|
||||
//fmt.Printf("request %+v", req)
|
||||
|
||||
client := &http.Client{}
|
||||
httpResponse, err := client.Do(req)
|
||||
defer httpResponse.Body.Close()
|
||||
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
return httpResponse.StatusCode, err
|
||||
}
|
||||
|
||||
//Return projects created by Harbor
|
||||
//func (a HarborApi) ProjectsGet (projectName string, isPublic int32) ([]Project, error) {
|
||||
// }
|
||||
|
||||
//Check if the project name user provided already exists.
|
||||
//func (a HarborApi) ProjectsHead (projectName string) (error) {
|
||||
//}
|
||||
|
||||
//Get access logs accompany with a relevant project.
|
||||
//func (a HarborApi) ProjectsProjectIdLogsFilterPost (projectId int32, accessLog AccessLog) ([]AccessLog, error) {
|
||||
//}
|
||||
|
||||
//Return a project's relevant role members.
|
||||
//func (a HarborApi) ProjectsProjectIdMembersGet (projectId int32) ([]Role, error) {
|
||||
//}
|
||||
|
||||
//Add project role member accompany with relevant project and user.
|
||||
//func (a HarborApi) ProjectsProjectIdMembersPost (projectId int32, roles RoleParam) (error) {
|
||||
//}
|
||||
|
||||
//Delete project role members accompany with relevant project and user.
|
||||
//func (a HarborApi) ProjectsProjectIdMembersUserIdDelete (projectId int32, userId int32) (error) {
|
||||
//}
|
||||
|
||||
//Return role members accompany with relevant project and user.
|
||||
//func (a HarborApi) ProjectsProjectIdMembersUserIdGet (projectId int32, userId int32) ([]Role, error) {
|
||||
//}
|
||||
|
||||
//Update project role members accompany with relevant project and user.
|
||||
//func (a HarborApi) ProjectsProjectIdMembersUserIdPut (projectId int32, userId int32, roles RoleParam) (error) {
|
||||
//}
|
||||
|
||||
//Update properties for a selected project.
|
||||
//func (a HarborApi) ProjectsProjectIdPut (projectId int32, project Project) (error) {
|
||||
//}
|
||||
|
||||
//Get repositories accompany with relevant project and repo name.
|
||||
//func (a HarborApi) RepositoriesGet (projectId int32, q string) ([]Repository, error) {
|
||||
//}
|
||||
|
||||
//Get manifests of a relevant repository.
|
||||
//func (a HarborApi) RepositoriesManifestGet (repoName string, tag string) (error) {
|
||||
//}
|
||||
|
||||
//Get tags of a relevant repository.
|
||||
//func (a HarborApi) RepositoriesTagsGet (repoName string) (error) {
|
||||
//}
|
||||
|
||||
//Get registered users of Harbor.
|
||||
//func (a HarborApi) UsersGet (userName string) ([]User, error) {
|
||||
//}
|
||||
|
||||
//Creates a new user account.
|
||||
//func (a HarborApi) UsersPost (user User) (error) {
|
||||
//}
|
||||
|
||||
//Mark a registered user as be removed.
|
||||
//func (a HarborApi) UsersUserIdDelete (userId int32) (error) {
|
||||
//}
|
||||
|
||||
//Change the password on a user that already exists.
|
||||
//func (a HarborApi) UsersUserIdPasswordPut (userId int32, password Password) (error) {
|
||||
//}
|
||||
|
||||
//Update a registered user to change to be an administrator of Harbor.
|
||||
//func (a HarborApi) UsersUserIdPut (userId int32) (error) {
|
||||
//}
|
15
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harborlogout.bak
generated
vendored
15
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harborlogout.bak
generated
vendored
@ -1,15 +0,0 @@
|
||||
// HarborLogout.go
|
||||
package HarborAPI
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func (a HarborAPI) HarborLogout() (int, error) {
|
||||
|
||||
response, err := http.Get(a.basePath + "/logout")
|
||||
|
||||
defer response.Body.Close()
|
||||
|
||||
return response.StatusCode, err
|
||||
}
|
15
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harborlogout.go
generated
vendored
15
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harborlogout.go
generated
vendored
@ -1,15 +0,0 @@
|
||||
// HarborLogout.go
|
||||
package apilib
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func (a HarborAPI) HarborLogout() (int, error) {
|
||||
|
||||
response, err := http.Get(a.basePath + "/logout")
|
||||
|
||||
defer response.Body.Close()
|
||||
|
||||
return response.StatusCode, err
|
||||
}
|
28
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harlogin.bak
generated
vendored
28
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harlogin.bak
generated
vendored
@ -1,28 +0,0 @@
|
||||
// HarborLogon.go
|
||||
package HarborAPI
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (a HarborAPI) HarborLogin(user UsrInfo) (int, error) {
|
||||
|
||||
v := url.Values{}
|
||||
v.Set("principal", user.Name)
|
||||
v.Set("password", user.Passwd)
|
||||
|
||||
body := ioutil.NopCloser(strings.NewReader(v.Encode())) //endode v:[body struce]
|
||||
|
||||
client := &http.Client{}
|
||||
reqest, err := http.NewRequest("POST", a.basePath+"/login", body)
|
||||
|
||||
reqest.Header.Set("Content-Type", "application/x-www-form-urlencoded;param=value") //setting post head
|
||||
|
||||
resp, err := client.Do(reqest)
|
||||
defer resp.Body.Close() //close resp.Body
|
||||
|
||||
return resp.StatusCode, err
|
||||
}
|
28
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harlogin.go
generated
vendored
28
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/harlogin.go
generated
vendored
@ -1,28 +0,0 @@
|
||||
// HarborLogon.go
|
||||
package apilib
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (a HarborAPI) HarborLogin(user UsrInfo) (int, error) {
|
||||
|
||||
v := url.Values{}
|
||||
v.Set("principal", user.Name)
|
||||
v.Set("password", user.Passwd)
|
||||
|
||||
body := ioutil.NopCloser(strings.NewReader(v.Encode())) //endode v:[body struce]
|
||||
|
||||
client := &http.Client{}
|
||||
reqest, err := http.NewRequest("POST", a.basePath+"/login", body)
|
||||
|
||||
reqest.Header.Set("Content-Type", "application/x-www-form-urlencoded;param=value") //setting post head
|
||||
|
||||
resp, err := client.Do(reqest)
|
||||
defer resp.Body.Close() //close resp.Body
|
||||
|
||||
return resp.StatusCode, err
|
||||
}
|
50
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/job_status.go
generated
vendored
50
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/job_status.go
generated
vendored
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type JobStatus struct {
|
||||
|
||||
// The job ID.
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
// The status of the job.
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
// The repository handled by the job.
|
||||
Repository string `json:"repository,omitempty"`
|
||||
|
||||
// The ID of the policy that triggered this job.
|
||||
PolicyId int64 `json:"policy_id,omitempty"`
|
||||
|
||||
// The operation of the job.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
|
||||
// The repository's used tag list.
|
||||
Tags []Tags `json:"tags,omitempty"`
|
||||
|
||||
// The creation time of the job.
|
||||
CreationTime string `json:"creation_time,omitempty"`
|
||||
|
||||
// The update time of the job.
|
||||
UpdateTime string `json:"update_time,omitempty"`
|
||||
}
|
34
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/ldap.go
generated
vendored
34
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/ldap.go
generated
vendored
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type LdapConf struct {
|
||||
LdapURL string `json:"ldap_url"`
|
||||
LdapSearchDn string `json:"ldap_search_dn"`
|
||||
LdapSearchPassword string `json:"ldap_search_password"`
|
||||
LdapBaseDn string `json:"ldap_base_dn"`
|
||||
LdapFilter string `json:"ldap_filter"`
|
||||
LdapUID string `json:"ldap_uid"`
|
||||
LdapScope int `json:"ldap_scope"`
|
||||
LdapConnectionTimeout int `json:"ldap_connection_timeout"`
|
||||
}
|
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/password.go
generated
vendored
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/password.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type Password struct {
|
||||
|
||||
// The user's existing password.
|
||||
OldPassword string `json:"old_password,omitempty"`
|
||||
|
||||
// New password for marking as to be updated.
|
||||
NewPassword string `json:"new_password,omitempty"`
|
||||
}
|
69
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/project.go
generated
vendored
69
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/project.go
generated
vendored
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type Project struct {
|
||||
|
||||
// Project ID
|
||||
ProjectId int32 `json:"project_id,omitempty"`
|
||||
|
||||
// The owner ID of the project always means the creator of the project.
|
||||
OwnerId int32 `json:"owner_id,omitempty"`
|
||||
|
||||
// The name of the project.
|
||||
ProjectName string `json:"name,omitempty"`
|
||||
|
||||
// The creation time of the project.
|
||||
CreationTime string `json:"creation_time,omitempty"`
|
||||
|
||||
// The update time of the project.
|
||||
UpdateTime string `json:"update_time,omitempty"`
|
||||
|
||||
// A deletion mark of the project (1 means it's deleted, 0 is not)
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
|
||||
// The owner name of the project.
|
||||
OwnerName string `json:"owner_name,omitempty"`
|
||||
|
||||
// The metadata of the project.
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
|
||||
// Correspond to the UI about whether the project's publicity is updatable (for UI)
|
||||
Togglable bool `json:"togglable,omitempty"`
|
||||
|
||||
// The role ID of the current user who triggered the API (for UI)
|
||||
CurrentUserRoleId int32 `json:"current_user_role_id,omitempty"`
|
||||
|
||||
// The number of the repositories under this project.
|
||||
RepoCount int32 `json:"repo_count,omitempty"`
|
||||
}
|
||||
|
||||
type ProjectQuery struct {
|
||||
Name string `url:"name,omitempty"`
|
||||
Owner string `url:"owner,omitempty"`
|
||||
Public bool `url:"public,omitempty"`
|
||||
Member string `url:"member,omitempty"`
|
||||
Role int `url:"role,omitempty"`
|
||||
Page int64 `url:"page,omitempty"`
|
||||
PageSize int64 `url:"page_size,omitempty"`
|
||||
}
|
30
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/project_req.go
generated
vendored
30
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/project_req.go
generated
vendored
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type ProjectReq struct {
|
||||
// The name of the project.
|
||||
ProjectName string `json:"project_name,omitempty"`
|
||||
// The metadata of the project.
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
}
|
61
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy.go
generated
vendored
61
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy.go
generated
vendored
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RepPolicy struct {
|
||||
|
||||
// The policy ID.
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
// The project ID.
|
||||
ProjectId int64 `json:"project_id,omitempty"`
|
||||
|
||||
// The project name.
|
||||
ProjectName string `json:"project_name,omitempty"`
|
||||
|
||||
// The target ID.
|
||||
TargetId int64 `json:"target_id,omitempty"`
|
||||
|
||||
// The policy name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The policy's enabled status.
|
||||
Enabled int32 `json:"enabled,omitempty"`
|
||||
|
||||
// The description of the policy.
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
// The cron string for schedule job.
|
||||
CronStr string `json:"cron_str,omitempty"`
|
||||
|
||||
// The start time of the policy.
|
||||
StartTime string `json:"start_time,omitempty"`
|
||||
|
||||
// The create time of the policy.
|
||||
CreationTime string `json:"creation_time,omitempty"`
|
||||
|
||||
// The update time of the policy.
|
||||
UpdateTime string `json:"update_time,omitempty"`
|
||||
|
||||
Deleted int32 `json:"deleted,omitempty"`
|
||||
}
|
29
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy_enablement_req.go
generated
vendored
29
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy_enablement_req.go
generated
vendored
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RepPolicyEnablementReq struct {
|
||||
|
||||
// The policy enablement flag.
|
||||
Enabled int32 `json:"enabled,omitempty"`
|
||||
}
|
35
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy_post.go
generated
vendored
35
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy_post.go
generated
vendored
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RepPolicyPost struct {
|
||||
|
||||
// The project ID.
|
||||
ProjectId int64 `json:"project_id,omitempty"`
|
||||
|
||||
// The target ID.
|
||||
TargetId int64 `json:"target_id,omitempty"`
|
||||
|
||||
// The policy name.
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
41
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy_update.go
generated
vendored
41
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_policy_update.go
generated
vendored
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RepPolicyUpdate struct {
|
||||
|
||||
// The target ID.
|
||||
TargetId int64 `json:"target_id,omitempty"`
|
||||
|
||||
// The policy name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The policy's enabled status.
|
||||
Enabled int32 `json:"enabled,omitempty"`
|
||||
|
||||
// The description of the policy.
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
// The cron string for schedule job.
|
||||
CronStr string `json:"cron_str,omitempty"`
|
||||
}
|
50
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_target.go
generated
vendored
50
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_target.go
generated
vendored
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RepTarget struct {
|
||||
|
||||
// The target ID.
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
// The target address URL string.
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
|
||||
// The target name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The target server username.
|
||||
Username string `json:"username,omitempty"`
|
||||
|
||||
// The target server password.
|
||||
Password string `json:"password,omitempty"`
|
||||
|
||||
// Reserved field.
|
||||
Type_ int32 `json:"type,omitempty"`
|
||||
|
||||
// The create time of the policy.
|
||||
CreationTime string `json:"creation_time,omitempty"`
|
||||
|
||||
// The update time of the policy.
|
||||
UpdateTime string `json:"update_time,omitempty"`
|
||||
}
|
38
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_target_post.go
generated
vendored
38
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/rep_target_post.go
generated
vendored
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RepTargetPost struct {
|
||||
|
||||
// The target address URL string.
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
|
||||
// The target name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The target server username.
|
||||
Username string `json:"username,omitempty"`
|
||||
|
||||
// The target server password.
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
50
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/repository.go
generated
vendored
50
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/repository.go
generated
vendored
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type Repository struct {
|
||||
|
||||
// Repository ID
|
||||
Id string `json:"id,omitempty"`
|
||||
|
||||
// Parent of the image.
|
||||
Parent string `json:"parent,omitempty"`
|
||||
|
||||
// Repository create time.
|
||||
Created string `json:"created,omitempty"`
|
||||
|
||||
// Duration days of the image.
|
||||
DurationDays string `json:"duration_days,omitempty"`
|
||||
|
||||
// Author of the image.
|
||||
Author string `json:"author,omitempty"`
|
||||
|
||||
// Architecture of the image.
|
||||
Architecture string `json:"architecture,omitempty"`
|
||||
|
||||
// Docker version of the image.
|
||||
DockerVersion string `json:"docker_version,omitempty"`
|
||||
|
||||
// OS of the image.
|
||||
Os string `json:"os,omitempty"`
|
||||
}
|
37
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/role.go
generated
vendored
37
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/role.go
generated
vendored
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type Role struct {
|
||||
|
||||
// ID in table.
|
||||
RoleId int32 `json:"role_id,omitempty"`
|
||||
|
||||
// Description of permissions for the role.
|
||||
RoleCode string `json:"role_code,omitempty"`
|
||||
|
||||
// Name the the role.
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
|
||||
RoleMask string `json:"role_mask,omitempty"`
|
||||
}
|
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/role_param.go
generated
vendored
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/role_param.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type RoleParam struct {
|
||||
|
||||
// Role ID for updating project role member.
|
||||
Roles []int32 `json:"roles,omitempty"`
|
||||
|
||||
// Username relevant to a project role member.
|
||||
Username string `json:"username,omitempty"`
|
||||
}
|
36
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/search.go
generated
vendored
36
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/search.go
generated
vendored
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
import (
|
||||
"github.com/vmware/harbor/src/common/models"
|
||||
)
|
||||
|
||||
type Search struct {
|
||||
|
||||
// Search results of the projects that matched the filter keywords.
|
||||
Projects []models.Project `json:"project,omitempty"`
|
||||
|
||||
// Search results of the repositories that matched the filter keywords.
|
||||
Repositories []SearchRepository `json:"repository,omitempty"`
|
||||
}
|
35
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/search_project.go
generated
vendored
35
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/search_project.go
generated
vendored
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type SearchProject struct {
|
||||
|
||||
// The ID of project
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
// The name of the project
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The flag to indicate the publicity of the project (1 is public, 0 is non-public)
|
||||
Public int32 `json:"public,omitempty"`
|
||||
}
|
38
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/search_repository.go
generated
vendored
38
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/search_repository.go
generated
vendored
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type SearchRepository struct {
|
||||
|
||||
// The ID of the project that the repository belongs to
|
||||
ProjectId int32 `json:"project_id,omitempty"`
|
||||
|
||||
// The name of the project that the repository belongs to
|
||||
ProjectName string `json:"project_name,omitempty"`
|
||||
|
||||
// The flag to indicate the publicity of the project that the repository belongs to
|
||||
ProjectPublic bool `json:"project_public,omitempty"`
|
||||
|
||||
// The name of the repository
|
||||
RepositoryName string `json:"repository_name,omitempty"`
|
||||
}
|
44
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/statistic_map.go
generated
vendored
44
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/statistic_map.go
generated
vendored
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type StatisticMap struct {
|
||||
|
||||
// The count of the private projects which the user is a member of.
|
||||
PrivateProjectCount int32 `json:"private_project_count,omitempty"`
|
||||
|
||||
// The count of the private repositories belonging to the projects which the user is a member of.
|
||||
PrivateRepoCount int32 `json:"private_repo_count,omitempty"`
|
||||
|
||||
// The count of the public projects.
|
||||
PublicProjectCount int32 `json:"public_project_count,omitempty"`
|
||||
|
||||
// The count of the public repositories belonging to the public projects which the user is a member of.
|
||||
PublicRepoCount int32 `json:"public_repo_count,omitempty"`
|
||||
|
||||
// The count of the total projects, only be seen when the is admin.
|
||||
TotalProjectCount int32 `json:"total_project_count,omitempty"`
|
||||
|
||||
// The count of the total repositories, only be seen when the user is admin.
|
||||
TotalRepoCount int32 `json:"total_repo_count,omitempty"`
|
||||
}
|
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/system_info.go
generated
vendored
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/system_info.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type SystemInfo struct {
|
||||
HarborStorage Storage `json:"storage"`
|
||||
}
|
||||
|
||||
type Storage struct {
|
||||
Total uint64 `json:"total"`
|
||||
Free uint64 `json:"free"`
|
||||
}
|
29
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/tags.go
generated
vendored
29
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/tags.go
generated
vendored
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type Tags struct {
|
||||
|
||||
// The repository's used tag.
|
||||
Tag string `json:"tag,omitempty"`
|
||||
}
|
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/top_repo.go
generated
vendored
32
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/top_repo.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type TopRepo struct {
|
||||
|
||||
// The name of the repo
|
||||
RepoName string `json:"repo_name,omitempty"`
|
||||
|
||||
// The access count of the repo
|
||||
Count int32 `json:"count,omitempty"`
|
||||
}
|
55
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/user.go
generated
vendored
55
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/user.go
generated
vendored
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type User struct {
|
||||
|
||||
// The ID of the user.
|
||||
UserId int `json:"user_id,omitempty"`
|
||||
|
||||
Username string `json:"username,omitempty"`
|
||||
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
Password string `json:"password,omitempty"`
|
||||
|
||||
Realname string `json:"realname,omitempty"`
|
||||
|
||||
Comment string `json:"comment,omitempty"`
|
||||
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
|
||||
RoleId int32 `json:"role_id,omitempty"`
|
||||
|
||||
HasAdminRole bool `json:"has_admin_role,omitempty"`
|
||||
|
||||
ResetUuid string `json:"reset_uuid,omitempty"`
|
||||
|
||||
Salt string `json:"Salt,omitempty"`
|
||||
|
||||
CreationTime string `json:"creation_time,omitempty"`
|
||||
|
||||
UpdateTime string `json:"update_time,omitempty"`
|
||||
}
|
31
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/user_profile.go
generated
vendored
31
src/vendor/github.com/goharbor/harbor/tests/apitests/apilib/user_profile.go
generated
vendored
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Harbor API
|
||||
*
|
||||
* These APIs provide services for manipulating Harbor project.
|
||||
*
|
||||
* OpenAPI spec version: 0.3.0
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License 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.
|
||||
*/
|
||||
|
||||
package apilib
|
||||
|
||||
type UserProfile struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
Realname string `json:"realname,omitempty"`
|
||||
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
13
src/vendor/github.com/goharbor/harbor/tools/copyright/copyright
generated
vendored
13
src/vendor/github.com/goharbor/harbor/tools/copyright/copyright
generated
vendored
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
56
src/vendor/github.com/vmware/harbor/AUTHORS
generated
vendored
56
src/vendor/github.com/vmware/harbor/AUTHORS
generated
vendored
@ -1,56 +0,0 @@
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
|
||||
Alexander Zeitler <alexander.zeitler at pdmlab.com>
|
||||
Alexey Erkak <eryigin at mail.ru>
|
||||
Allen Heavey <xheavey at gmail.com>
|
||||
Amanda Zhang <amzhang at vmware.com>
|
||||
Andre Cruz <andre at brpx.com>
|
||||
Aron Parsons <aron at knackworks.com>
|
||||
Benniu Ji <benniuji at gmail.com>
|
||||
Bin Liu <liubin0329 at gmail.com>
|
||||
BhEaN <bhean at vandalsweb.com>
|
||||
Bobby Zhang <junzhang at vmware.com>
|
||||
Brian Christner <brian.christner at gmail.com>
|
||||
Chaofeng Wu <chaofengw at vmware.com>
|
||||
Casey Peel < >
|
||||
Daniel Jiang <jiangd at vmware.com>
|
||||
Deshi Xiao <xiaods at gmail.com>
|
||||
Dmitry Lazurkin <dilaz03 at gmail.com>
|
||||
Fangyuan Li <maplainfly at gmail.com>
|
||||
Feileng Cui <feilengcui008 at gmail.com>
|
||||
Fuhui Peng <srqh1120 at sina.com>
|
||||
Guangping Fu <krystism at gmail.com>
|
||||
Haining Henry Zhang <henryzhang at vmware.com>
|
||||
Hao Xia <haox at vmware.com>
|
||||
Haoyuan <harryge00 at gmail.com>
|
||||
Jack Liu <ljack at vmware.com>
|
||||
Jessy Zhang <jessyz at vmware.com>
|
||||
Jianye Li <li.jianye at gmail.com>
|
||||
Kira <me at imkira.com>
|
||||
Kun Wang <kunw at vmware.com>
|
||||
Mahesh Paolini-Subramanya <mahesh at dieswaytoofast.com>
|
||||
Maxwell <710028463 at qq.com>
|
||||
Meng Wei <weim at vmware.com>
|
||||
Mizukoshi Masataka <m.mizukoshi.wakuwaku at gmail.com>
|
||||
Nagarjun G <nagarjung.g at gmail.com>
|
||||
Peng Zhao <zhaopeng1988 at gmail.com>
|
||||
Penghao Cen <scorpiocph at gmail.com>
|
||||
Phillip Gomez <gomez.phillip at gmail.com>
|
||||
Robin Naundorf <r.naundorf at fh-muenster.de>
|
||||
Samuel Archambault <sarchambault at lapresse.ca>
|
||||
Shan Zhu <zhus at vmware.com>
|
||||
Steven Zou <szou at vmware.com>
|
||||
Ricardo Katz <rikatz at users.noreply.github.com>
|
||||
Robin Yue <jmyue at hotmail.com>
|
||||
Tim Chen Xiaoyu <837829664 at qq.com>
|
||||
Tobe Chen <tobeg3oogle at gmail.com>
|
||||
Victoria Zheng <vzheng at vmware.com>
|
||||
Wenkai Yin <yinw at vmware.com>
|
||||
Xiaoxiao Zhou <xiaoxiaoz at vmware.com>
|
||||
Xinkun Xu <xuxinkun at gmail.com>
|
||||
Yahao He <bhe at vmware.com>
|
||||
Yan Wang <wangyan at vmware.com>
|
||||
Yixing Jia <yixingj at vmware.com>
|
||||
Yong Hua <yhua at vmware.com>
|
||||
Yufei Ma <myufei at vmware.com>
|
||||
|
210
src/vendor/github.com/vmware/harbor/LICENSE
generated
vendored
210
src/vendor/github.com/vmware/harbor/LICENSE
generated
vendored
@ -1,210 +0,0 @@
|
||||
LICENSE
|
||||
|
||||
Harbor
|
||||
|
||||
Copyright (c) 2016-2018 VMware, Inc. All rights reserved.
|
||||
|
||||
This product is licensed to you under the Apache License version 2.0 (the “License”).
|
||||
You may not use this product except in compliance with the License.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License 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.
|
10
src/vendor/github.com/vmware/harbor/NOTICE
generated
vendored
10
src/vendor/github.com/vmware/harbor/NOTICE
generated
vendored
@ -1,10 +0,0 @@
|
||||
NOTICE
|
||||
|
||||
Harbor
|
||||
|
||||
Copyright (c) 2016-2018 VMware, Inc. All Rights Reserved.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License"). You may not use this product except in compliance with the License.
|
||||
|
||||
This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
202
src/vendor/github.com/vmware/harbor/src/common/const.go
generated
vendored
202
src/vendor/github.com/vmware/harbor/src/common/const.go
generated
vendored
@ -1,202 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package common
|
||||
|
||||
// const variables
|
||||
const (
|
||||
DBAuth = "db_auth"
|
||||
LDAPAuth = "ldap_auth"
|
||||
UAAAuth = "uaa_auth"
|
||||
ProCrtRestrEveryone = "everyone"
|
||||
ProCrtRestrAdmOnly = "adminonly"
|
||||
LDAPScopeBase = 0
|
||||
LDAPScopeOnelevel = 1
|
||||
LDAPScopeSubtree = 2
|
||||
|
||||
RoleProjectAdmin = 1
|
||||
RoleDeveloper = 2
|
||||
RoleGuest = 3
|
||||
|
||||
LabelLevelSystem = "s"
|
||||
LabelLevelUser = "u"
|
||||
LabelScopeGlobal = "g"
|
||||
LabelScopeProject = "p"
|
||||
|
||||
ResourceTypeProject = "p"
|
||||
ResourceTypeRepository = "r"
|
||||
ResourceTypeImage = "i"
|
||||
|
||||
ExtEndpoint = "ext_endpoint"
|
||||
AUTHMode = "auth_mode"
|
||||
DatabaseType = "database_type"
|
||||
PostGreSQLHOST = "postgresql_host"
|
||||
PostGreSQLPort = "postgresql_port"
|
||||
PostGreSQLUsername = "postgresql_username"
|
||||
PostGreSQLPassword = "postgresql_password"
|
||||
PostGreSQLDatabase = "postgresql_database"
|
||||
PostGreSQLSSLMode = "postgresql_sslmode"
|
||||
SelfRegistration = "self_registration"
|
||||
UIURL = "ui_url"
|
||||
JobServiceURL = "jobservice_url"
|
||||
LDAPURL = "ldap_url"
|
||||
LDAPSearchDN = "ldap_search_dn"
|
||||
LDAPSearchPwd = "ldap_search_password"
|
||||
LDAPBaseDN = "ldap_base_dn"
|
||||
LDAPUID = "ldap_uid"
|
||||
LDAPFilter = "ldap_filter"
|
||||
LDAPScope = "ldap_scope"
|
||||
LDAPTimeout = "ldap_timeout"
|
||||
LDAPVerifyCert = "ldap_verify_cert"
|
||||
LDAPGroupBaseDN = "ldap_group_base_dn"
|
||||
LDAPGroupSearchFilter = "ldap_group_search_filter"
|
||||
LDAPGroupAttributeName = "ldap_group_attribute_name"
|
||||
LDAPGroupSearchScope = "ldap_group_search_scope"
|
||||
TokenServiceURL = "token_service_url"
|
||||
RegistryURL = "registry_url"
|
||||
EmailHost = "email_host"
|
||||
EmailPort = "email_port"
|
||||
EmailUsername = "email_username"
|
||||
EmailPassword = "email_password"
|
||||
EmailFrom = "email_from"
|
||||
EmailSSL = "email_ssl"
|
||||
EmailIdentity = "email_identity"
|
||||
EmailInsecure = "email_insecure"
|
||||
ProjectCreationRestriction = "project_creation_restriction"
|
||||
MaxJobWorkers = "max_job_workers"
|
||||
TokenExpiration = "token_expiration"
|
||||
CfgExpiration = "cfg_expiration"
|
||||
JobLogDir = "job_log_dir"
|
||||
AdminInitialPassword = "admin_initial_password"
|
||||
AdmiralEndpoint = "admiral_url"
|
||||
WithNotary = "with_notary"
|
||||
WithClair = "with_clair"
|
||||
ScanAllPolicy = "scan_all_policy"
|
||||
ClairDBPassword = "clair_db_password"
|
||||
ClairDBHost = "clair_db_host"
|
||||
ClairDBPort = "clair_db_port"
|
||||
ClairDB = "clair_db"
|
||||
ClairDBUsername = "clair_db_username"
|
||||
UAAEndpoint = "uaa_endpoint"
|
||||
UAAClientID = "uaa_client_id"
|
||||
UAAClientSecret = "uaa_client_secret"
|
||||
UAAVerifyCert = "uaa_verify_cert"
|
||||
DefaultClairEndpoint = "http://clair:6060"
|
||||
CfgDriverDB = "db"
|
||||
CfgDriverJSON = "json"
|
||||
NewHarborAdminName = "admin@harbor.local"
|
||||
RegistryStorageProviderName = "registry_storage_provider_name"
|
||||
UserMember = "u"
|
||||
GroupMember = "g"
|
||||
ReadOnly = "read_only"
|
||||
ClairURL = "clair_url"
|
||||
NotaryURL = "notary_url"
|
||||
DefaultAdminserverEndpoint = "http://adminserver:8080"
|
||||
DefaultJobserviceEndpoint = "http://jobservice:8080"
|
||||
DefaultUIEndpoint = "http://ui:8080"
|
||||
DefaultNotaryEndpoint = "http://notary-server:4443"
|
||||
LdapGroupType = 1
|
||||
ReloadKey = "reload_key"
|
||||
LdapGroupAdminDn = "ldap_group_admin_dn"
|
||||
DefaultRegistryControllerEndpoint = "http://registryctl:8080"
|
||||
WithChartMuseum = "with_chartmuseum"
|
||||
ChartRepoURL = "chart_repository_url"
|
||||
DefaultChartRepoURL = "http://chartmuseum:9999"
|
||||
)
|
||||
|
||||
// Shared variable, not allowed to modify
|
||||
var (
|
||||
// the keys of configurations which user can modify in PUT method and user can
|
||||
// get in GET method
|
||||
HarborValidKeys = []string{
|
||||
AUTHMode,
|
||||
SelfRegistration,
|
||||
LDAPURL,
|
||||
LDAPSearchDN,
|
||||
LDAPSearchPwd,
|
||||
LDAPBaseDN,
|
||||
LDAPUID,
|
||||
LDAPFilter,
|
||||
LDAPScope,
|
||||
LDAPTimeout,
|
||||
LDAPVerifyCert,
|
||||
LDAPGroupAttributeName,
|
||||
LDAPGroupBaseDN,
|
||||
LDAPGroupSearchFilter,
|
||||
LDAPGroupSearchScope,
|
||||
LdapGroupAdminDn,
|
||||
EmailHost,
|
||||
EmailPort,
|
||||
EmailUsername,
|
||||
EmailPassword,
|
||||
EmailFrom,
|
||||
EmailSSL,
|
||||
EmailIdentity,
|
||||
EmailInsecure,
|
||||
ProjectCreationRestriction,
|
||||
TokenExpiration,
|
||||
ScanAllPolicy,
|
||||
UAAClientID,
|
||||
UAAClientSecret,
|
||||
UAAEndpoint,
|
||||
UAAVerifyCert,
|
||||
ReadOnly,
|
||||
}
|
||||
|
||||
//value is default value
|
||||
HarborStringKeysMap = map[string]string{
|
||||
AUTHMode: "db_auth",
|
||||
LDAPURL: "",
|
||||
LDAPSearchDN: "",
|
||||
LDAPSearchPwd: "",
|
||||
LDAPBaseDN: "",
|
||||
LDAPUID: "",
|
||||
LDAPFilter: "",
|
||||
LDAPGroupAttributeName: "",
|
||||
LDAPGroupBaseDN: "",
|
||||
LdapGroupAdminDn: "",
|
||||
LDAPGroupSearchFilter: "",
|
||||
EmailHost: "smtp.mydomain.com",
|
||||
EmailUsername: "sample_admin@mydomain.com",
|
||||
EmailPassword: "abc",
|
||||
EmailFrom: "admin <sample_admin@mydomain.com>",
|
||||
EmailIdentity: "",
|
||||
ProjectCreationRestriction: ProCrtRestrEveryone,
|
||||
UAAClientID: "",
|
||||
UAAEndpoint: "",
|
||||
}
|
||||
|
||||
HarborNumKeysMap = map[string]int{
|
||||
EmailPort: 25,
|
||||
LDAPScope: 2,
|
||||
LDAPTimeout: 5,
|
||||
LDAPGroupSearchScope: 2,
|
||||
TokenExpiration: 30,
|
||||
}
|
||||
|
||||
HarborBoolKeysMap = map[string]bool{
|
||||
EmailSSL: false,
|
||||
EmailInsecure: false,
|
||||
SelfRegistration: true,
|
||||
LDAPVerifyCert: true,
|
||||
UAAVerifyCert: true,
|
||||
ReadOnly: false,
|
||||
}
|
||||
|
||||
HarborPasswordKeys = []string{
|
||||
EmailPassword,
|
||||
LDAPSearchPwd,
|
||||
UAAClientSecret,
|
||||
}
|
||||
)
|
44
src/vendor/github.com/vmware/harbor/src/common/models/accesslog.go
generated
vendored
44
src/vendor/github.com/vmware/harbor/src/common/models/accesslog.go
generated
vendored
@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// AccessLog holds information about logs which are used to record the actions that user take to the resourses.
|
||||
type AccessLog struct {
|
||||
LogID int `orm:"pk;auto;column(log_id)" json:"log_id"`
|
||||
Username string `orm:"column(username)" json:"username"`
|
||||
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
||||
RepoName string `orm:"column(repo_name)" json:"repo_name"`
|
||||
RepoTag string `orm:"column(repo_tag)" json:"repo_tag"`
|
||||
GUID string `orm:"column(guid)" json:"guid"`
|
||||
Operation string `orm:"column(operation)" json:"operation"`
|
||||
OpTime time.Time `orm:"column(op_time)" json:"op_time"`
|
||||
}
|
||||
|
||||
// LogQueryParam is used to set query conditions when listing
|
||||
// access logs.
|
||||
type LogQueryParam struct {
|
||||
ProjectIDs []int64 // the IDs of projects to which the operation is done
|
||||
Username string // the operator's username of the log
|
||||
Repository string // repository name
|
||||
Tag string // tag name
|
||||
Operations []string // operations
|
||||
BeginTime *time.Time // the time after which the operation is done
|
||||
EndTime *time.Time // the time before which the operation is doen
|
||||
Pagination *Pagination // pagination information
|
||||
}
|
53
src/vendor/github.com/vmware/harbor/src/common/models/adminjob.go
generated
vendored
53
src/vendor/github.com/vmware/harbor/src/common/models/adminjob.go
generated
vendored
@ -1,53 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
//AdminJobTable is table name for admin job
|
||||
AdminJobTable = "admin_job"
|
||||
)
|
||||
|
||||
// AdminJob ...
|
||||
type AdminJob struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
Name string `orm:"column(job_name)" json:"job_name"`
|
||||
Kind string `orm:"column(job_kind)" json:"job_kind"`
|
||||
Cron string `orm:"column(cron_str)" json:"cron_str"`
|
||||
Status string `orm:"column(status)" json:"job_status"`
|
||||
UUID string `orm:"column(job_uuid)" json:"-"`
|
||||
Deleted bool `orm:"column(deleted)" json:"deleted"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
}
|
||||
|
||||
//TableName is required by by beego orm to map AdminJob to table AdminJob
|
||||
func (a *AdminJob) TableName() string {
|
||||
return AdminJobTable
|
||||
}
|
||||
|
||||
// AdminJobQuery : query parameters for adminjob
|
||||
type AdminJobQuery struct {
|
||||
ID int64
|
||||
Name string
|
||||
Kind string
|
||||
Status string
|
||||
UUID string
|
||||
Deleted bool
|
||||
Pagination
|
||||
}
|
21
src/vendor/github.com/vmware/harbor/src/common/models/authmodel.go
generated
vendored
21
src/vendor/github.com/vmware/harbor/src/common/models/authmodel.go
generated
vendored
@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
// AuthModel holds information used to authenticate.
|
||||
type AuthModel struct {
|
||||
Principal string
|
||||
Password string
|
||||
}
|
40
src/vendor/github.com/vmware/harbor/src/common/models/base.go
generated
vendored
40
src/vendor/github.com/vmware/harbor/src/common/models/base.go
generated
vendored
@ -1,40 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/orm"
|
||||
)
|
||||
|
||||
func init() {
|
||||
orm.RegisterModel(new(RepTarget),
|
||||
new(RepPolicy),
|
||||
new(RepJob),
|
||||
new(User),
|
||||
new(Project),
|
||||
new(Role),
|
||||
new(AccessLog),
|
||||
new(ScanJob),
|
||||
new(RepoRecord),
|
||||
new(ImgScanOverview),
|
||||
new(ClairVulnTimestamp),
|
||||
new(WatchItem),
|
||||
new(ProjectMetadata),
|
||||
new(ConfigEntry),
|
||||
new(Label),
|
||||
new(ResourceLabel),
|
||||
new(UserGroup),
|
||||
new(AdminJob))
|
||||
}
|
136
src/vendor/github.com/vmware/harbor/src/common/models/clair.go
generated
vendored
136
src/vendor/github.com/vmware/harbor/src/common/models/clair.go
generated
vendored
@ -1,136 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClairVulnTimestampTable is the name of the table that tracks the timestamp of vulnerability in Clair.
|
||||
const ClairVulnTimestampTable = "clair_vuln_timestamp"
|
||||
|
||||
// ClairVulnTimestamp represents a record in DB that tracks the timestamp of vulnerability in Clair.
|
||||
type ClairVulnTimestamp struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"-"`
|
||||
Namespace string `orm:"column(namespace)" json:"namespace"`
|
||||
LastUpdate time.Time `orm:"column(last_update)" json:"-"`
|
||||
LastUpdateUTC int64 `orm:"-" json:"last_update"`
|
||||
}
|
||||
|
||||
//TableName is required by beego to map struct to table.
|
||||
func (ct *ClairVulnTimestamp) TableName() string {
|
||||
return ClairVulnTimestampTable
|
||||
}
|
||||
|
||||
//ClairLayer ...
|
||||
type ClairLayer struct {
|
||||
Name string `json:"Name,omitempty"`
|
||||
NamespaceNames []string `json:"NamespaceNames,omitempty"`
|
||||
Path string `json:"Path,omitempty"`
|
||||
Headers map[string]string `json:"Headers,omitempty"`
|
||||
ParentName string `json:"ParentName,omitempty"`
|
||||
Format string `json:"Format,omitempty"`
|
||||
Features []ClairFeature `json:"Features,omitempty"`
|
||||
}
|
||||
|
||||
//ClairFeature ...
|
||||
type ClairFeature struct {
|
||||
Name string `json:"Name,omitempty"`
|
||||
NamespaceName string `json:"NamespaceName,omitempty"`
|
||||
VersionFormat string `json:"VersionFormat,omitempty"`
|
||||
Version string `json:"Version,omitempty"`
|
||||
Vulnerabilities []ClairVulnerability `json:"Vulnerabilities,omitempty"`
|
||||
AddedBy string `json:"AddedBy,omitempty"`
|
||||
}
|
||||
|
||||
//ClairVulnerability ...
|
||||
type ClairVulnerability struct {
|
||||
Name string `json:"Name,omitempty"`
|
||||
NamespaceName string `json:"NamespaceName,omitempty"`
|
||||
Description string `json:"Description,omitempty"`
|
||||
Link string `json:"Link,omitempty"`
|
||||
Severity string `json:"Severity,omitempty"`
|
||||
Metadata map[string]interface{} `json:"Metadata,omitempty"`
|
||||
FixedBy string `json:"FixedBy,omitempty"`
|
||||
FixedIn []ClairFeature `json:"FixedIn,omitempty"`
|
||||
}
|
||||
|
||||
//ClairError ...
|
||||
type ClairError struct {
|
||||
Message string `json:"Message,omitempty"`
|
||||
}
|
||||
|
||||
//ClairLayerEnvelope ...
|
||||
type ClairLayerEnvelope struct {
|
||||
Layer *ClairLayer `json:"Layer,omitempty"`
|
||||
Error *ClairError `json:"Error,omitempty"`
|
||||
}
|
||||
|
||||
//ClairNotification ...
|
||||
type ClairNotification struct {
|
||||
Name string `json:"Name,omitempty"`
|
||||
Created string `json:"Created,omitempty"`
|
||||
Notified string `json:"Notified,omitempty"`
|
||||
Deleted string `json:"Deleted,omitempty"`
|
||||
Limit int `json:"Limit,omitempty"`
|
||||
Page string `json:"Page,omitempty"`
|
||||
NextPage string `json:"NextPage,omitempty"`
|
||||
Old *ClairVulnerabilityWithLayers `json:"Old,omitempty"`
|
||||
New *ClairVulnerabilityWithLayers `json:"New,omitempty"`
|
||||
}
|
||||
|
||||
//ClairNotificationEnvelope ...
|
||||
type ClairNotificationEnvelope struct {
|
||||
Notification *ClairNotification `json:"Notification,omitempty"`
|
||||
Error *ClairError `json:"Error,omitempty"`
|
||||
}
|
||||
|
||||
//ClairVulnerabilityWithLayers ...
|
||||
type ClairVulnerabilityWithLayers struct {
|
||||
Vulnerability *ClairVulnerability `json:"Vulnerability,omitempty"`
|
||||
OrderedLayersIntroducingVulnerability []ClairOrderedLayerName `json:"OrderedLayersIntroducingVulnerability,omitempty"`
|
||||
}
|
||||
|
||||
//ClairOrderedLayerName ...
|
||||
type ClairOrderedLayerName struct {
|
||||
Index int `json:"Index"`
|
||||
LayerName string `json:"LayerName"`
|
||||
}
|
||||
|
||||
//ClairVulnerabilityStatus reflects the readiness and freshness of vulnerability data in Clair,
|
||||
//which will be returned in response of systeminfo API.
|
||||
type ClairVulnerabilityStatus struct {
|
||||
OverallUTC int64 `json:"overall_last_update,omitempty"`
|
||||
Details []ClairNamespaceTimestamp `json:"details,omitempty"`
|
||||
}
|
||||
|
||||
//ClairNamespaceTimestamp is a record to store the clairname space and the timestamp,
|
||||
//in practice different namespace in Clair maybe merged into one, e.g. ubuntu:14.04 and ubuntu:16.4 maybe merged into ubuntu and put into response.
|
||||
type ClairNamespaceTimestamp struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Timestamp int64 `json:"last_update"`
|
||||
}
|
||||
|
||||
//ClairNamespace ...
|
||||
type ClairNamespace struct {
|
||||
Name string `json:"Name,omitempty"`
|
||||
VersionFormat string `json:"VersionFormat,omitempty"`
|
||||
}
|
||||
|
||||
//ClairNamespaceEnvelope ...
|
||||
type ClairNamespaceEnvelope struct {
|
||||
Namespaces *[]ClairNamespace `json:"Namespaces,omitempty"`
|
||||
Error *ClairError `json:"Error,omitempty"`
|
||||
}
|
107
src/vendor/github.com/vmware/harbor/src/common/models/config.go
generated
vendored
107
src/vendor/github.com/vmware/harbor/src/common/models/config.go
generated
vendored
@ -1,107 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
/*
|
||||
// Authentication ...
|
||||
type Authentication struct {
|
||||
Mode string `json:"mode"`
|
||||
SelfRegistration bool `json:"self_registration"`
|
||||
LDAP *LDAP `json:"ldap,omitempty"`
|
||||
}
|
||||
*/
|
||||
|
||||
// Database ...
|
||||
type Database struct {
|
||||
Type string `json:"type"`
|
||||
PostGreSQL *PostGreSQL `json:"postgresql,omitempty"`
|
||||
}
|
||||
|
||||
// MySQL ...
|
||||
type MySQL struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Database string `json:"database"`
|
||||
}
|
||||
|
||||
// SQLite ...
|
||||
type SQLite struct {
|
||||
File string `json:"file"`
|
||||
}
|
||||
|
||||
// PostGreSQL ...
|
||||
type PostGreSQL struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Database string `json:"database"`
|
||||
}
|
||||
|
||||
// Email ...
|
||||
type Email struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
SSL bool `json:"ssl"`
|
||||
Identity string `json:"identity"`
|
||||
From string `json:"from"`
|
||||
Insecure bool `json:"insecure"`
|
||||
}
|
||||
|
||||
/*
|
||||
// Registry ...
|
||||
type Registry struct {
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// TokenService ...
|
||||
type TokenService struct {
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// SystemCfg holds all configurations of system
|
||||
type SystemCfg struct {
|
||||
DomainName string `json:"domain_name"` // Harbor external URL: protocal://host:port
|
||||
Authentication *Authentication `json:"authentication"`
|
||||
Database *Database `json:"database"`
|
||||
TokenService *TokenService `json:"token_service"`
|
||||
Registry *Registry `json:"registry"`
|
||||
Email *Email `json:"email"`
|
||||
VerifyRemoteCert bool `json:"verify_remote_cert"`
|
||||
ProjectCreationRestriction string `json:"project_creation_restriction"`
|
||||
MaxJobWorkers int `json:"max_job_workers"`
|
||||
JobLogDir string `json:"job_log_dir"`
|
||||
InitialAdminPwd string `json:"initial_admin_pwd,omitempty"`
|
||||
TokenExpiration int `json:"token_expiration"` // in minute
|
||||
SecretKey string `json:"secret_key,omitempty"`
|
||||
CfgExpiration int `json:"cfg_expiration"`
|
||||
}
|
||||
*/
|
||||
|
||||
// ConfigEntry ...
|
||||
type ConfigEntry struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"-"`
|
||||
Key string `orm:"column(k)" json:"k"`
|
||||
Value string `orm:"column(v)" json:"v"`
|
||||
}
|
||||
|
||||
// TableName ...
|
||||
func (ce *ConfigEntry) TableName() string {
|
||||
return "properties"
|
||||
}
|
36
src/vendor/github.com/vmware/harbor/src/common/models/job.go
generated
vendored
36
src/vendor/github.com/vmware/harbor/src/common/models/job.go
generated
vendored
@ -1,36 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
const (
|
||||
//JobPending ...
|
||||
JobPending string = "pending"
|
||||
//JobRunning ...
|
||||
JobRunning string = "running"
|
||||
//JobError ...
|
||||
JobError string = "error"
|
||||
//JobStopped ...
|
||||
JobStopped string = "stopped"
|
||||
//JobFinished ...
|
||||
JobFinished string = "finished"
|
||||
//JobCanceled ...
|
||||
JobCanceled string = "canceled"
|
||||
//JobRetrying indicate the job needs to be retried, it will be scheduled to the end of job queue by statemachine after an interval.
|
||||
JobRetrying string = "retrying"
|
||||
//JobContinue is the status returned by statehandler to tell statemachine to move to next possible state based on trasition table.
|
||||
JobContinue string = "_continue"
|
||||
// JobScheduled ...
|
||||
JobScheduled string = "scheduled"
|
||||
)
|
92
src/vendor/github.com/vmware/harbor/src/common/models/label.go
generated
vendored
92
src/vendor/github.com/vmware/harbor/src/common/models/label.go
generated
vendored
@ -1,92 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/validation"
|
||||
"github.com/vmware/harbor/src/common"
|
||||
)
|
||||
|
||||
// Label holds information used for a label
|
||||
type Label struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
Name string `orm:"column(name)" json:"name"`
|
||||
Description string `orm:"column(description)" json:"description"`
|
||||
Color string `orm:"column(color)" json:"color"`
|
||||
Level string `orm:"column(level)" json:"-"`
|
||||
Scope string `orm:"column(scope)" json:"scope"`
|
||||
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
Deleted bool `orm:"column(deleted)" json:"deleted"`
|
||||
}
|
||||
|
||||
// TableName ...
|
||||
func (l *Label) TableName() string {
|
||||
return "harbor_label"
|
||||
}
|
||||
|
||||
// LabelQuery : query parameters for labels
|
||||
type LabelQuery struct {
|
||||
Name string
|
||||
FuzzyMatchName bool // the property is used to determine the query for lable name is fuzzy matching or exaxt matching
|
||||
Level string
|
||||
Scope string
|
||||
ProjectID int64
|
||||
Pagination
|
||||
}
|
||||
|
||||
// Valid ...
|
||||
func (l *Label) Valid(v *validation.Validation) {
|
||||
if len(l.Name) == 0 {
|
||||
v.SetError("name", "cannot be empty")
|
||||
}
|
||||
if len(l.Name) > 128 {
|
||||
v.SetError("name", "max length is 128")
|
||||
}
|
||||
|
||||
if l.Scope != common.LabelScopeGlobal && l.Scope != common.LabelScopeProject {
|
||||
v.SetError("scope", fmt.Sprintf("invalid: %s", l.Scope))
|
||||
} else if l.Scope == common.LabelScopeProject && l.ProjectID <= 0 {
|
||||
v.SetError("project_id", fmt.Sprintf("invalid: %d", l.ProjectID))
|
||||
}
|
||||
}
|
||||
|
||||
// ResourceLabel records the relationship between resource and label
|
||||
type ResourceLabel struct {
|
||||
ID int64 `orm:"pk;auto;column(id)"`
|
||||
LabelID int64 `orm:"column(label_id)"`
|
||||
ResourceID int64 `orm:"column(resource_id)"`
|
||||
ResourceName string `orm:"column(resource_name)"`
|
||||
ResourceType string `orm:"column(resource_type)"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now"`
|
||||
}
|
||||
|
||||
// TableName ...
|
||||
func (r *ResourceLabel) TableName() string {
|
||||
return "harbor_resource_label"
|
||||
}
|
||||
|
||||
// ResourceLabelQuery : query parameters for the mapping relationships of resource and label
|
||||
type ResourceLabelQuery struct {
|
||||
LabelID int64
|
||||
ResourceID int64
|
||||
ResourceName string
|
||||
ResourceType string
|
||||
}
|
63
src/vendor/github.com/vmware/harbor/src/common/models/ldap.go
generated
vendored
63
src/vendor/github.com/vmware/harbor/src/common/models/ldap.go
generated
vendored
@ -1,63 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
// LdapConf holds information about ldap configuration
|
||||
type LdapConf struct {
|
||||
LdapURL string `json:"ldap_url"`
|
||||
LdapSearchDn string `json:"ldap_search_dn"`
|
||||
LdapSearchPassword string `json:"ldap_search_password"`
|
||||
LdapBaseDn string `json:"ldap_base_dn"`
|
||||
LdapFilter string `json:"ldap_filter"`
|
||||
LdapUID string `json:"ldap_uid"`
|
||||
LdapScope int `json:"ldap_scope"`
|
||||
LdapConnectionTimeout int `json:"ldap_connection_timeout"`
|
||||
LdapVerifyCert bool `json:"ldap_verify_cert"`
|
||||
}
|
||||
|
||||
// LdapGroupConf holds information about ldap group
|
||||
type LdapGroupConf struct {
|
||||
LdapGroupBaseDN string `json:"ldap_group_base_dn,omitempty"`
|
||||
LdapGroupFilter string `json:"ldap_group_filter,omitempty"`
|
||||
LdapGroupNameAttribute string `json:"ldap_group_name_attribute,omitempty"`
|
||||
LdapGroupSearchScope int `json:"ldap_group_search_scope"`
|
||||
LdapGroupAdminDN string `json:"ldap_group_admin_dn,omitempty"`
|
||||
}
|
||||
|
||||
// LdapUser ...
|
||||
type LdapUser struct {
|
||||
Username string `json:"ldap_username"`
|
||||
Email string `json:"ldap_email"`
|
||||
Realname string `json:"ldap_realname"`
|
||||
DN string `json:"-"`
|
||||
GroupDNList []string `json:"ldap_groupdn"`
|
||||
}
|
||||
|
||||
//LdapImportUser ...
|
||||
type LdapImportUser struct {
|
||||
LdapUIDList []string `json:"ldap_uid_list"`
|
||||
}
|
||||
|
||||
// LdapFailedImportUser ...
|
||||
type LdapFailedImportUser struct {
|
||||
UID string `json:"uid"`
|
||||
Error string `json:"err_msg"`
|
||||
}
|
||||
|
||||
// LdapGroup ...
|
||||
type LdapGroup struct {
|
||||
GroupName string `json:"group_name,omitempty"`
|
||||
GroupDN string `json:"ldap_group_dn,omitempty"`
|
||||
}
|
42
src/vendor/github.com/vmware/harbor/src/common/models/member.go
generated
vendored
42
src/vendor/github.com/vmware/harbor/src/common/models/member.go
generated
vendored
@ -1,42 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
// Member holds the details of a member.
|
||||
type Member struct {
|
||||
ID int `orm:"pk;column(id)" json:"id"`
|
||||
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
||||
Entityname string `orm:"column(entity_name)" json:"entity_name"`
|
||||
Rolename string `json:"role_name"`
|
||||
Role int `json:"role_id"`
|
||||
EntityID int `orm:"column(entity_id)" json:"entity_id"`
|
||||
EntityType string `orm:"column(entity_type)" json:"entity_type"`
|
||||
}
|
||||
|
||||
// UserMember ...
|
||||
type UserMember struct {
|
||||
ID int `orm:"pk;column(user_id)" json:"user_id"`
|
||||
Username string `json:"username"`
|
||||
Rolename string `json:"role_name"`
|
||||
Role int `json:"role_id"`
|
||||
}
|
||||
|
||||
// MemberReq - Create Project Member Request
|
||||
type MemberReq struct {
|
||||
ProjectID int64 `json:"project_id"`
|
||||
Role int `json:"role_id,omitempty"`
|
||||
MemberUser User `json:"member_user,omitempty"`
|
||||
MemberGroup UserGroup `json:"member_group,omitempty"`
|
||||
}
|
55
src/vendor/github.com/vmware/harbor/src/common/models/notification.go
generated
vendored
55
src/vendor/github.com/vmware/harbor/src/common/models/notification.go
generated
vendored
@ -1,55 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Notification holds all events.
|
||||
type Notification struct {
|
||||
Events []Event
|
||||
}
|
||||
|
||||
// Event holds the details of a event.
|
||||
type Event struct {
|
||||
ID string `json:"Id"`
|
||||
TimeStamp time.Time
|
||||
Action string
|
||||
Target *Target
|
||||
Request *Request
|
||||
Actor *Actor
|
||||
}
|
||||
|
||||
// Target holds information about the target of a event.
|
||||
type Target struct {
|
||||
MediaType string
|
||||
Digest string
|
||||
Repository string
|
||||
URL string `json:"Url"`
|
||||
Tag string
|
||||
}
|
||||
|
||||
// Actor holds information about actor.
|
||||
type Actor struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// Request holds information about a request.
|
||||
type Request struct {
|
||||
ID string `json:"Id"`
|
||||
Method string
|
||||
UserAgent string
|
||||
}
|
44
src/vendor/github.com/vmware/harbor/src/common/models/pro_meta.go
generated
vendored
44
src/vendor/github.com/vmware/harbor/src/common/models/pro_meta.go
generated
vendored
@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// keys of project metadata and severity values
|
||||
const (
|
||||
ProMetaPublic = "public"
|
||||
ProMetaEnableContentTrust = "enable_content_trust"
|
||||
ProMetaPreventVul = "prevent_vul" //prevent vulnerable images from being pulled
|
||||
ProMetaSeverity = "severity"
|
||||
ProMetaAutoScan = "auto_scan"
|
||||
SeverityNone = "negligible"
|
||||
SeverityLow = "low"
|
||||
SeverityMedium = "medium"
|
||||
SeverityHigh = "high"
|
||||
SeverityCritical = "critical"
|
||||
)
|
||||
|
||||
// ProjectMetadata holds the metadata of a project.
|
||||
type ProjectMetadata struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
||||
Name string `orm:"column(name)" json:"name"`
|
||||
Value string `orm:"column(value)" json:"value"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
Deleted bool `orm:"column(deleted)" json:"deleted"`
|
||||
}
|
165
src/vendor/github.com/vmware/harbor/src/common/models/project.go
generated
vendored
165
src/vendor/github.com/vmware/harbor/src/common/models/project.go
generated
vendored
@ -1,165 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ProjectTable is the table name for project
|
||||
const ProjectTable = "project"
|
||||
|
||||
// Project holds the details of a project.
|
||||
type Project struct {
|
||||
ProjectID int64 `orm:"pk;auto;column(project_id)" json:"project_id"`
|
||||
OwnerID int `orm:"column(owner_id)" json:"owner_id"`
|
||||
Name string `orm:"column(name)" json:"name"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
Deleted bool `orm:"column(deleted)" json:"deleted"`
|
||||
OwnerName string `orm:"-" json:"owner_name"`
|
||||
Togglable bool `orm:"-" json:"togglable"`
|
||||
Role int `orm:"-" json:"current_user_role_id"`
|
||||
RepoCount int64 `orm:"-" json:"repo_count"`
|
||||
Metadata map[string]string `orm:"-" json:"metadata"`
|
||||
}
|
||||
|
||||
// GetMetadata ...
|
||||
func (p *Project) GetMetadata(key string) (string, bool) {
|
||||
if len(p.Metadata) == 0 {
|
||||
return "", false
|
||||
}
|
||||
value, exist := p.Metadata[key]
|
||||
return value, exist
|
||||
}
|
||||
|
||||
// SetMetadata ...
|
||||
func (p *Project) SetMetadata(key, value string) {
|
||||
if p.Metadata == nil {
|
||||
p.Metadata = map[string]string{}
|
||||
}
|
||||
p.Metadata[key] = value
|
||||
}
|
||||
|
||||
// IsPublic ...
|
||||
func (p *Project) IsPublic() bool {
|
||||
public, exist := p.GetMetadata(ProMetaPublic)
|
||||
if !exist {
|
||||
return false
|
||||
}
|
||||
|
||||
return isTrue(public)
|
||||
}
|
||||
|
||||
// ContentTrustEnabled ...
|
||||
func (p *Project) ContentTrustEnabled() bool {
|
||||
enabled, exist := p.GetMetadata(ProMetaEnableContentTrust)
|
||||
if !exist {
|
||||
return false
|
||||
}
|
||||
return isTrue(enabled)
|
||||
}
|
||||
|
||||
// VulPrevented ...
|
||||
func (p *Project) VulPrevented() bool {
|
||||
prevent, exist := p.GetMetadata(ProMetaPreventVul)
|
||||
if !exist {
|
||||
return false
|
||||
}
|
||||
return isTrue(prevent)
|
||||
}
|
||||
|
||||
// Severity ...
|
||||
func (p *Project) Severity() string {
|
||||
severity, exist := p.GetMetadata(ProMetaSeverity)
|
||||
if !exist {
|
||||
return ""
|
||||
}
|
||||
return severity
|
||||
}
|
||||
|
||||
// AutoScan ...
|
||||
func (p *Project) AutoScan() bool {
|
||||
auto, exist := p.GetMetadata(ProMetaAutoScan)
|
||||
if !exist {
|
||||
return false
|
||||
}
|
||||
return isTrue(auto)
|
||||
}
|
||||
|
||||
func isTrue(value string) bool {
|
||||
return strings.ToLower(value) == "true" ||
|
||||
strings.ToLower(value) == "1"
|
||||
}
|
||||
|
||||
// ProjectQueryParam can be used to set query parameters when listing projects.
|
||||
// The query condition will be set in the query if its corresponding field
|
||||
// is not nil. Leave it empty if you don't want to apply this condition.
|
||||
//
|
||||
// e.g.
|
||||
// List all projects: query := nil
|
||||
// List all public projects: query := &QueryParam{Public: true}
|
||||
// List projects the owner of which is user1: query := &QueryParam{Owner:"user1"}
|
||||
// List all public projects the owner of which is user1: query := &QueryParam{Owner:"user1",Public:true}
|
||||
// List projects which user1 is member of: query := &QueryParam{Member:&Member{Name:"user1"}}
|
||||
// List projects which user1 is the project admin : query := &QueryParam{Memeber:&Member{Name:"user1",Role:1}}
|
||||
type ProjectQueryParam struct {
|
||||
Name string // the name of project
|
||||
Owner string // the username of project owner
|
||||
Public *bool // the project is public or not, can be ture, false and nil
|
||||
Member *MemberQuery // the member of project
|
||||
Pagination *Pagination // pagination information
|
||||
ProjectIDs []int64 // project ID list
|
||||
}
|
||||
|
||||
// MemberQuery fitler by member's username and role
|
||||
type MemberQuery struct {
|
||||
Name string // the username of member
|
||||
Role int // the role of the member has to the project
|
||||
GroupList []*UserGroup // the group list of current user
|
||||
}
|
||||
|
||||
// Pagination ...
|
||||
type Pagination struct {
|
||||
Page int64
|
||||
Size int64
|
||||
}
|
||||
|
||||
// BaseProjectCollection contains the query conditions which can be used
|
||||
// to get a project collection. The collection can be used as the base to
|
||||
// do other filter
|
||||
type BaseProjectCollection struct {
|
||||
Public bool
|
||||
Member string
|
||||
}
|
||||
|
||||
// ProjectRequest holds informations that need for creating project API
|
||||
type ProjectRequest struct {
|
||||
Name string `json:"project_name"`
|
||||
Public *int `json:"public"` //deprecated, reserved for project creation in replication
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
// ProjectQueryResult ...
|
||||
type ProjectQueryResult struct {
|
||||
Total int64
|
||||
Projects []*Project
|
||||
}
|
||||
|
||||
//TableName is required by beego orm to map Project to table project
|
||||
func (p *Project) TableName() string {
|
||||
return ProjectTable
|
||||
}
|
135
src/vendor/github.com/vmware/harbor/src/common/models/replication_job.go
generated
vendored
135
src/vendor/github.com/vmware/harbor/src/common/models/replication_job.go
generated
vendored
@ -1,135 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/validation"
|
||||
"github.com/vmware/harbor/src/common/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
//RepOpTransfer represents the operation of a job to transfer repository to a remote registry/harbor instance.
|
||||
RepOpTransfer string = "transfer"
|
||||
//RepOpDelete represents the operation of a job to remove repository from a remote registry/harbor instance.
|
||||
RepOpDelete string = "delete"
|
||||
//RepOpSchedule represents the operation of a job to schedule the real replication process
|
||||
RepOpSchedule string = "schedule"
|
||||
//RepTargetTable is the table name for replication targets
|
||||
RepTargetTable = "replication_target"
|
||||
//RepJobTable is the table name for replication jobs
|
||||
RepJobTable = "replication_job"
|
||||
//RepPolicyTable is table name for replication policies
|
||||
RepPolicyTable = "replication_policy"
|
||||
)
|
||||
|
||||
// RepPolicy is the model for a replication policy, which associate to a project and a target (destination)
|
||||
type RepPolicy struct {
|
||||
ID int64 `orm:"pk;auto;column(id)"`
|
||||
ProjectID int64 `orm:"column(project_id)" `
|
||||
TargetID int64 `orm:"column(target_id)"`
|
||||
Name string `orm:"column(name)"`
|
||||
Description string `orm:"column(description)"`
|
||||
Trigger string `orm:"column(cron_str)"`
|
||||
Filters string `orm:"column(filters)"`
|
||||
ReplicateDeletion bool `orm:"column(replicate_deletion)"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now"`
|
||||
Deleted bool `orm:"column(deleted)"`
|
||||
}
|
||||
|
||||
// RepJob is the model for a replication job, which is the execution unit on job service, currently it is used to transfer/remove
|
||||
// a repository to/from a remote registry instance.
|
||||
type RepJob struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
Status string `orm:"column(status)" json:"status"`
|
||||
Repository string `orm:"column(repository)" json:"repository"`
|
||||
PolicyID int64 `orm:"column(policy_id)" json:"policy_id"`
|
||||
Operation string `orm:"column(operation)" json:"operation"`
|
||||
Tags string `orm:"column(tags)" json:"-"`
|
||||
TagList []string `orm:"-" json:"tags"`
|
||||
UUID string `orm:"column(job_uuid)" json:"-"`
|
||||
// Policy RepPolicy `orm:"-" json:"policy"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
}
|
||||
|
||||
// RepTarget is the model for a replication targe, i.e. destination, which wraps the endpoint URL and username/password of a remote registry.
|
||||
type RepTarget struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
URL string `orm:"column(url)" json:"endpoint"`
|
||||
Name string `orm:"column(name)" json:"name"`
|
||||
Username string `orm:"column(username)" json:"username"`
|
||||
Password string `orm:"column(password)" json:"password"`
|
||||
Type int `orm:"column(target_type)" json:"type"`
|
||||
Insecure bool `orm:"column(insecure)" json:"insecure"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
}
|
||||
|
||||
// Valid ...
|
||||
func (r *RepTarget) Valid(v *validation.Validation) {
|
||||
if len(r.Name) == 0 {
|
||||
v.SetError("name", "can not be empty")
|
||||
}
|
||||
|
||||
if len(r.Name) > 64 {
|
||||
v.SetError("name", "max length is 64")
|
||||
}
|
||||
|
||||
url, err := utils.ParseEndpoint(r.URL)
|
||||
if err != nil {
|
||||
v.SetError("endpoint", err.Error())
|
||||
} else {
|
||||
// Prevent SSRF security issue #3755
|
||||
r.URL = url.Scheme + "://" + url.Host + url.Path
|
||||
if len(r.URL) > 64 {
|
||||
v.SetError("endpoint", "max length is 64")
|
||||
}
|
||||
}
|
||||
|
||||
// password is encoded using base64, the length of this field
|
||||
// in DB is 64, so the max length in request is 48
|
||||
if len(r.Password) > 48 {
|
||||
v.SetError("password", "max length is 48")
|
||||
}
|
||||
}
|
||||
|
||||
//TableName is required by by beego orm to map RepTarget to table replication_target
|
||||
func (r *RepTarget) TableName() string {
|
||||
return RepTargetTable
|
||||
}
|
||||
|
||||
//TableName is required by by beego orm to map RepJob to table replication_job
|
||||
func (r *RepJob) TableName() string {
|
||||
return RepJobTable
|
||||
}
|
||||
|
||||
//TableName is required by by beego orm to map RepPolicy to table replication_policy
|
||||
func (r *RepPolicy) TableName() string {
|
||||
return RepPolicyTable
|
||||
}
|
||||
|
||||
// RepJobQuery holds query conditions for replication job
|
||||
type RepJobQuery struct {
|
||||
PolicyID int64
|
||||
Repository string
|
||||
Statuses []string
|
||||
Operations []string
|
||||
StartTime *time.Time
|
||||
EndTime *time.Time
|
||||
Pagination
|
||||
}
|
48
src/vendor/github.com/vmware/harbor/src/common/models/repo.go
generated
vendored
48
src/vendor/github.com/vmware/harbor/src/common/models/repo.go
generated
vendored
@ -1,48 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//RepoTable is the table name for repository
|
||||
const RepoTable = "repository"
|
||||
|
||||
// RepoRecord holds the record of an repository in DB, all the infors are from the registry notification event.
|
||||
type RepoRecord struct {
|
||||
RepositoryID int64 `orm:"pk;auto;column(repository_id)" json:"repository_id"`
|
||||
Name string `orm:"column(name)" json:"name"`
|
||||
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
||||
Description string `orm:"column(description)" json:"description"`
|
||||
PullCount int64 `orm:"column(pull_count)" json:"pull_count"`
|
||||
StarCount int64 `orm:"column(star_count)" json:"star_count"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
}
|
||||
|
||||
//TableName is required by by beego orm to map RepoRecord to table repository
|
||||
func (rp *RepoRecord) TableName() string {
|
||||
return RepoTable
|
||||
}
|
||||
|
||||
// RepositoryQuery : query parameters for repository
|
||||
type RepositoryQuery struct {
|
||||
Name string
|
||||
ProjectIDs []int64
|
||||
ProjectName string
|
||||
LabelID int64
|
||||
Pagination
|
||||
}
|
33
src/vendor/github.com/vmware/harbor/src/common/models/role.go
generated
vendored
33
src/vendor/github.com/vmware/harbor/src/common/models/role.go
generated
vendored
@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
const (
|
||||
//PROJECTADMIN project administrator
|
||||
PROJECTADMIN = 1
|
||||
//DEVELOPER developer
|
||||
DEVELOPER = 2
|
||||
//GUEST guest
|
||||
GUEST = 3
|
||||
)
|
||||
|
||||
// Role holds the details of a role.
|
||||
type Role struct {
|
||||
RoleID int `orm:"pk;auto;column(role_id)" json:"role_id"`
|
||||
RoleCode string `orm:"column(role_code)" json:"role_code"`
|
||||
Name string `orm:"column(name)" json:"role_name"`
|
||||
|
||||
RoleMask int `orm:"column(role_mask)" json:"role_mask"`
|
||||
}
|
138
src/vendor/github.com/vmware/harbor/src/common/models/scan_job.go
generated
vendored
138
src/vendor/github.com/vmware/harbor/src/common/models/scan_job.go
generated
vendored
@ -1,138 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
//ScanJobTable is the name of the table whose data is mapped by ScanJob struct.
|
||||
const ScanJobTable = "img_scan_job"
|
||||
|
||||
//ScanOverviewTable is the name of the table whose data is mapped by ImgScanOverview struct.
|
||||
const ScanOverviewTable = "img_scan_overview"
|
||||
|
||||
//ScanJob is the model to represent a job for image scan in DB.
|
||||
type ScanJob struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
Status string `orm:"column(status)" json:"status"`
|
||||
Repository string `orm:"column(repository)" json:"repository"`
|
||||
Tag string `orm:"column(tag)" json:"tag"`
|
||||
Digest string `orm:"column(digest)" json:"digest"`
|
||||
UUID string `orm:"column(job_uuid)" json:"-"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
}
|
||||
|
||||
// Severity represents the severity of a image/component in terms of vulnerability.
|
||||
type Severity int64
|
||||
|
||||
// Sevxxx is the list of severity of image after scanning.
|
||||
const (
|
||||
_ Severity = iota
|
||||
SevNone
|
||||
SevUnknown
|
||||
SevLow
|
||||
SevMedium
|
||||
SevHigh
|
||||
)
|
||||
|
||||
//String is the output function for sererity variable
|
||||
func (sev Severity) String() string {
|
||||
name := []string{"negligible", "unknown", "low", "medium", "high"}
|
||||
i := int64(sev)
|
||||
switch {
|
||||
case i >= 1 && i <= int64(SevHigh):
|
||||
return name[i-1]
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
//TableName is required by by beego orm to map ScanJob to table img_scan_job
|
||||
func (s *ScanJob) TableName() string {
|
||||
return ScanJobTable
|
||||
}
|
||||
|
||||
//ImgScanOverview mapped to a record of image scan overview.
|
||||
type ImgScanOverview struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"-"`
|
||||
Digest string `orm:"column(image_digest)" json:"image_digest"`
|
||||
Status string `orm:"-" json:"scan_status"`
|
||||
JobID int64 `orm:"column(scan_job_id)" json:"job_id"`
|
||||
Sev int `orm:"column(severity)" json:"severity"`
|
||||
CompOverviewStr string `orm:"column(components_overview)" json:"-"`
|
||||
CompOverview *ComponentsOverview `orm:"-" json:"components,omitempty"`
|
||||
DetailsKey string `orm:"column(details_key)" json:"details_key"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time,omitempty"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time,omitempty"`
|
||||
}
|
||||
|
||||
//TableName ...
|
||||
func (iso *ImgScanOverview) TableName() string {
|
||||
return ScanOverviewTable
|
||||
}
|
||||
|
||||
//ComponentsOverview has the total number and a list of components number of different serverity level.
|
||||
type ComponentsOverview struct {
|
||||
Total int `json:"total"`
|
||||
Summary []*ComponentsOverviewEntry `json:"summary"`
|
||||
}
|
||||
|
||||
//ComponentsOverviewEntry ...
|
||||
type ComponentsOverviewEntry struct {
|
||||
Sev int `json:"severity"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
// ImageScanReq represents the request body to send to job service for image scan
|
||||
type ImageScanReq struct {
|
||||
Repo string `json:"repository"`
|
||||
Tag string `json:"tag"`
|
||||
}
|
||||
|
||||
// VulnerabilityItem is an item in the vulnerability result returned by vulnerability details API.
|
||||
type VulnerabilityItem struct {
|
||||
ID string `json:"id"`
|
||||
Severity Severity `json:"severity"`
|
||||
Pkg string `json:"package"`
|
||||
Version string `json:"version"`
|
||||
Description string `json:"description"`
|
||||
Link string `json:"link"`
|
||||
Fixed string `json:"fixedVersion,omitempty"`
|
||||
}
|
||||
|
||||
// ScanAllPolicy is represent the json request and object for scan all policy, the parm is het
|
||||
type ScanAllPolicy struct {
|
||||
Type string `json:"type"`
|
||||
Parm map[string]interface{} `json:"parameter, omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
// ScanAllNone "none" for not doing any scan all
|
||||
ScanAllNone = "none"
|
||||
// ScanAllDaily for doing scan all daily
|
||||
ScanAllDaily = "daily"
|
||||
// ScanAllOnRefresh for doing scan all when the Clair DB is refreshed.
|
||||
ScanAllOnRefresh = "on_refresh"
|
||||
// ScanAllDailyTime the key for parm of daily scan all policy.
|
||||
ScanAllDailyTime = "daily_time"
|
||||
)
|
||||
|
||||
//DefaultScanAllPolicy ...
|
||||
var DefaultScanAllPolicy = ScanAllPolicy{
|
||||
Type: ScanAllDaily,
|
||||
Parm: map[string]interface{}{
|
||||
ScanAllDailyTime: 0,
|
||||
},
|
||||
}
|
22
src/vendor/github.com/vmware/harbor/src/common/models/token.go
generated
vendored
22
src/vendor/github.com/vmware/harbor/src/common/models/token.go
generated
vendored
@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
// Token represents the json returned by registry token service
|
||||
type Token struct {
|
||||
Token string `json:"token"`
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
IssuedAt string `json:"issued_at"`
|
||||
}
|
23
src/vendor/github.com/vmware/harbor/src/common/models/uaa.go
generated
vendored
23
src/vendor/github.com/vmware/harbor/src/common/models/uaa.go
generated
vendored
@ -1,23 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
//UAASettings wraps the configuraations to access UAA service
|
||||
type UAASettings struct {
|
||||
Endpoint string
|
||||
ClientID string
|
||||
ClientSecret string
|
||||
VerifyCert bool
|
||||
}
|
56
src/vendor/github.com/vmware/harbor/src/common/models/user.go
generated
vendored
56
src/vendor/github.com/vmware/harbor/src/common/models/user.go
generated
vendored
@ -1,56 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// UserTable is the name of table in DB that holds the user object
|
||||
const UserTable = "harbor_user"
|
||||
|
||||
// User holds the details of a user.
|
||||
type User struct {
|
||||
UserID int `orm:"pk;auto;column(user_id)" json:"user_id"`
|
||||
Username string `orm:"column(username)" json:"username"`
|
||||
Email string `orm:"column(email)" json:"email"`
|
||||
Password string `orm:"column(password)" json:"password"`
|
||||
Realname string `orm:"column(realname)" json:"realname"`
|
||||
Comment string `orm:"column(comment)" json:"comment"`
|
||||
Deleted bool `orm:"column(deleted)" json:"deleted"`
|
||||
Rolename string `orm:"-" json:"role_name"`
|
||||
//if this field is named as "RoleID", beego orm can not map role_id
|
||||
//to it.
|
||||
Role int `orm:"-" json:"role_id"`
|
||||
// RoleList []Role `json:"role_list"`
|
||||
HasAdminRole bool `orm:"column(sysadmin_flag)" json:"has_admin_role"`
|
||||
ResetUUID string `orm:"column(reset_uuid)" json:"reset_uuid"`
|
||||
Salt string `orm:"column(salt)" json:"-"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
GroupList []*UserGroup `orm:"-" json:"-"`
|
||||
}
|
||||
|
||||
// UserQuery ...
|
||||
type UserQuery struct {
|
||||
Username string
|
||||
Email string
|
||||
Pagination *Pagination
|
||||
}
|
||||
|
||||
// TableName ...
|
||||
func (u *User) TableName() string {
|
||||
return UserTable
|
||||
}
|
31
src/vendor/github.com/vmware/harbor/src/common/models/usergroup.go
generated
vendored
31
src/vendor/github.com/vmware/harbor/src/common/models/usergroup.go
generated
vendored
@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
// UserGroupTable is the name of table in DB that holds the user object
|
||||
const UserGroupTable = "user_group"
|
||||
|
||||
// UserGroup ...
|
||||
type UserGroup struct {
|
||||
ID int `orm:"pk;auto;column(id)" json:"id,omitempty"`
|
||||
GroupName string `orm:"column(group_name)" json:"group_name,omitempty"`
|
||||
GroupType int `orm:"column(group_type)" json:"group_type,omitempty"`
|
||||
LdapGroupDN string `orm:"column(ldap_group_dn)" json:"ldap_group_dn,omitempty"`
|
||||
}
|
||||
|
||||
// TableName ...
|
||||
func (u *UserGroup) TableName() string {
|
||||
return UserGroupTable
|
||||
}
|
20
src/vendor/github.com/vmware/harbor/src/common/models/version.go
generated
vendored
20
src/vendor/github.com/vmware/harbor/src/common/models/version.go
generated
vendored
@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
// SchemaVersion is the version of database schema
|
||||
type SchemaVersion struct {
|
||||
Version string `json:"version" orm:"column(version_num)"`
|
||||
}
|
35
src/vendor/github.com/vmware/harbor/src/common/models/watch_item.go
generated
vendored
35
src/vendor/github.com/vmware/harbor/src/common/models/watch_item.go
generated
vendored
@ -1,35 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// WatchItem ...
|
||||
type WatchItem struct {
|
||||
ID int64 `orm:"pk;auto;column(id)" json:"id"`
|
||||
PolicyID int64 `orm:"column(policy_id)" json:"policy_id"`
|
||||
Namespace string `orm:"column(namespace)" json:"namespace"`
|
||||
OnDeletion bool `orm:"column(on_deletion)" json:"on_deletion"`
|
||||
OnPush bool `orm:"column(on_push)" json:"on_push"`
|
||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||
}
|
||||
|
||||
//TableName ...
|
||||
func (w *WatchItem) TableName() string {
|
||||
return "replication_immediate_trigger"
|
||||
}
|
99
src/vendor/github.com/vmware/harbor/src/common/utils/encrypt.go
generated
vendored
99
src/vendor/github.com/vmware/harbor/src/common/utils/encrypt.go
generated
vendored
@ -1,99 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/rand"
|
||||
"crypto/sha1"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
)
|
||||
|
||||
// Encrypt encrypts the content with salt
|
||||
func Encrypt(content string, salt string) string {
|
||||
return fmt.Sprintf("%x", pbkdf2.Key([]byte(content), []byte(salt), 4096, 16, sha1.New))
|
||||
}
|
||||
|
||||
const (
|
||||
// EncryptHeaderV1 ...
|
||||
EncryptHeaderV1 = "<enc-v1>"
|
||||
)
|
||||
|
||||
// ReversibleEncrypt encrypts the str with aes/base64
|
||||
func ReversibleEncrypt(str, key string) (string, error) {
|
||||
keyBytes := []byte(key)
|
||||
var block cipher.Block
|
||||
var err error
|
||||
|
||||
if block, err = aes.NewCipher(keyBytes); err != nil {
|
||||
return "", err
|
||||
}
|
||||
cipherText := make([]byte, aes.BlockSize+len(str))
|
||||
iv := cipherText[:aes.BlockSize]
|
||||
if _, err = io.ReadFull(rand.Reader, iv); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cfb := cipher.NewCFBEncrypter(block, iv)
|
||||
cfb.XORKeyStream(cipherText[aes.BlockSize:], []byte(str))
|
||||
encrypted := EncryptHeaderV1 + base64.StdEncoding.EncodeToString(cipherText)
|
||||
return encrypted, nil
|
||||
}
|
||||
|
||||
// ReversibleDecrypt decrypts the str with aes/base64 or base 64 depending on "header"
|
||||
func ReversibleDecrypt(str, key string) (string, error) {
|
||||
if strings.HasPrefix(str, EncryptHeaderV1) {
|
||||
str = str[len(EncryptHeaderV1):]
|
||||
return decryptAES(str, key)
|
||||
}
|
||||
//fallback to base64
|
||||
return decodeB64(str)
|
||||
}
|
||||
|
||||
func decodeB64(str string) (string, error) {
|
||||
cipherText, err := base64.StdEncoding.DecodeString(str)
|
||||
return string(cipherText), err
|
||||
}
|
||||
|
||||
func decryptAES(str, key string) (string, error) {
|
||||
keyBytes := []byte(key)
|
||||
var block cipher.Block
|
||||
var cipherText []byte
|
||||
var err error
|
||||
|
||||
if block, err = aes.NewCipher(keyBytes); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if cipherText, err = base64.StdEncoding.DecodeString(str); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(cipherText) < aes.BlockSize {
|
||||
err = errors.New("cipherText too short")
|
||||
return "", err
|
||||
}
|
||||
|
||||
iv := cipherText[:aes.BlockSize]
|
||||
cipherText = cipherText[aes.BlockSize:]
|
||||
cfb := cipher.NewCFBDecrypter(block, iv)
|
||||
cfb.XORKeyStream(cipherText, cipherText)
|
||||
return string(cipherText), nil
|
||||
}
|
94
src/vendor/github.com/vmware/harbor/src/common/utils/link.go
generated
vendored
94
src/vendor/github.com/vmware/harbor/src/common/utils/link.go
generated
vendored
@ -1,94 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Link : HTTP link header
|
||||
type Link struct {
|
||||
// URL : url part of header
|
||||
URL string
|
||||
// Rel : prev or next
|
||||
Rel string
|
||||
}
|
||||
|
||||
// Links : multiple link
|
||||
type Links []*Link
|
||||
|
||||
// Prev returns the URL indicated by "prev" rel.
|
||||
func (l Links) Prev() string {
|
||||
prev := ""
|
||||
for _, link := range l {
|
||||
if strings.ToLower(link.Rel) == "prev" {
|
||||
prev = link.URL
|
||||
break
|
||||
}
|
||||
}
|
||||
return prev
|
||||
}
|
||||
|
||||
// Next returns the URL indicated by "next" rel.
|
||||
func (l Links) Next() string {
|
||||
next := ""
|
||||
for _, link := range l {
|
||||
if link.Rel == "next" {
|
||||
next = link.URL
|
||||
break
|
||||
}
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
// ParseLink parses the raw link header to Links
|
||||
func ParseLink(raw string) Links {
|
||||
links := Links{}
|
||||
|
||||
for _, l := range strings.Split(raw, ",") {
|
||||
link := parseSingleLink(l)
|
||||
if link != nil {
|
||||
links = append(links, link)
|
||||
}
|
||||
}
|
||||
|
||||
return links
|
||||
}
|
||||
|
||||
func parseSingleLink(raw string) *Link {
|
||||
link := &Link{}
|
||||
|
||||
for _, str := range strings.Split(raw, ";") {
|
||||
str = strings.TrimSpace(str)
|
||||
if strings.HasPrefix(str, "<") && strings.HasSuffix(str, ">") {
|
||||
str = strings.Trim(str, "<>")
|
||||
link.URL = str
|
||||
continue
|
||||
}
|
||||
|
||||
parts := strings.SplitN(str, "=", 2)
|
||||
if len(parts) != 2 || strings.ToLower(parts[0]) != "rel" {
|
||||
continue
|
||||
}
|
||||
|
||||
link.Rel = strings.ToLower(strings.Trim(parts[1], "\""))
|
||||
}
|
||||
|
||||
if len(link.URL) == 0 || len(link.Rel) == 0 {
|
||||
link = nil
|
||||
}
|
||||
|
||||
return link
|
||||
}
|
20
src/vendor/github.com/vmware/harbor/src/common/utils/log/formatter.go
generated
vendored
20
src/vendor/github.com/vmware/harbor/src/common/utils/log/formatter.go
generated
vendored
@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package log
|
||||
|
||||
// Formatter formats records in different ways: text, json, etc.
|
||||
type Formatter interface {
|
||||
Format(*Record) ([]byte, error)
|
||||
}
|
75
src/vendor/github.com/vmware/harbor/src/common/utils/log/level.go
generated
vendored
75
src/vendor/github.com/vmware/harbor/src/common/utils/log/level.go
generated
vendored
@ -1,75 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package log
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Level ...
|
||||
type Level int
|
||||
|
||||
const (
|
||||
// DebugLevel debug
|
||||
DebugLevel Level = iota
|
||||
// InfoLevel info
|
||||
InfoLevel
|
||||
// WarningLevel warning
|
||||
WarningLevel
|
||||
// ErrorLevel error
|
||||
ErrorLevel
|
||||
// FatalLevel fatal
|
||||
FatalLevel
|
||||
)
|
||||
|
||||
func (l Level) string() (lvl string) {
|
||||
switch l {
|
||||
case DebugLevel:
|
||||
lvl = "DEBUG"
|
||||
case InfoLevel:
|
||||
lvl = "INFO"
|
||||
case WarningLevel:
|
||||
lvl = "WARNING"
|
||||
case ErrorLevel:
|
||||
lvl = "ERROR"
|
||||
case FatalLevel:
|
||||
lvl = "FATAL"
|
||||
default:
|
||||
lvl = "UNKNOWN"
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func parseLevel(lvl string) (level Level, err error) {
|
||||
|
||||
switch strings.ToLower(lvl) {
|
||||
case "debug":
|
||||
level = DebugLevel
|
||||
case "info":
|
||||
level = InfoLevel
|
||||
case "warning":
|
||||
level = WarningLevel
|
||||
case "error":
|
||||
level = ErrorLevel
|
||||
case "fatal":
|
||||
level = FatalLevel
|
||||
default:
|
||||
err = fmt.Errorf("invalid log level: %s", lvl)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
279
src/vendor/github.com/vmware/harbor/src/common/utils/log/logger.go
generated
vendored
279
src/vendor/github.com/vmware/harbor/src/common/utils/log/logger.go
generated
vendored
@ -1,279 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package log
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var logger = New(os.Stdout, NewTextFormatter(), WarningLevel)
|
||||
|
||||
func init() {
|
||||
logger.callDepth = 4
|
||||
|
||||
lvl := os.Getenv("LOG_LEVEL")
|
||||
if len(lvl) == 0 {
|
||||
logger.SetLevel(InfoLevel)
|
||||
return
|
||||
}
|
||||
|
||||
level, err := parseLevel(lvl)
|
||||
if err != nil {
|
||||
logger.SetLevel(InfoLevel)
|
||||
return
|
||||
}
|
||||
|
||||
logger.SetLevel(level)
|
||||
|
||||
}
|
||||
|
||||
// Logger provides a struct with fields that describe the details of logger.
|
||||
type Logger struct {
|
||||
out io.Writer
|
||||
fmtter Formatter
|
||||
lvl Level
|
||||
callDepth int
|
||||
skipLine bool
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// New returns a customized Logger
|
||||
func New(out io.Writer, fmtter Formatter, lvl Level) *Logger {
|
||||
return &Logger{
|
||||
out: out,
|
||||
fmtter: fmtter,
|
||||
lvl: lvl,
|
||||
callDepth: 3,
|
||||
}
|
||||
}
|
||||
|
||||
//DefaultLogger returns the default logger within the pkg, i.e. the one used in log.Infof....
|
||||
func DefaultLogger() *Logger {
|
||||
return logger
|
||||
}
|
||||
|
||||
//SetOutput sets the output of Logger l
|
||||
func (l *Logger) SetOutput(out io.Writer) {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
l.out = out
|
||||
}
|
||||
|
||||
//SetFormatter sets the formatter of Logger l
|
||||
func (l *Logger) SetFormatter(fmtter Formatter) {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
l.fmtter = fmtter
|
||||
}
|
||||
|
||||
//SetLevel sets the level of Logger l
|
||||
func (l *Logger) SetLevel(lvl Level) {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
l.lvl = lvl
|
||||
}
|
||||
|
||||
//SetOutput sets the output of default Logger
|
||||
func SetOutput(out io.Writer) {
|
||||
logger.SetOutput(out)
|
||||
}
|
||||
|
||||
//SetFormatter sets the formatter of default Logger
|
||||
func SetFormatter(fmtter Formatter) {
|
||||
logger.SetFormatter(fmtter)
|
||||
}
|
||||
|
||||
//SetLevel sets the level of default Logger
|
||||
func SetLevel(lvl Level) {
|
||||
logger.SetLevel(lvl)
|
||||
}
|
||||
|
||||
func (l *Logger) output(record *Record) (err error) {
|
||||
b, err := l.fmtter.Format(record)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
_, err = l.out.Write(b)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Debug ...
|
||||
func (l *Logger) Debug(v ...interface{}) {
|
||||
if l.lvl <= DebugLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprint(v...), l.getLine(), DebugLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Debugf ...
|
||||
func (l *Logger) Debugf(format string, v ...interface{}) {
|
||||
if l.lvl <= DebugLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprintf(format, v...), l.getLine(), DebugLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Info ...
|
||||
func (l *Logger) Info(v ...interface{}) {
|
||||
if l.lvl <= InfoLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprint(v...), "", InfoLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Infof ...
|
||||
func (l *Logger) Infof(format string, v ...interface{}) {
|
||||
if l.lvl <= InfoLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprintf(format, v...), "", InfoLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Warning ...
|
||||
func (l *Logger) Warning(v ...interface{}) {
|
||||
if l.lvl <= WarningLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprint(v...), "", WarningLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Warningf ...
|
||||
func (l *Logger) Warningf(format string, v ...interface{}) {
|
||||
if l.lvl <= WarningLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprintf(format, v...), "", WarningLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Error ...
|
||||
func (l *Logger) Error(v ...interface{}) {
|
||||
if l.lvl <= ErrorLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprint(v...), l.getLine(), ErrorLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Errorf ...
|
||||
func (l *Logger) Errorf(format string, v ...interface{}) {
|
||||
if l.lvl <= ErrorLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprintf(format, v...), l.getLine(), ErrorLevel)
|
||||
l.output(record)
|
||||
}
|
||||
}
|
||||
|
||||
// Fatal ...
|
||||
func (l *Logger) Fatal(v ...interface{}) {
|
||||
if l.lvl <= FatalLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprint(v...), l.getLine(), FatalLevel)
|
||||
l.output(record)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Fatalf ...
|
||||
func (l *Logger) Fatalf(format string, v ...interface{}) {
|
||||
if l.lvl <= FatalLevel {
|
||||
record := NewRecord(time.Now(), fmt.Sprintf(format, v...), l.getLine(), FatalLevel)
|
||||
l.output(record)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func (l *Logger) getLine() string {
|
||||
if l.skipLine {
|
||||
return ""
|
||||
}
|
||||
return line(l.callDepth)
|
||||
}
|
||||
|
||||
// Debug ...
|
||||
func Debug(v ...interface{}) {
|
||||
logger.Debug(v...)
|
||||
}
|
||||
|
||||
// Debugf ...
|
||||
func Debugf(format string, v ...interface{}) {
|
||||
logger.Debugf(format, v...)
|
||||
}
|
||||
|
||||
// Info ...
|
||||
func Info(v ...interface{}) {
|
||||
logger.Info(v...)
|
||||
}
|
||||
|
||||
// Infof ...
|
||||
func Infof(format string, v ...interface{}) {
|
||||
logger.Infof(format, v...)
|
||||
}
|
||||
|
||||
// Warning ...
|
||||
func Warning(v ...interface{}) {
|
||||
logger.Warning(v...)
|
||||
}
|
||||
|
||||
// Warningf ...
|
||||
func Warningf(format string, v ...interface{}) {
|
||||
logger.Warningf(format, v...)
|
||||
}
|
||||
|
||||
// Error ...
|
||||
func Error(v ...interface{}) {
|
||||
logger.Error(v...)
|
||||
}
|
||||
|
||||
// Errorf ...
|
||||
func Errorf(format string, v ...interface{}) {
|
||||
logger.Errorf(format, v...)
|
||||
}
|
||||
|
||||
// Fatal ...
|
||||
func Fatal(v ...interface{}) {
|
||||
logger.Fatal(v...)
|
||||
}
|
||||
|
||||
// Fatalf ...
|
||||
func Fatalf(format string, v ...interface{}) {
|
||||
logger.Fatalf(format, v...)
|
||||
}
|
||||
|
||||
func line(calldepth int) string {
|
||||
_, file, line, ok := runtime.Caller(calldepth)
|
||||
if !ok {
|
||||
file = "???"
|
||||
line = 0
|
||||
}
|
||||
|
||||
for i := len(file) - 2; i > 0; i-- {
|
||||
if file[i] == os.PathSeparator {
|
||||
file = file[i+1:]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("[%s:%d]:", file, line)
|
||||
}
|
37
src/vendor/github.com/vmware/harbor/src/common/utils/log/record.go
generated
vendored
37
src/vendor/github.com/vmware/harbor/src/common/utils/log/record.go
generated
vendored
@ -1,37 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package log
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Record holds information about log
|
||||
type Record struct {
|
||||
Time time.Time // time when the log produced
|
||||
Msg string // content of the log
|
||||
Line string // in which file and line that the log produced
|
||||
Lvl Level // level of the log
|
||||
}
|
||||
|
||||
// NewRecord creates a record according to the arguments provided and returns it
|
||||
func NewRecord(time time.Time, msg, line string, lvl Level) *Record {
|
||||
return &Record{
|
||||
Time: time,
|
||||
Msg: msg,
|
||||
Line: line,
|
||||
Lvl: lvl,
|
||||
}
|
||||
}
|
62
src/vendor/github.com/vmware/harbor/src/common/utils/log/textformatter.go
generated
vendored
62
src/vendor/github.com/vmware/harbor/src/common/utils/log/textformatter.go
generated
vendored
@ -1,62 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package log
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
var defaultTimeFormat = time.RFC3339 // 2006-01-02T15:04:05Z07:00
|
||||
|
||||
// TextFormatter represents a kind of formatter that formats the logs as plain text
|
||||
type TextFormatter struct {
|
||||
timeFormat string
|
||||
}
|
||||
|
||||
// NewTextFormatter returns a TextFormatter, the format of time is time.RFC3339
|
||||
func NewTextFormatter() *TextFormatter {
|
||||
return &TextFormatter{
|
||||
timeFormat: defaultTimeFormat,
|
||||
}
|
||||
}
|
||||
|
||||
// Format formats the logs as "time [level] line message"
|
||||
func (t *TextFormatter) Format(r *Record) (b []byte, err error) {
|
||||
s := fmt.Sprintf("%s [%s] ", r.Time.Format(t.timeFormat), r.Lvl.string())
|
||||
|
||||
if len(r.Line) != 0 {
|
||||
s = s + r.Line + " "
|
||||
}
|
||||
|
||||
if len(r.Msg) != 0 {
|
||||
s = s + r.Msg
|
||||
}
|
||||
|
||||
b = []byte(s)
|
||||
|
||||
if len(b) == 0 || b[len(b)-1] != '\n' {
|
||||
b = append(b, '\n')
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// SetTimeFormat sets time format of TextFormatter if the parameter fmt is not null
|
||||
func (t *TextFormatter) SetTimeFormat(fmt string) {
|
||||
if len(fmt) != 0 {
|
||||
t.timeFormat = fmt
|
||||
}
|
||||
}
|
80
src/vendor/github.com/vmware/harbor/src/common/utils/timemarker.go
generated
vendored
80
src/vendor/github.com/vmware/harbor/src/common/utils/timemarker.go
generated
vendored
@ -1,80 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
scanAllMarker *TimeMarker
|
||||
scanOverviewMarker = &TimeMarker{
|
||||
interval: 15 * time.Second,
|
||||
}
|
||||
once sync.Once
|
||||
)
|
||||
|
||||
//TimeMarker is used to control an action not to be taken frequently within the interval
|
||||
type TimeMarker struct {
|
||||
sync.RWMutex
|
||||
next time.Time
|
||||
interval time.Duration
|
||||
}
|
||||
|
||||
//Mark tries to mark a future time, which is after the duration of interval from the time it's called.
|
||||
func (t *TimeMarker) Mark() {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
t.next = time.Now().Add(t.interval)
|
||||
}
|
||||
|
||||
//Check returns true if the current time is after the mark by this marker, and the caction the mark guards and be taken.
|
||||
func (t *TimeMarker) Check() bool {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
return time.Now().After(t.next)
|
||||
}
|
||||
|
||||
//Next returns the time of the next mark.
|
||||
func (t *TimeMarker) Next() time.Time {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
return t.next
|
||||
}
|
||||
|
||||
//ScanAllMarker ...
|
||||
func ScanAllMarker() *TimeMarker {
|
||||
once.Do(func() {
|
||||
a := os.Getenv("HARBOR_SCAN_ALL_INTERVAL")
|
||||
if m, err := strconv.Atoi(a); err == nil {
|
||||
scanAllMarker = &TimeMarker{
|
||||
interval: time.Duration(m) * time.Minute,
|
||||
}
|
||||
} else {
|
||||
scanAllMarker = &TimeMarker{
|
||||
interval: 2 * time.Hour,
|
||||
}
|
||||
}
|
||||
})
|
||||
return scanAllMarker
|
||||
}
|
||||
|
||||
//ScanOverviewMarker ...
|
||||
func ScanOverviewMarker() *TimeMarker {
|
||||
return scanOverviewMarker
|
||||
}
|
216
src/vendor/github.com/vmware/harbor/src/common/utils/utils.go
generated
vendored
216
src/vendor/github.com/vmware/harbor/src/common/utils/utils.go
generated
vendored
@ -1,216 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/vmware/harbor/src/common/utils/log"
|
||||
)
|
||||
|
||||
// ParseEndpoint parses endpoint to a URL
|
||||
func ParseEndpoint(endpoint string) (*url.URL, error) {
|
||||
endpoint = strings.Trim(endpoint, " ")
|
||||
endpoint = strings.TrimRight(endpoint, "/")
|
||||
if len(endpoint) == 0 {
|
||||
return nil, fmt.Errorf("empty URL")
|
||||
}
|
||||
i := strings.Index(endpoint, "://")
|
||||
if i >= 0 {
|
||||
scheme := endpoint[:i]
|
||||
if scheme != "http" && scheme != "https" {
|
||||
return nil, fmt.Errorf("invalid scheme: %s", scheme)
|
||||
}
|
||||
} else {
|
||||
endpoint = "http://" + endpoint
|
||||
}
|
||||
|
||||
return url.ParseRequestURI(endpoint)
|
||||
}
|
||||
|
||||
// ParseRepository splits a repository into two parts: project and rest
|
||||
func ParseRepository(repository string) (project, rest string) {
|
||||
repository = strings.TrimLeft(repository, "/")
|
||||
repository = strings.TrimRight(repository, "/")
|
||||
if !strings.ContainsRune(repository, '/') {
|
||||
rest = repository
|
||||
return
|
||||
}
|
||||
index := strings.Index(repository, "/")
|
||||
project = repository[0:index]
|
||||
rest = repository[index+1:]
|
||||
return
|
||||
}
|
||||
|
||||
// GenerateRandomString generates a random string
|
||||
func GenerateRandomString() string {
|
||||
length := 32
|
||||
const chars = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
l := len(chars)
|
||||
result := make([]byte, length)
|
||||
_, err := rand.Read(result)
|
||||
if err != nil {
|
||||
log.Warningf("Error reading random bytes: %v", err)
|
||||
}
|
||||
for i := 0; i < length; i++ {
|
||||
result[i] = chars[int(result[i])%l]
|
||||
}
|
||||
return string(result)
|
||||
}
|
||||
|
||||
// TestTCPConn tests TCP connection
|
||||
// timeout: the total time before returning if something is wrong
|
||||
// with the connection, in second
|
||||
// interval: the interval time for retring after failure, in second
|
||||
func TestTCPConn(addr string, timeout, interval int) error {
|
||||
success := make(chan int)
|
||||
cancel := make(chan int)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-cancel:
|
||||
break
|
||||
default:
|
||||
conn, err := net.DialTimeout("tcp", addr, time.Duration(timeout)*time.Second)
|
||||
if err != nil {
|
||||
log.Errorf("failed to connect to tcp://%s, retry after %d seconds :%v",
|
||||
addr, interval, err)
|
||||
time.Sleep(time.Duration(interval) * time.Second)
|
||||
continue
|
||||
}
|
||||
if err = conn.Close(); err != nil {
|
||||
log.Errorf("failed to close the connection: %v", err)
|
||||
}
|
||||
success <- 1
|
||||
break
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-success:
|
||||
return nil
|
||||
case <-time.After(time.Duration(timeout) * time.Second):
|
||||
cancel <- 1
|
||||
return fmt.Errorf("failed to connect to tcp:%s after %d seconds", addr, timeout)
|
||||
}
|
||||
}
|
||||
|
||||
// ParseTimeStamp parse timestamp to time
|
||||
func ParseTimeStamp(timestamp string) (*time.Time, error) {
|
||||
i, err := strconv.ParseInt(timestamp, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t := time.Unix(i, 0)
|
||||
return &t, nil
|
||||
}
|
||||
|
||||
//ConvertMapToStruct is used to fill the specified struct with map.
|
||||
func ConvertMapToStruct(object interface{}, values interface{}) error {
|
||||
if object == nil {
|
||||
return errors.New("nil struct is not supported")
|
||||
}
|
||||
|
||||
if reflect.TypeOf(object).Kind() != reflect.Ptr {
|
||||
return errors.New("object should be referred by pointer")
|
||||
}
|
||||
|
||||
bytes, err := json.Marshal(values)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return json.Unmarshal(bytes, object)
|
||||
}
|
||||
|
||||
// ParseProjectIDOrName parses value to ID(int64) or name(string)
|
||||
func ParseProjectIDOrName(value interface{}) (int64, string, error) {
|
||||
if value == nil {
|
||||
return 0, "", errors.New("harborIDOrName is nil")
|
||||
}
|
||||
|
||||
var id int64
|
||||
var name string
|
||||
switch value.(type) {
|
||||
case int:
|
||||
i := value.(int)
|
||||
id = int64(i)
|
||||
case int64:
|
||||
id = value.(int64)
|
||||
case string:
|
||||
name = value.(string)
|
||||
default:
|
||||
return 0, "", fmt.Errorf("unsupported type")
|
||||
}
|
||||
return id, name, nil
|
||||
}
|
||||
|
||||
//SafeCastString -- cast a object to string saftely
|
||||
func SafeCastString(value interface{}) string {
|
||||
if result, ok := value.(string); ok {
|
||||
return result
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//SafeCastInt --
|
||||
func SafeCastInt(value interface{}) int {
|
||||
if result, ok := value.(int); ok {
|
||||
return result
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//SafeCastBool --
|
||||
func SafeCastBool(value interface{}) bool {
|
||||
if result, ok := value.(bool); ok {
|
||||
return result
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
//SafeCastFloat64 --
|
||||
func SafeCastFloat64(value interface{}) float64 {
|
||||
if result, ok := value.(float64); ok {
|
||||
return result
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// ParseOfftime ...
|
||||
func ParseOfftime(offtime int64) (hour, minite, second int) {
|
||||
offtime = offtime % (3600 * 24)
|
||||
hour = int(offtime / 3600)
|
||||
offtime = offtime % 3600
|
||||
minite = int(offtime / 60)
|
||||
second = int(offtime % 60)
|
||||
return
|
||||
}
|
||||
|
||||
// TrimLower ...
|
||||
func TrimLower(str string) string {
|
||||
return strings.TrimSpace(strings.ToLower(str))
|
||||
}
|
3
src/vendor/github.com/vmware/harbor/src/ui_ng/lib/AUTHORS
generated
vendored
3
src/vendor/github.com/vmware/harbor/src/ui_ng/lib/AUTHORS
generated
vendored
@ -1,3 +0,0 @@
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
|
||||
Steven zou <szou@vmware.com>
|
4122
src/vendor/github.com/vmware/harbor/src/ui_ng/lib/LICENSE
generated
vendored
4122
src/vendor/github.com/vmware/harbor/src/ui_ng/lib/LICENSE
generated
vendored
File diff suppressed because it is too large
Load Diff
13
src/vendor/github.com/vmware/harbor/tools/copyright/copyright
generated
vendored
13
src/vendor/github.com/vmware/harbor/tools/copyright/copyright
generated
vendored
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License 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.
|
Loading…
Reference in New Issue
Block a user