Remove unused items in legacy_swagger.yaml (#14785)

Also updated the api test

Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2021-05-06 10:55:33 +08:00 committed by GitHub
parent a66809cf85
commit c7852df8d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 420 deletions

View File

@ -193,91 +193,6 @@ responses:
InternalServerError:
description: 'Internal Server Error'
definitions:
Role:
type: object
properties:
role_id:
type: integer
format: int32
description: ID in table.
role_code:
type: string
description: Description of permissions for the role.
role_name:
type: string
description: Name the the role.
role_mask:
type: string
RoleParam:
type: object
properties:
roles:
type: array
items:
type: integer
format: int32
description: Role ID for updating project role member.
username:
type: string
description: Username relevant to a project role member.
LdapConf:
type: object
properties:
ldap_url:
type: string
description: The url of ldap service.
ldap_search_dn:
type: string
description: The search dn of ldap service.
ldap_search_password:
type: string
description: The search password of ldap service.
ldap_base_dn:
type: string
description: The base dn of ldap service.
ldap_filter:
type: string
description: The serach filter of ldap service.
ldap_uid:
type: string
description: The serach uid from ldap service attributes.
ldap_scope:
type: integer
format: int64
description: The serach scope of ldap service.
ldap_connection_timeout:
type: integer
format: int64
description: The connect timeout of ldap service(second).
LdapUsers:
type: object
properties:
ldap_username:
type: string
description: search ldap user name based on ldapconf.
ldap_realname:
type: string
description: system will try to guess the user realname form "uid" or "cn" attribute.
ldap_email:
type: string
description: system will try to guess the user email address form "mail" or "email" attribute.
LdapImportUsers:
type: object
properties:
ldap_uid_list:
type: array
description: selected uid list
items:
type: string
LdapFailedImportUsers:
type: object
properties:
ldap_uid:
type: string
description: the uid can't add to system.
error:
type: string
description: fail reason.
EmailServerSetting:
type: object
properties:
@ -308,239 +223,6 @@ definitions:
count:
type: integer
description: number of the components with certain severity.
Configurations:
type: object
properties:
auth_mode:
type: string
description: 'The auth mode of current system, such as "db_auth", "ldap_auth"'
count_per_project:
type: string
description: The default count quota for the new created projects.
email_from:
type: string
description: The sender name for Email notification.
email_host:
type: string
description: The hostname of SMTP server that sends Email notification.
email_port:
type: integer
description: The port of SMTP server.
email_identity:
type: string
description: By default it's empty so the email_username is picked.
email_username:
type: string
description: The username for authenticate against SMTP server.
email_ssl:
type: boolean
description: 'When it''s set to true the system will access Email server via TLS by default. If it''s set to false, it still will handle "STARTTLS" from server side.'
email_insecure:
type: boolean
description: Whether or not the certificate will be verified when Harbor tries to access the email server.
ldap_url:
type: string
description: The URL of LDAP server.
ldap_base_dn:
type: string
description: The Base DN for LDAP binding.
ldap_filter:
type: string
description: The filter for LDAP binding.
ldap_scope:
type: integer
description: '0-LDAP_SCOPE_BASE, 1-LDAP_SCOPE_ONELEVEL, 2-LDAP_SCOPE_SUBTREE'
ldap_uid:
type: string
description: 'The attribute which is used as identity for the LDAP binding, such as "CN" or "SAMAccountname"'
ldap_search_dn:
type: string
description: The DN of the user to do the search.
ldap_timeout:
type: integer
description: timeout in seconds for connection to LDAP server.
ldap_group_attribute_name:
type: string
description: 'The attribute which is used as identity of the LDAP group, default is cn.'
ldap_group_base_dn:
type: string
description: The base DN to search LDAP group.
ldap_group_search_filter:
type: string
description: The filter to search the ldap group.
ldap_group_search_scope:
type: integer
description: 'The scope to search ldap. ''0-LDAP_SCOPE_BASE, 1-LDAP_SCOPE_ONELEVEL, 2-LDAP_SCOPE_SUBTREE'''
ldap_group_admin_dn:
type: string
description: Specify the ldap group which have the same privilege with Harbor admin.
oidc_client_id:
type: string
description: The client id of the OIDC.
oidc_client_secret:
type: string
description: The client secret of the OIDC.
oidc_endpoint:
type: string
description: The URL of an OIDC-complaint server, must start with 'https://'.
oidc_name:
type: string
description: The name of the OIDC provider.
oidc_scope:
type: string
description: The scope sent to OIDC server during authentication, should be separated by comma. It has to contain “openid”, and “offline_access”. If you are using google, please remove “offline_access” from this field.
oidc_verify_cert:
type: boolean
description: Whether verify your OIDC server certificate, disable it if your OIDC server is hosted via self-hosted certificate.
project_creation_restriction:
type: string
description: This attribute restricts what users have the permission to create project. It can be "everyone" or "adminonly".
quota_per_project_enable:
type: boolean
description: This attribute indicates whether quota per project enabled in harbor
read_only:
type: boolean
description: '''docker push'' is prohibited by Harbor if you set it to true. '
self_registration:
type: boolean
description: 'Whether the Harbor instance supports self-registration. If it''s set to false, admin need to add user to the instance.'
storage_per_project:
type: string
description: The default storage quota for the new created projects.
token_expiration:
type: integer
description: 'The expiration time of the token for internal Registry, in minutes.'
verify_remote_cert:
type: boolean
description: Whether or not the certificate will be verified when Harbor tries to access a remote Harbor instance for replication.
scan_all_policy:
type: object
properties:
type:
type: string
description: 'The type of scan all policy, currently the valid values are "none" and "daily"'
parameter:
type: object
properties:
daily_time:
type: integer
description: 'The offset in seconds of UTC 0 o''clock, only valid when the policy type is "daily"'
description: 'The parameters of the policy, the values are dependant on the type of the policy.'
ConfigurationsResponse:
type: object
properties:
auth_mode:
$ref: '#/definitions/StringConfigItem'
description: 'The auth mode of current system, such as "db_auth", "ldap_auth"'
count_per_project:
$ref: '#/definitions/IntegerConfigItem'
description: The default count quota for the new created projects.
email_from:
$ref: '#/definitions/StringConfigItem'
description: The sender name for Email notification.
email_host:
$ref: '#/definitions/StringConfigItem'
description: The hostname of SMTP server that sends Email notification.
email_port:
$ref: '#/definitions/IntegerConfigItem'
description: The port of SMTP server.
email_identity:
$ref: '#/definitions/StringConfigItem'
description: By default it's empty so the email_username is picked.
email_username:
$ref: '#/definitions/StringConfigItem'
description: The username for authenticate against SMTP server.
email_ssl:
$ref: '#/definitions/BoolConfigItem'
description: 'When it''s set to true the system will access Email server via TLS by default. If it''s set to false, it still will handle "STARTTLS" from server side.'
email_insecure:
$ref: '#/definitions/BoolConfigItem'
description: Whether or not the certificate will be verified when Harbor tries to access the email server.
ldap_url:
$ref: '#/definitions/StringConfigItem'
description: The URL of LDAP server.
ldap_base_dn:
$ref: '#/definitions/StringConfigItem'
description: The Base DN for LDAP binding.
ldap_filter:
$ref: '#/definitions/StringConfigItem'
description: The filter for LDAP binding.
ldap_scope:
type: integer
description: '0-LDAP_SCOPE_BASE, 1-LDAP_SCOPE_ONELEVEL, 2-LDAP_SCOPE_SUBTREE'
ldap_uid:
$ref: '#/definitions/StringConfigItem'
description: 'The attribute which is used as identity for the LDAP binding, such as "CN" or "SAMAccountname"'
ldap_search_dn:
type: string
description: The DN of the user to do the search.
ldap_timeout:
$ref: '#/definitions/IntegerConfigItem'
description: timeout in seconds for connection to LDAP server.
ldap_group_attribute_name:
$ref: '#/definitions/StringConfigItem'
description: 'The attribute which is used as identity of the LDAP group, default is cn.'
ldap_group_base_dn:
$ref: '#/definitions/StringConfigItem'
description: The base DN to search LDAP group.
ldap_group_search_filter:
$ref: '#/definitions/StringConfigItem'
description: The filter to search the ldap group.
ldap_group_search_scope:
$ref: '#/definitions/IntegerConfigItem'
description: 'The scope to search ldap. ''0-LDAP_SCOPE_BASE, 1-LDAP_SCOPE_ONELEVEL, 2-LDAP_SCOPE_SUBTREE'''
ldap_group_admin_dn:
$ref: '#/definitions/StringConfigItem'
description: Specify the ldap group which have the same privilege with Harbor admin.
oidc_client_id:
$ref: '#/definitions/StringConfigItem'
description: The client id of the OIDC.
oidc_endpoint:
$ref: '#/definitions/StringConfigItem'
description: The URL of an OIDC-complaint server, must start with 'https://'.
oidc_name:
$ref: '#/definitions/StringConfigItem'
description: The name of the OIDC provider.
oidc_scope:
$ref: '#/definitions/StringConfigItem'
description: The scope sent to OIDC server during authentication, should be separated by comma. It has to contain “openid”, and “offline_access”. If you are using google, please remove “offline_access” from this field.
oidc_verify_cert:
$ref: '#/definitions/BoolConfigItem'
description: Whether verify your OIDC server certificate, disable it if your OIDC server is hosted via self-hosted certificate.
project_creation_restriction:
$ref: '#/definitions/StringConfigItem'
description: This attribute restricts what users have the permission to create project. It can be "everyone" or "adminonly".
quota_per_project_enable:
$ref: '#/definitions/BoolConfigItem'
description: This attribute indicates whether quota per project enabled in harbor
read_only:
$ref: '#/definitions/BoolConfigItem'
description: '''docker push'' is prohibited by Harbor if you set it to true. '
self_registration:
$ref: '#/definitions/BoolConfigItem'
description: 'Whether the Harbor instance supports self-registration. If it''s set to false, admin need to add user to the instance.'
storage_per_project:
$ref: '#/definitions/IntegerConfigItem'
description: The default storage quota for the new created projects.
token_expiration:
$ref: '#/definitions/IntegerConfigItem'
description: 'The expiration time of the token for internal Registry, in minutes.'
verify_remote_cert:
$ref: '#/definitions/BoolConfigItem'
description: Whether or not the certificate will be verified when Harbor tries to access a remote Harbor instance for replication.
scan_all_policy:
type: object
properties:
type:
type: string
description: 'The type of scan all policy, currently the valid values are "none" and "daily"'
parameter:
type: object
properties:
daily_time:
type: integer
description: 'The offset in seconds of UTC 0 o''clock, only valid when the policy type is "daily"'
description: 'The parameters of the policy, the values are dependant on the type of the policy.'
Label:
type: object
properties:
@ -571,97 +253,6 @@ definitions:
deleted:
type: boolean
description: The label is deleted or not.
ProjectMemberEntity:
type: object
properties:
id:
type: integer
description: the project member id
project_id:
type: integer
description: the project id
entity_name:
type: string
description: the name of the group member.
role_name:
type: string
description: the name of the role
role_id:
type: integer
description: the role id
entity_id:
type: integer
description: 'the id of entity, if the member is a user, it is user_id in user table. if the member is a user group, it is the user group''s ID in user_group table.'
entity_type:
type: string
description: 'the entity''s type, u for user entity, g for group entity.'
ProjectMember:
type: object
properties:
role_id:
type: integer
description: 'The role id 1 for projectAdmin, 2 for developer, 3 for guest, 4 for maintainer'
member_user:
$ref: '#/definitions/UserEntity'
member_group:
$ref: '#/definitions/UserGroup'
RoleRequest:
type: object
properties:
role_id:
type: integer
description: 'The role id 1 for projectAdmin, 2 for developer, 3 for guest, 4 for maintainer'
UserEntity:
type: object
properties:
user_id:
type: integer
description: The ID of the user.
username:
type: string
description: The name of the user.
UserGroup:
type: object
properties:
id:
type: integer
description: The ID of the user group
group_name:
type: string
description: The name of the user group
group_type:
type: integer
description: 'The group type, 1 for LDAP group, 2 for HTTP group.'
ldap_group_dn:
type: string
description: The DN of the LDAP group if group type is 1 (LDAP group).
StringConfigItem:
type: object
properties:
value:
type: string
description: The string value of current config item
editable:
type: boolean
description: The configure item can be updated or not
BoolConfigItem:
type: object
properties:
value:
type: boolean
description: The boolean value of current config item
editable:
type: boolean
description: The configure item can be updated or not
IntegerConfigItem:
type: object
properties:
value:
type: integer
description: The integer value of current config item
editable:
type: boolean
description: The configure item can be updated or not
ChartAPIError:
description: The error object returned by chart repository API
type: object
@ -803,11 +394,3 @@ definitions:
metadata:
type: object
description: The metadata of namespace
parameters:
query:
name: q
description: Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max]
in: query
type: string
required: false

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import swagger_client
import v2_swagger_client
from library.base import _assert_status_code
from v2_swagger_client.models.role_request import RoleRequest
from v2_swagger_client.rest import ApiException
import base
@ -171,7 +171,7 @@ class Project(base.Base):
def update_project_member_role(self, project_id, member_id, member_role_id, expect_status_code = 200, **kwargs):
kwargs['api_type'] = 'member'
role = swagger_client.Role(role_id = member_role_id)
role = RoleRequest(role_id = member_role_id)
data, status_code, _ = self._get_client(**kwargs).update_project_member_with_http_info(project_id, member_id, role = role)
base._assert_status_code(expect_status_code, status_code)
base._assert_status_code(200, status_code)

View File

@ -23,7 +23,7 @@ import unittest
import testutils
from testutils import ADMIN_CLIENT
from swagger_client.models.user_group import UserGroup
from v2_swagger_client.models.user_group import UserGroup
from library.configurations import Configurations
from pprint import pprint