From 60cae7357fecab45c15ccf28a6bf27a1c2f9bc8f Mon Sep 17 00:00:00 2001 From: yhua Date: Mon, 15 Aug 2016 10:21:29 +0800 Subject: [PATCH] add new structs from swagger auto gen code --- api/search_test.go | 4 +- tests/apitests/apilib/access_log.go | 41 +++++++++++ tests/apitests/apilib/access_log_filter.go | 38 +++++++++++ tests/apitests/apilib/accesslog.go | 24 ------- tests/apitests/apilib/harborlogout.bak | 15 ++++ tests/apitests/apilib/harlogin.bak | 28 ++++++++ tests/apitests/apilib/job_status.go | 50 ++++++++++++++ tests/apitests/apilib/password.go | 25 ++++++- tests/apitests/apilib/project.go | 68 ++++++++++++++++--- tests/apitests/apilib/projecttemp4search.go | 8 --- tests/apitests/apilib/rep_policy.go | 62 +++++++++++++++++ .../apilib/rep_policy_enablement_req.go | 29 ++++++++ tests/apitests/apilib/rep_policy_post.go | 35 ++++++++++ tests/apitests/apilib/rep_policy_update.go | 41 +++++++++++ tests/apitests/apilib/rep_target.go | 50 ++++++++++++++ tests/apitests/apilib/rep_target_post.go | 38 +++++++++++ tests/apitests/apilib/repository.go | 59 ++++++++++++---- .../apitests/apilib/repositorytemp4search.go | 12 ---- tests/apitests/apilib/role.go | 31 ++++++++- tests/apitests/apilib/role_param.go | 32 +++++++++ tests/apitests/apilib/roleparam.go | 7 -- tests/apitests/apilib/search.go | 33 +++++++-- tests/apitests/apilib/search_project.go | 35 ++++++++++ tests/apitests/apilib/search_repository.go | 38 +++++++++++ tests/apitests/apilib/statistic_map.go | 44 ++++++++++++ tests/apitests/apilib/tags.go | 29 ++++++++ tests/apitests/apilib/top_repo.go | 32 +++++++++ tests/apitests/apilib/user.go | 39 +++++++++-- 28 files changed, 856 insertions(+), 91 deletions(-) create mode 100644 tests/apitests/apilib/access_log.go create mode 100644 tests/apitests/apilib/access_log_filter.go delete mode 100644 tests/apitests/apilib/accesslog.go create mode 100644 tests/apitests/apilib/harborlogout.bak create mode 100644 tests/apitests/apilib/harlogin.bak create mode 100644 tests/apitests/apilib/job_status.go delete mode 100644 tests/apitests/apilib/projecttemp4search.go create mode 100644 tests/apitests/apilib/rep_policy.go create mode 100644 tests/apitests/apilib/rep_policy_enablement_req.go create mode 100644 tests/apitests/apilib/rep_policy_post.go create mode 100644 tests/apitests/apilib/rep_policy_update.go create mode 100644 tests/apitests/apilib/rep_target.go create mode 100644 tests/apitests/apilib/rep_target_post.go delete mode 100644 tests/apitests/apilib/repositorytemp4search.go create mode 100644 tests/apitests/apilib/role_param.go delete mode 100644 tests/apitests/apilib/roleparam.go create mode 100644 tests/apitests/apilib/search_project.go create mode 100644 tests/apitests/apilib/search_repository.go create mode 100644 tests/apitests/apilib/statistic_map.go create mode 100644 tests/apitests/apilib/tags.go create mode 100644 tests/apitests/apilib/top_repo.go diff --git a/api/search_test.go b/api/search_test.go index 529a87025..1eecd1009 100644 --- a/api/search_test.go +++ b/api/search_test.go @@ -20,8 +20,8 @@ func TestSearch(t *testing.T) { t.Error("Error while search project or repository", err.Error()) t.Log(err) } else { - assert.Equal(result.Projects[0].ProjectID, int32(1), "Project id should be equal") - assert.Equal(result.Projects[0].ProjectName, "library", "Project name should be library") + assert.Equal(result.Projects[0].Id, int64(1), "Project id should be equal") + assert.Equal(result.Projects[0].Name, "library", "Project name should be library") assert.Equal(result.Projects[0].Public, int32(1), "Project public status should be 1 (true)") //t.Log(result) } diff --git a/tests/apitests/apilib/access_log.go b/tests/apitests/apilib/access_log.go new file mode 100644 index 000000000..aea708ff1 --- /dev/null +++ b/tests/apitests/apilib/access_log.go @@ -0,0 +1,41 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/access_log_filter.go b/tests/apitests/apilib/access_log_filter.go new file mode 100644 index 000000000..9c6b87296 --- /dev/null +++ b/tests/apitests/apilib/access_log_filter.go @@ -0,0 +1,38 @@ +/* + * 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 AccessLogFilter struct { + + // Relevant user's name that accessed this project. + Username string `json:"username,omitempty"` + + // Operation name specified when project created. + Keywords string `json:"keywords,omitempty"` + + // Begin timestamp for querying access logs. + BeginTimestamp int64 `json:"begin_timestamp,omitempty"` + + // End timestamp for querying accessl logs. + EndTimestamp int64 `json:"end_timestamp,omitempty"` +} diff --git a/tests/apitests/apilib/accesslog.go b/tests/apitests/apilib/accesslog.go deleted file mode 100644 index 4c25b33a7..000000000 --- a/tests/apitests/apilib/accesslog.go +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2016 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 apilib - -//AccessLog for go test -type AccessLog struct { - Username string `json:"username,omitempty"` - Keywords string `json:"keywords,omitempty"` - BeginTimestamp int32 `json:"beginTimestamp,omitempty"` - EndTimestamp int32 `json:"endTimestamp,omitempty"` -} diff --git a/tests/apitests/apilib/harborlogout.bak b/tests/apitests/apilib/harborlogout.bak new file mode 100644 index 000000000..fa59ee2bb --- /dev/null +++ b/tests/apitests/apilib/harborlogout.bak @@ -0,0 +1,15 @@ +// 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 +} diff --git a/tests/apitests/apilib/harlogin.bak b/tests/apitests/apilib/harlogin.bak new file mode 100644 index 000000000..d711103bb --- /dev/null +++ b/tests/apitests/apilib/harlogin.bak @@ -0,0 +1,28 @@ +// 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 +} diff --git a/tests/apitests/apilib/job_status.go b/tests/apitests/apilib/job_status.go new file mode 100644 index 000000000..62826636f --- /dev/null +++ b/tests/apitests/apilib/job_status.go @@ -0,0 +1,50 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/password.go b/tests/apitests/apilib/password.go index dca6a48a1..f791cd056 100644 --- a/tests/apitests/apilib/password.go +++ b/tests/apitests/apilib/password.go @@ -1,8 +1,27 @@ +/* + * 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 () - -//Password for go test type Password struct { // The user's existing password. diff --git a/tests/apitests/apilib/project.go b/tests/apitests/apilib/project.go index dc0ffe523..0026ca0f9 100644 --- a/tests/apitests/apilib/project.go +++ b/tests/apitests/apilib/project.go @@ -1,16 +1,62 @@ +/* + * 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 () - -//Project for go test type Project struct { - ProjectID int32 `json:"id,omitempty"` - OwnerID int32 `json:"owner_id,omitempty"` - ProjectName string `json:"project_name,omitempty"` + + // 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:"project_name,omitempty"` + + // The creation time of the project. CreationTime string `json:"creation_time,omitempty"` - Deleted int32 `json:"deleted,omitempty"` - UserID int32 `json:"user_id,omitempty"` - OwnerName string `json:"owner_name,omitempty"` - Public bool `json:"public,omitempty"` - Togglable bool `json:"togglable,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 int32 `json:"deleted,omitempty"` + + // A relation field to the user table. + UserId int32 `json:"user_id,omitempty"` + + // The owner name of the project. + OwnerName string `json:"owner_name,omitempty"` + + // The public status of the project. + Public bool `json:"public,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"` } diff --git a/tests/apitests/apilib/projecttemp4search.go b/tests/apitests/apilib/projecttemp4search.go deleted file mode 100644 index 4b80cc045..000000000 --- a/tests/apitests/apilib/projecttemp4search.go +++ /dev/null @@ -1,8 +0,0 @@ -package apilib - -//Project4Search ... -type Project4Search struct { - ProjectID int32 `json:"id,omitempty"` - ProjectName string `json:"name,omitempty"` - Public int32 `json:"public,omitempty"` -} diff --git a/tests/apitests/apilib/rep_policy.go b/tests/apitests/apilib/rep_policy.go new file mode 100644 index 000000000..16e7edd82 --- /dev/null +++ b/tests/apitests/apilib/rep_policy.go @@ -0,0 +1,62 @@ +/* + * 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 target name. + TargetName string `json:"target_name,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"` +} diff --git a/tests/apitests/apilib/rep_policy_enablement_req.go b/tests/apitests/apilib/rep_policy_enablement_req.go new file mode 100644 index 000000000..11574f645 --- /dev/null +++ b/tests/apitests/apilib/rep_policy_enablement_req.go @@ -0,0 +1,29 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/rep_policy_post.go b/tests/apitests/apilib/rep_policy_post.go new file mode 100644 index 000000000..6b8d42731 --- /dev/null +++ b/tests/apitests/apilib/rep_policy_post.go @@ -0,0 +1,35 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/rep_policy_update.go b/tests/apitests/apilib/rep_policy_update.go new file mode 100644 index 000000000..fe57bf20e --- /dev/null +++ b/tests/apitests/apilib/rep_policy_update.go @@ -0,0 +1,41 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/rep_target.go b/tests/apitests/apilib/rep_target.go new file mode 100644 index 000000000..a7bf4ac29 --- /dev/null +++ b/tests/apitests/apilib/rep_target.go @@ -0,0 +1,50 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/rep_target_post.go b/tests/apitests/apilib/rep_target_post.go new file mode 100644 index 000000000..f2932667c --- /dev/null +++ b/tests/apitests/apilib/rep_target_post.go @@ -0,0 +1,38 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/repository.go b/tests/apitests/apilib/repository.go index 1673d83e4..d6cbe8d44 100644 --- a/tests/apitests/apilib/repository.go +++ b/tests/apitests/apilib/repository.go @@ -1,17 +1,50 @@ +/* + * 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 ( - "time" -) - -//Repository ... type Repository struct { - ID string `json:"id,omitempty"` - Parent string `json:"parent,omitempty"` - Created time.Time `json:"created,omitempty"` - DurationDays string `json:"duration_days,omitempty"` - Author string `json:"author,omitempty"` - Architecture string `json:"architecture,omitempty"` - DockerVersion string `json:"docker_version,omitempty"` - Os string `json:"os,omitempty"` + + // 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"` } diff --git a/tests/apitests/apilib/repositorytemp4search.go b/tests/apitests/apilib/repositorytemp4search.go deleted file mode 100644 index e438fcef6..000000000 --- a/tests/apitests/apilib/repositorytemp4search.go +++ /dev/null @@ -1,12 +0,0 @@ -package apilib - -import () - -//Repository4Search ... -type Repository4Search struct { - ProjectID int32 `json:"project_id,omitempty"` - ProjectName string `json:"project_name,omitempty"` - ProjectPublic int32 `json:"project_public,omitempty"` - RepoName string `json:"repository_name,omitempty"` -} - diff --git a/tests/apitests/apilib/role.go b/tests/apitests/apilib/role.go index 1b18eca2e..9025fd65b 100644 --- a/tests/apitests/apilib/role.go +++ b/tests/apitests/apilib/role.go @@ -1,8 +1,35 @@ +/* + * 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 -//Role ... type Role struct { - RoleID int32 `json:"role_id,omitempty"` + + // 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"` } diff --git a/tests/apitests/apilib/role_param.go b/tests/apitests/apilib/role_param.go new file mode 100644 index 000000000..aa022792c --- /dev/null +++ b/tests/apitests/apilib/role_param.go @@ -0,0 +1,32 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/roleparam.go b/tests/apitests/apilib/roleparam.go deleted file mode 100644 index b91ac05e4..000000000 --- a/tests/apitests/apilib/roleparam.go +++ /dev/null @@ -1,7 +0,0 @@ -package apilib - -//RoleParam ... -type RoleParam struct { - Roles []int32 `json:"roles,omitempty"` - UserName string `json:"user_name,omitempty"` -} diff --git a/tests/apitests/apilib/search.go b/tests/apitests/apilib/search.go index ae7610f58..d12388469 100644 --- a/tests/apitests/apilib/search.go +++ b/tests/apitests/apilib/search.go @@ -1,9 +1,34 @@ +/* + * 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 () +import() -//Search ... type Search struct { - Projects []Project4Search `json:"project,omitempty"` - Repositories []Repository4Search `json:"repository,omitempty"` + + // Search results of the projects that matched the filter keywords. + Projects []SearchProject `json:"project,omitempty"` + + // Search results of the repositories that matched the filter keywords. + Repositories []SearchRepository `json:"repository,omitempty"` } diff --git a/tests/apitests/apilib/search_project.go b/tests/apitests/apilib/search_project.go new file mode 100644 index 000000000..4f803253c --- /dev/null +++ b/tests/apitests/apilib/search_project.go @@ -0,0 +1,35 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/search_repository.go b/tests/apitests/apilib/search_repository.go new file mode 100644 index 000000000..7961422a4 --- /dev/null +++ b/tests/apitests/apilib/search_repository.go @@ -0,0 +1,38 @@ +/* + * 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 name of the repository + RepositoryName string `json:"repository_name,omitempty"` + + // The name of the project that the repository belongs to + ProjectName string `json:"project_name,omitempty"` + + // The ID of the project that the repository belongs to + ProjectId int32 `json:"project_id,omitempty"` + + // The flag to indicate the publicity of the project that the repository belongs to (1 is public, 0 is not) + ProjectPublic int32 `json:"project_public,omitempty"` +} diff --git a/tests/apitests/apilib/statistic_map.go b/tests/apitests/apilib/statistic_map.go new file mode 100644 index 000000000..ec89e79a1 --- /dev/null +++ b/tests/apitests/apilib/statistic_map.go @@ -0,0 +1,44 @@ +/* + * 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 projects which the user is a member of. + MyProjectCount int32 `json:"my_project_count,omitempty"` + + // The count of the repositories belonging to the projects which the user is a member of. + MyRepoCount int32 `json:"my_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"` +} diff --git a/tests/apitests/apilib/tags.go b/tests/apitests/apilib/tags.go new file mode 100644 index 000000000..53dcfc31a --- /dev/null +++ b/tests/apitests/apilib/tags.go @@ -0,0 +1,29 @@ +/* + * 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"` +} diff --git a/tests/apitests/apilib/top_repo.go b/tests/apitests/apilib/top_repo.go new file mode 100644 index 000000000..9cea0726e --- /dev/null +++ b/tests/apitests/apilib/top_repo.go @@ -0,0 +1,32 @@ +/* + * 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 + AccessCount int32 `json:"access_count,omitempty"` +} diff --git a/tests/apitests/apilib/user.go b/tests/apitests/apilib/user.go index a514c1650..ccd6522a3 100644 --- a/tests/apitests/apilib/user.go +++ b/tests/apitests/apilib/user.go @@ -1,12 +1,41 @@ +/* + * 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 -//User ... type User struct { - UserID int32 `json:"user_id,omitempty"` + + // The ID of the user. + UserId int32 `json:"user_id,omitempty"` + Username string `json:"username,omitempty"` - Email string `json:"email,omitempty"` + + Email string `json:"email,omitempty"` + Password string `json:"password,omitempty"` + Realname string `json:"realname,omitempty"` - Comment string `json:"comment,omitempty"` - Deleted int32 `json:"deleted,omitempty"` + + Comment string `json:"comment,omitempty"` + + Deleted int32 `json:"deleted,omitempty"` }