diff --git a/CHANGES/6545.misc b/CHANGES/6545.misc new file mode 100644 index 00000000..52a98940 --- /dev/null +++ b/CHANGES/6545.misc @@ -0,0 +1 @@ +Lowercase the ``RHSM`` to ``rhsm`` in its URLs. diff --git a/docs/_static/api.json b/docs/_static/api.json index 8debb6f1..74ba2dd5 100644 --- a/docs/_static/api.json +++ b/docs/_static/api.json @@ -1 +1 @@ -{"swagger": "2.0", "info": {"title": "Pulp 3 API", "license": {"name": "GPLv2+"}, "logo": {"url": "https://pulp.plan.io/attachments/download/517478/pulp_logo_word_rectangle.svg"}, "version": "v3"}, "host": "localhost:24817", "schemes": ["http"], "basePath": "/", "consumes": ["application/json"], "produces": ["application/json"], "securityDefinitions": {"Basic": {"type": "basic"}}, "security": [{"Basic": []}], "paths": {"/pulp/api/v3/contentguards/certguard/RHSM/": {"get": {"operationId": "contentguards_certguard_RHSM_list", "summary": "List rhsm cert guards", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "name", "in": "query", "description": "", "required": false, "type": "string"}, {"name": "name__in", "in": "query", "description": "Filter results where name is in a comma-separated list of values", "required": false, "type": "string"}, {"name": "limit", "in": "query", "description": "Number of results to return per page.", "required": false, "type": "integer"}, {"name": "offset", "in": "query", "description": "The initial index from which to return the results.", "required": false, "type": "integer"}, {"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"required": ["count", "results"], "type": "object", "properties": {"count": {"type": "integer"}, "next": {"type": "string", "format": "uri", "x-nullable": true}, "previous": {"type": "string", "format": "uri", "x-nullable": true}, "results": {"type": "array", "items": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}}}}, "tags": ["contentguards: RHSM"]}, "post": {"operationId": "contentguards_certguard_RHSM_create", "summary": "Create a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}], "responses": {"201": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: RHSM"]}, "parameters": []}, "{r_h_s_m_cert_guard_href}": {"get": {"operationId": "contentguards_certguard_RHSM_read", "summary": "Inspect a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: RHSM"]}, "put": {"operationId": "contentguards_certguard_RHSM_update", "summary": "Update a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: RHSM"]}, "patch": {"operationId": "contentguards_certguard_RHSM_partial_update", "summary": "Partially update a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: RHSM"]}, "delete": {"operationId": "contentguards_certguard_RHSM_delete", "summary": "Delete a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [], "responses": {"204": {"description": ""}}, "tags": ["contentguards: RHSM"]}, "parameters": [{"name": "r_h_s_m_cert_guard_href", "in": "path", "description": "URI of R H S M Cert Guard. e.g.: /pulp/api/v3/contentguards/certguard/RHSM/1/", "required": true, "type": "string"}]}, "/pulp/api/v3/contentguards/certguard/x509/": {"get": {"operationId": "contentguards_certguard_x509_list", "summary": "List x509 cert guards", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "name", "in": "query", "description": "", "required": false, "type": "string"}, {"name": "name__in", "in": "query", "description": "Filter results where name is in a comma-separated list of values", "required": false, "type": "string"}, {"name": "limit", "in": "query", "description": "Number of results to return per page.", "required": false, "type": "integer"}, {"name": "offset", "in": "query", "description": "The initial index from which to return the results.", "required": false, "type": "integer"}, {"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"required": ["count", "results"], "type": "object", "properties": {"count": {"type": "integer"}, "next": {"type": "string", "format": "uri", "x-nullable": true}, "previous": {"type": "string", "format": "uri", "x-nullable": true}, "results": {"type": "array", "items": {"$ref": "#/definitions/certguard.X509CertGuard"}}}}}}, "tags": ["contentguards: x509"]}, "post": {"operationId": "contentguards_certguard_x509_create", "summary": "Create a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}], "responses": {"201": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "parameters": []}, "{x509_cert_guard_href}": {"get": {"operationId": "contentguards_certguard_x509_read", "summary": "Inspect a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "put": {"operationId": "contentguards_certguard_x509_update", "summary": "Update a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "patch": {"operationId": "contentguards_certguard_x509_partial_update", "summary": "Partially update a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "delete": {"operationId": "contentguards_certguard_x509_delete", "summary": "Delete a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [], "responses": {"204": {"description": ""}}, "tags": ["contentguards: x509"]}, "parameters": [{"name": "x509_cert_guard_href", "in": "path", "description": "URI of X509 Cert Guard. e.g.: /pulp/api/v3/contentguards/certguard/x509/1/", "required": true, "type": "string"}]}}, "definitions": {"certguard.RHSMCertGuard": {"required": ["name", "ca_certificate"], "type": "object", "properties": {"pulp_href": {"title": "Pulp href", "type": "string", "format": "uri", "readOnly": true}, "pulp_created": {"title": "Pulp created", "description": "Timestamp of creation.", "type": "string", "format": "date-time", "readOnly": true}, "name": {"title": "Name", "description": "The unique name.", "type": "string", "minLength": 1}, "description": {"title": "Description", "description": "An optional description.", "type": "string", "minLength": 1, "x-nullable": true}, "ca_certificate": {"title": "Ca certificate", "description": "The Certificate Authority (CA) certificate.", "type": "string", "minLength": 1}}}, "certguard.X509CertGuard": {"required": ["name", "ca_certificate"], "type": "object", "properties": {"pulp_href": {"title": "Pulp href", "type": "string", "format": "uri", "readOnly": true}, "pulp_created": {"title": "Pulp created", "description": "Timestamp of creation.", "type": "string", "format": "date-time", "readOnly": true}, "name": {"title": "Name", "description": "The unique name.", "type": "string", "minLength": 1}, "description": {"title": "Description", "description": "An optional description.", "type": "string", "minLength": 1, "x-nullable": true}, "ca_certificate": {"title": "Ca certificate", "description": "The Certificate Authority (CA) certificate.", "type": "string", "minLength": 1}}}}, "tags": [{"name": "contentguards: RHSM", "x-displayName": "Contentguards: Rhsm"}, {"name": "contentguards: x509", "x-displayName": "Contentguards: X509"}]} \ No newline at end of file +{"swagger": "2.0", "info": {"title": "Pulp 3 API", "license": {"name": "GPLv2+"}, "logo": {"url": "https://pulp.plan.io/attachments/download/517478/pulp_logo_word_rectangle.svg"}, "version": "v3"}, "host": "localhost:24817", "schemes": ["http"], "basePath": "/", "consumes": ["application/json"], "produces": ["application/json"], "securityDefinitions": {"Basic": {"type": "basic"}}, "security": [{"Basic": []}], "paths": {"/pulp/api/v3/contentguards/certguard/rhsm/": {"get": {"operationId": "contentguards_certguard_rhsm_list", "summary": "List rhsm cert guards", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "name", "in": "query", "description": "", "required": false, "type": "string"}, {"name": "name__in", "in": "query", "description": "Filter results where name is in a comma-separated list of values", "required": false, "type": "string"}, {"name": "limit", "in": "query", "description": "Number of results to return per page.", "required": false, "type": "integer"}, {"name": "offset", "in": "query", "description": "The initial index from which to return the results.", "required": false, "type": "integer"}, {"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"required": ["count", "results"], "type": "object", "properties": {"count": {"type": "integer"}, "next": {"type": "string", "format": "uri", "x-nullable": true}, "previous": {"type": "string", "format": "uri", "x-nullable": true}, "results": {"type": "array", "items": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}}}}, "tags": ["contentguards: rhsm"]}, "post": {"operationId": "contentguards_certguard_rhsm_create", "summary": "Create a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}], "responses": {"201": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: rhsm"]}, "parameters": []}, "{r_h_s_m_cert_guard_href}": {"get": {"operationId": "contentguards_certguard_rhsm_read", "summary": "Inspect a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: rhsm"]}, "put": {"operationId": "contentguards_certguard_rhsm_update", "summary": "Update a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: rhsm"]}, "patch": {"operationId": "contentguards_certguard_rhsm_partial_update", "summary": "Partially update a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.RHSMCertGuard"}}}, "tags": ["contentguards: rhsm"]}, "delete": {"operationId": "contentguards_certguard_rhsm_delete", "summary": "Delete a rhsm cert guard", "description": "RHSMCertGuard API Viewsets.", "parameters": [], "responses": {"204": {"description": ""}}, "tags": ["contentguards: rhsm"]}, "parameters": [{"name": "r_h_s_m_cert_guard_href", "in": "path", "description": "URI of R H S M Cert Guard. e.g.: /pulp/api/v3/contentguards/certguard/rhsm/1/", "required": true, "type": "string"}]}, "/pulp/api/v3/contentguards/certguard/x509/": {"get": {"operationId": "contentguards_certguard_x509_list", "summary": "List x509 cert guards", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "name", "in": "query", "description": "", "required": false, "type": "string"}, {"name": "name__in", "in": "query", "description": "Filter results where name is in a comma-separated list of values", "required": false, "type": "string"}, {"name": "limit", "in": "query", "description": "Number of results to return per page.", "required": false, "type": "integer"}, {"name": "offset", "in": "query", "description": "The initial index from which to return the results.", "required": false, "type": "integer"}, {"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"required": ["count", "results"], "type": "object", "properties": {"count": {"type": "integer"}, "next": {"type": "string", "format": "uri", "x-nullable": true}, "previous": {"type": "string", "format": "uri", "x-nullable": true}, "results": {"type": "array", "items": {"$ref": "#/definitions/certguard.X509CertGuard"}}}}}}, "tags": ["contentguards: x509"]}, "post": {"operationId": "contentguards_certguard_x509_create", "summary": "Create a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}], "responses": {"201": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "parameters": []}, "{x509_cert_guard_href}": {"get": {"operationId": "contentguards_certguard_x509_read", "summary": "Inspect a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "fields", "in": "query", "description": "A list of fields to include in the response.", "required": false, "type": "string"}, {"name": "exclude_fields", "in": "query", "description": "A list of fields to exclude from the response.", "required": false, "type": "string"}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "put": {"operationId": "contentguards_certguard_x509_update", "summary": "Update a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "patch": {"operationId": "contentguards_certguard_x509_partial_update", "summary": "Partially update a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [{"name": "data", "in": "body", "required": true, "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}], "responses": {"200": {"description": "", "schema": {"$ref": "#/definitions/certguard.X509CertGuard"}}}, "tags": ["contentguards: x509"]}, "delete": {"operationId": "contentguards_certguard_x509_delete", "summary": "Delete a x509 cert guard", "description": "X509CertGuard API Viewsets.", "parameters": [], "responses": {"204": {"description": ""}}, "tags": ["contentguards: x509"]}, "parameters": [{"name": "x509_cert_guard_href", "in": "path", "description": "URI of X509 Cert Guard. e.g.: /pulp/api/v3/contentguards/certguard/x509/1/", "required": true, "type": "string"}]}}, "definitions": {"certguard.RHSMCertGuard": {"required": ["name", "ca_certificate"], "type": "object", "properties": {"pulp_href": {"title": "Pulp href", "type": "string", "format": "uri", "readOnly": true}, "pulp_created": {"title": "Pulp created", "description": "Timestamp of creation.", "type": "string", "format": "date-time", "readOnly": true}, "name": {"title": "Name", "description": "The unique name.", "type": "string", "minLength": 1}, "description": {"title": "Description", "description": "An optional description.", "type": "string", "minLength": 1, "x-nullable": true}, "ca_certificate": {"title": "Ca certificate", "description": "The Certificate Authority (CA) certificate.", "type": "string", "minLength": 1}}}, "certguard.X509CertGuard": {"required": ["name", "ca_certificate"], "type": "object", "properties": {"pulp_href": {"title": "Pulp href", "type": "string", "format": "uri", "readOnly": true}, "pulp_created": {"title": "Pulp created", "description": "Timestamp of creation.", "type": "string", "format": "date-time", "readOnly": true}, "name": {"title": "Name", "description": "The unique name.", "type": "string", "minLength": 1}, "description": {"title": "Description", "description": "An optional description.", "type": "string", "minLength": 1, "x-nullable": true}, "ca_certificate": {"title": "Ca certificate", "description": "The Certificate Authority (CA) certificate.", "type": "string", "minLength": 1}}}}, "tags": [{"name": "contentguards: rhsm", "x-displayName": "Contentguards: Rhsm"}, {"name": "contentguards: x509", "x-displayName": "Contentguards: X509"}]} \ No newline at end of file diff --git a/pulp_certguard/app/models.py b/pulp_certguard/app/models.py index 16075c77..e18d6d8c 100644 --- a/pulp_certguard/app/models.py +++ b/pulp_certguard/app/models.py @@ -85,7 +85,7 @@ class RHSMCertGuard(BaseCertGuard): of a path declared in the trusted RHSM Client Certificate. Fields: - rhsm_certificate (models.TextField): The RHSM Ccertificate used to validate the client + rhsm_certificate (models.TextField): The RHSM Certificate used to validate the client certificate at request time. """ @@ -119,7 +119,6 @@ def permit(self, request): @staticmethod def _create_rhsm_cert_from_pem(unquoted_certificate): - get_rhsm() try: rhsm_cert = certificate.create_from_pem(unquoted_certificate) except certificate.CertificateException: diff --git a/pulp_certguard/app/viewsets.py b/pulp_certguard/app/viewsets.py index c9516f22..50d60854 100644 --- a/pulp_certguard/app/viewsets.py +++ b/pulp_certguard/app/viewsets.py @@ -7,7 +7,7 @@ class RHSMCertGuardViewSet(ContentGuardViewSet): """RHSMCertGuard API Viewsets.""" - endpoint_name = 'RHSM' + endpoint_name = 'rhsm' queryset = RHSMCertGuard.objects.all() serializer_class = RHSMCertGuardSerializer filterset_class = ContentGuardFilter diff --git a/pulp_certguard/tests/functional/api/test_rhsm_certguard.py b/pulp_certguard/tests/functional/api/test_rhsm_certguard.py index 13fa0c20..3f60d249 100644 --- a/pulp_certguard/tests/functional/api/test_rhsm_certguard.py +++ b/pulp_certguard/tests/functional/api/test_rhsm_certguard.py @@ -2,7 +2,7 @@ from requests import HTTPError -from pulpcore.client.pulp_certguard import CertguardRHSMCertGuard, ContentguardsRHSMApi +from pulpcore.client.pulp_certguard import CertguardRHSMCertGuard, ContentguardsRhsmApi from pulp_certguard.tests.functional.api.base import BaseCertGuard, CommonDenialTestsMixin from pulp_certguard.tests.functional.constants import ( @@ -37,7 +37,7 @@ class RHSMCertGuardBase(BaseCertGuard): def _setup_content_guard(cls): # Create a RHSM Content Guard certguard_client = gen_certguard_client() - cls.rhsm_content_guards_api = ContentguardsRHSMApi(certguard_client) + cls.rhsm_content_guards_api = ContentguardsRhsmApi(certguard_client) with open(RHSM_CA_CERT_FILE_PATH, 'r') as rhsm_ca_cert_data_file: rhsm_ca_cert_data = rhsm_ca_cert_data_file.read()