devices.views ============= .. py:module:: devices.views .. autoapi-nested-parse:: This module contains all views concerning the devices application. Module Contents --------------- .. py:data:: DeviceWithoutDomainErrorMsg .. py:data:: NamedCurveMissingForEccErrorMsg .. py:data:: ActiveTrustpointTlsServerCredentialModelMissingErrorMsg .. py:data:: PublicKeyInfoMissingErrorMsg .. py:class:: AbstractDeviceTableView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`devices.models.DeviceModel`\ ], :py:obj:`abc.ABC` Device Table View. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'devices' .. py:attribute:: paginate_by :value: 50 .. py:attribute:: default_sort_param :value: 'common_name' .. py:attribute:: filterset_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: apply_filters(qs) Applies the `DeviceFilter` to the given queryset. :param qs: The base queryset to filter. :returns: The filtered queryset according to GET parameters. .. py:method:: get(request, *args, **kwargs) Adds the object model to the instance and forwards to super().get(). :param request: The Django request object. :param \*args: Positional arguments passed to super().get(). :param \*\*kwargs: Keyword arguments passed to super().get(). :returns: The HttpResponse object returned by super().get(). .. py:method:: get_queryset() :abstractmethod: Filter queryset to only include devices which are of generic type. :returns: Returns a queryset of all DeviceModels which are of generic type. .. py:method:: get_context_data(**kwargs) Adds the clm and revoke buttons to the context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:method:: get_ordering() Returns the sort parameters as a list. :returns: The sort parameters, if any. Otherwise the default sort parameter. .. py:class:: DeviceTableView Bases: :py:obj:`AbstractDeviceTableView` Device Table View. .. py:attribute:: template_name :value: 'devices/devices.html' .. py:attribute:: page_name :value: 'devices' .. py:method:: get_queryset() Filter queryset to include all device types (Generic, OPC UA GDS Push) and filtered by UI filters. :returns: Returns a queryset of all DeviceModels (excluding OPC UA GDS), filtered by UI filters. .. py:class:: OpcUaGdsTableView Bases: :py:obj:`DeviceTableView` Table View for devices where opc_ua_gds is True. .. py:attribute:: template_name :value: 'devices/opc_ua_gds.html' .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:method:: get_queryset() Filter queryset to only include devices which are of OPC-UA GDS type and filtered by UI filters. :returns: Returns a queryset of all DeviceModels which are of OPC-UA GDS type, filtered by UI filters. .. py:class:: AbstractCreateChooseOnboaringView(**kwargs) Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.base.TemplateView` Abstract view for choosing if the new device shall be onboarded or not. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: template_name :value: 'devices/create_choose_onboarding.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:class:: DeviceCreateChooseOnboardingView(**kwargs) Bases: :py:obj:`AbstractCreateChooseOnboaringView` View for choosing if the new device shall be onboarded or not. .. py:attribute:: page_name :value: 'devices' .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:class:: OpcUaGdsCreateChooseOnboardingView(**kwargs) Bases: :py:obj:`AbstractCreateChooseOnboaringView` View for choosing if the new OPC UA GDS shall be onboarded or not. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:class:: OpcUaGdsPushCreateChooseOnboardingView(**kwargs) Bases: :py:obj:`django.views.generic.base.RedirectView` Deprecated: Redirects to standard devices create page. .. py:attribute:: permanent :value: True .. py:attribute:: pattern_name :value: 'devices:devices_create' .. py:class:: AbstractCreateAddOnboardingTypeView(**kwargs) Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.base.TemplateView` Abstract view for choosing how new device shall be added. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: template_name :value: 'devices/add_onboarding_type.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:class:: DeviceCreateAddOnboardingTypeView(**kwargs) Bases: :py:obj:`AbstractCreateAddOnboardingTypeView` View for choosing how new device shall be added. .. py:attribute:: page_name :value: 'devices' .. py:class:: AbstractCreateNoOnboardingView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`devices.forms.NoOnboardingCreateForm`\ ] asdfds. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: form_class .. py:attribute:: template_name :value: 'devices/create.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:method:: form_valid(form) Saves the form / creates the device model object. :param form: The valid form. :returns: The HTTP Response to be returned. .. py:method:: get_success_url() Gets the success url to redirect to after successful processing of the POST data following a form submit. :returns: The success url to redirect to after successful processing of the POST data following a form submit. .. py:class:: DeviceCreateNoOnboardingView Bases: :py:obj:`AbstractCreateNoOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCreateNoOnboardingView Bases: :py:obj:`AbstractCreateNoOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractCreateOnboardingView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`django.forms.Form`\ ] asdfds. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: form_class :type: type[django.forms.Form] .. py:attribute:: template_name :value: 'devices/create.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:method:: form_valid(form) Saves the form / creates the device model object. :param form: The valid form. :returns: The HTTP Response to be returned. .. py:method:: get_success_url() Gets the success url to redirect to after successful processing of the POST data following a form submit. :returns: The success url to redirect to after successful processing of the POST data following a form submit. .. py:class:: DeviceCreateOnboardingView Bases: :py:obj:`AbstractCreateOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: DeviceCreateOpcUaGdsPushView Bases: :py:obj:`AbstractCreateOnboardingView` Create form view for OPC UA GDS Push devices in the devices section. .. py:attribute:: form_class .. py:attribute:: page_name :value: 'devices' .. py:method:: dispatch(request, *args, **kwargs) Check if SOFTWARE storage is configured before allowing GDS Push creation. :param request: The HTTP request object. :param \*args: Variable length argument list. :param \*\*kwargs: Arbitrary keyword arguments. :returns: The response object. :rtype: HttpResponseBase .. py:method:: form_valid(form) Saves the form / creates the device model object as OPC UA GDS Push type. :param form: The valid form. :returns: The HTTP Response to be returned. .. py:class:: OpcUaGdsCreateOnboardingView Bases: :py:obj:`AbstractCreateOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushCreateOnboardingView(**kwargs) Bases: :py:obj:`django.views.generic.base.RedirectView` Deprecated: Redirects to standard devices OPC UA GDS Push create page. .. py:attribute:: permanent :value: True .. py:attribute:: pattern_name :value: 'devices:devices_create_opc_ua_gds_push' .. py:class:: AbstractCertificateLifecycleManagementSummaryView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ], :py:obj:`abc.ABC` This is the CLM summary view in the devices section. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/credentials/certificate_lifecycle_management.html' .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: default_sort_param :value: 'common_name' .. py:attribute:: issued_creds_qs :type: django.db.models.QuerySet[pki.models.IssuedCredentialModel] .. py:attribute:: remote_issued_creds_qs :type: django.db.models.QuerySet[pki.models.RemoteIssuedCredentialModel] .. py:attribute:: domain_credentials_qs :type: django.db.models.QuerySet[pki.models.IssuedCredentialModel] | django.db.models.QuerySet[pki.models.RemoteIssuedCredentialModel] .. py:attribute:: application_credentials_qs :type: django.db.models.QuerySet[pki.models.IssuedCredentialModel] | django.db.models.QuerySet[pki.models.RemoteIssuedCredentialModel] .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_issued_creds_qs() Gets a sorted queryset of all IssuedCredentialModels. :returns: Sorted queryset of all IssuedCredentialModels. .. py:method:: get_remote_issued_creds_qs() Gets a sorted queryset of all RemoteIssuedCredentialModels for RA-issued certs. .. py:method:: get_domain_credentials_qs() Gets domain credentials — from RemoteIssuedCredentialModel for RA domains, otherwise IssuedCredentialModel. self.get_issued_creds_qs() or self.get_remote_issued_creds_qs() must be called first! :returns: Sorted queryset of domain credentials. .. py:method:: get_application_credentials_qs() Gets application credentials — from RemoteIssuedCredentialModel for RA domains. self.get_issued_creds_qs() or self.get_remote_issued_creds_qs() must be called first! :returns: Sorted queryset of application credentials. .. py:method:: get_context_data(**kwargs) Adds the paginator and credential details to the context. .. py:method:: get_onboarding_initial() Gets the initial values for onboarding. :returns: Initial values for onboarding. .. py:method:: get_no_onboarding_initial() Gets the initial values for no onboarding. :returns: Initial values for no onboarding. .. py:method:: get_onboarding_form() Gets the form for onboarding. :returns: The onboarding form. .. py:method:: get_no_onboarding_form() Gets the form for no onboarding. :returns: The no onboarding form. .. py:method:: get_device_form() Gets the device Form for onboarding or no onboarding. :returns: The required form. .. py:method:: post(request, *_args, **kwargs) Handles the POST request used for device form submission. :param request: The django request object. :param _args: Positional arguments are discarded. :param kwargs: Keyword arguments are passed to get_context_data. :returns: The HttpResponse. .. py:class:: DeviceCertificateLifecycleManagementSummaryView Bases: :py:obj:`AbstractCertificateLifecycleManagementSummaryView` Certificate Lifecycle Management Summary View for devices. .. py:attribute:: page_name :value: 'devices' .. py:method:: dispatch(request, *args, **kwargs) Redirect OPC UA GDS Push devices to their specific view if GDS Push is the only protocol. .. py:class:: OpcUaGdsCertificateLifecycleManagementSummaryView Bases: :py:obj:`AbstractCertificateLifecycleManagementSummaryView` Certificate Lifecycle Management Summary View for OPC UA Devcies. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushCertificateLifecycleManagementSummaryView Bases: :py:obj:`AbstractCertificateLifecycleManagementSummaryView` Certificate Lifecycle Management Summary View for OPC UA GDS Push devices. .. py:attribute:: page_name :value: 'devices' .. py:method:: get_context_data(**kwargs) Add OPC UA GDS Push specific context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: get_onboarding_initial() Gets the initial values for onboarding for GDS Push. :returns: Initial values for onboarding. .. py:method:: get_onboarding_form() Gets the form for GDS Push onboarding. :returns: The GDS Push onboarding form. .. py:method:: post(request, *_args, **kwargs) Handles the POST request used for device form submission. :param request: The django request object. :param _args: Positional arguments are discarded. :param kwargs: Keyword arguments are passed to get_context_data. :returns: The HttpResponse. .. py:class:: AbstractNoOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] abc. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/issue_credential.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the sections to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: get(request, *_args, **_kwargs) Adds checks if the device is configured for no-onboarding and has a domain set. :param request: The django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: The HttpResponse Or HttpRedirect to the CLM page. .. py:class:: DeviceNoOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractNoOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsNoOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractNoOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractSelectCertificateProfileNewApplicationCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] abc. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/profile_select.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the sections to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:class:: DeviceSelectCertificateProfileNewApplicationCredentialView Bases: :py:obj:`AbstractSelectCertificateProfileNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsSelectCertificateProfileNewApplicationCredentialView Bases: :py:obj:`AbstractSelectCertificateProfileNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] abc. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/issue_credential.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the sections to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:class:: DeviceOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractOnboardingIssueNewApplicationCredentialView` View for issuing application credentials for OPC UA GDS Push devices - redirects directly to help page. .. py:attribute:: page_name :value: 'devices' .. py:method:: get(request, *_args, **_kwargs) Redirect directly to the GDS Push application certificate help page if GDS Push is the only protocol. .. py:class:: AbstractIssueCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.edit.FormMixin`\ [\ :py:obj:`django.forms.Form`\ ], :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] Base view for all credential issuance views. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/issue_application_credential.html' .. py:attribute:: form_class :type: type[django.forms.Form] .. py:attribute:: issuer_class :type: type[AbstractIssueCredentialView.IssuerClass] .. py:attribute:: friendly_name :type: str .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the form to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: get_form_kwargs() This method adds the concerning device model to the form kwargs and returns them. :returns: The form kwargs including the concerning device model. .. py:method:: issue_credential(device, form) :abstractmethod: Abstract method to issue a credential. :param device: The device to be associated with the new credential. :param form: The form instance containing the validated data. :returns: The IssuedCredentialModel object that was created and saved. .. py:method:: post(request, *_args, **_kwargs) Adds the object model to the instance and forwards to super().post(). :param request: The Django request object is only used implicitly through self. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: The HttpResponseBase object returned by super().post(). .. py:class:: AbstractIssueDomainCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`devices.forms.IssueDomainCredentialForm`\ , :py:obj:`devices.issuer.LocalDomainCredentialIssuer`\ ] Base view for issuing domain credentials. .. py:attribute:: form_class :type: type[devices.forms.BaseCredentialForm] .. py:attribute:: template_name :value: 'devices/credentials/issue_domain_credential.html' .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'Domain Credential' .. py:method:: issue_credential(device, _form) Issue a domain credential for the device. :param device: The device to issue the credential for. :param _form: The form instance containing the validated data. :returns: The issued credential model. .. py:class:: DeviceIssueDomainCredentialView Bases: :py:obj:`AbstractIssueDomainCredentialView` View for issuing domain credentials for devices. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueDomainCredentialView Bases: :py:obj:`AbstractIssueDomainCredentialView` View for issuing domain credentials for OPC-UA GDS devices. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushIssueDomainCredentialView Bases: :py:obj:`AbstractIssueDomainCredentialView` View for issuing domain credentials for OPC-UA GDS Push devices. .. py:attribute:: form_class .. py:attribute:: page_name :value: 'devices' .. py:method:: issue_credential(device, form) Issues a domain credential for the device with OPC UA specific extensions. :param device: The device to be associated with the new credential. :param form: The form instance containing the validated data. :returns: The IssuedCredentialModel object that was created and saved. .. py:method:: post(request, *_args, **_kwargs) Handle the POST request with custom redirect to truststore association. .. py:class:: OpcUaGdsPushDiscoverServerView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to discover OPC UA server information without authentication. .. py:attribute:: http_method_names :value: ('post',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: page_name :value: 'devices' .. py:method:: post(request, *_args, **_kwargs) Handle the POST request to discover server information. .. py:class:: OpcUaGdsPushTruststoreAssociationView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`devices.forms.OpcUaGdsPushTruststoreAssociationForm`\ ] View for associating a truststore with an OPC UA GDS Push device's onboarding configuration. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'devices/truststore_association.html' .. py:attribute:: page_name :value: 'devices' .. py:method:: get_form_kwargs() Add the device instance to the form kwargs. .. py:method:: get_device() Get the device from the URL parameters. .. py:method:: get_context_data(**kwargs) Add the device and import form to the context. .. py:method:: post(request, *args, **kwargs) Handle both association and import form submissions. .. py:method:: form_valid(form) Handle successful form submission. .. py:class:: AbstractIssueProfileCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`pki.forms.cert_profiles.CertificateIssuanceForm`\ , :py:obj:`devices.issuer.BaseTlsCredentialIssuer`\ ] View to issue a new certificate profile credential. .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'Certificate Profile Credential' .. py:attribute:: page_name :type: str .. py:attribute:: template_name :value: 'pki/cert_profiles/issuance.html' .. py:attribute:: form_class .. py:method:: dispatch(request, *args, **kwargs) Dispatch the request, ensuring the profile exists. .. py:method:: get_form_kwargs() Get form kwargs, including the profile. .. py:method:: get_context_data(**kwargs) Add additional context data. .. py:method:: form_invalid(form) Handle the case where the form is invalid. .. py:method:: form_valid(form) Handle the case where the form is valid. .. py:method:: issue_credential(device, form) Issues a credential based on the selected certificate profile. :param device: The device to be associated with the new credential. :param form: The form instance containing the validated data. :returns: The IssuedCredentialModel object that was created and saved. .. py:class:: DeviceIssueProfileCredentialView Bases: :py:obj:`AbstractIssueProfileCredentialView` Issue a new certificate profile credential within the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueProfileCredentialView Bases: :py:obj:`AbstractIssueProfileCredentialView` Issue a new certificate profile credential within the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: DownloadTokenRequiredAuthenticationMixin Mixin which checks the token included in the URL for browser download views. .. py:attribute:: credential_download :type: devices.models.RemoteDeviceCredentialDownloadModel .. py:method:: dispatch(request, *args, **kwargs) Checks the validity of the token included in the URL for browser download views and redirects if invalid. :param request: The django request object. :param \*args: Positional arguments passed to super().dispatch(). :param \*\*kwargs: Keyword arguments passed to super().dispatch(). :returns: A Django HttpResponseBase object. .. py:class:: AbstractDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.base.RedirectView` Redirects depending on the type of credential, that is if a private key is available or not. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model :type: type[pki.models.IssuedCredentialModel] .. py:attribute:: permanent :value: False .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_redirect_url(*_args, **kwargs) Gets the redirection URL depending on the type credential, that is if a private key is available or not. :param \*_args: Positional arguments are discarded. :param \*\*kwargs: The pk parameter is retrieved and expected to be there. :returns: The redirect URL. .. py:class:: DeviceDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`AbstractDownloadPageDispatcherView` Download dispatcher view for the device pages. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`AbstractDownloadPageDispatcherView` Download dispatcher view for the OPC UA GDS pages. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`AbstractDownloadPageDispatcherView` Download dispatcher view for the OPC UA GDS Push pages. .. py:attribute:: page_name :value: 'devices' .. py:class:: AbstractCertificateDownloadView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.IssuedCredentialModel`\ ] View for downloading certificates. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model :type: type[pki.models.IssuedCredentialModel] .. py:attribute:: template_name :value: 'devices/credentials/certificate_download.html' .. py:attribute:: context_object_name :value: 'issued_credential' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the clm_url to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:class:: DeviceCertificateDownloadView Bases: :py:obj:`AbstractCertificateDownloadView` Certificate download view for the device pages. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCertificateDownloadView Bases: :py:obj:`AbstractCertificateDownloadView` Certificate download view for the OPC UA GDS pages. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushCertificateDownloadView Bases: :py:obj:`AbstractCertificateDownloadView` Certificate download view for the OPC UA GDS Push pages. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsPushUpdateTrustlistView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to update the trustlist on an OPC UA GDS Push device. .. py:attribute:: http_method_names :value: ('post',) .. py:attribute:: model .. py:attribute:: page_name :value: 'devices' .. py:attribute:: page_category :value: 'devices' .. py:method:: post(request, *_args, **_kwargs) Handle the POST request to update the trustlist. :param request: The Django request object. :param _args: Positional arguments are discarded. :param kwargs: Keyword arguments are passed to get_object(). :returns: HttpResponse redirecting back to the help page. .. py:class:: OpcUaGdsPushUpdateServerCertificateView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to update the server certificate on an OPC UA GDS Push device. .. py:attribute:: http_method_names :value: ('post',) .. py:attribute:: model .. py:attribute:: page_name :value: 'devices' .. py:attribute:: page_category :value: 'devices' .. py:method:: post(request, *_args, **_kwargs) Handle the POST request to update the server certificate. :param request: The Django request object. :param _args: Positional arguments are discarded. :param kwargs: Keyword arguments are passed to get_object(). :returns: HttpResponse redirecting back to the help page. .. py:class:: OpcUaGdsPushCertRenewalSettingsView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to save the periodic server certificate and trustlist renewal settings for an OPC UA GDS Push device. .. py:attribute:: http_method_names :value: ('post',) .. py:attribute:: model .. py:attribute:: page_name :value: 'devices' .. py:attribute:: page_category :value: 'devices' .. py:method:: post(request, *_args, **_kwargs) Handle the POST request to update the renewal settings. :param request: The Django request object. :param _args: Positional arguments are discarded. :param _kwargs: Keyword arguments are discarded. :returns: HttpResponse redirecting back to the help page. .. py:class:: TrustBundleDownloadView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.ca.CaModel`\ ] View to download the trust bundle (CA certificates and CRLs) for a given Issuing CA. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:method:: get(request, *args, **kwargs) Handle the GET request to download the trust bundle. :param request: The Django request object. :param \*args: Additional positional arguments. :param \*\*kwargs: Additional keyword arguments. :returns: FileResponse with the trust bundle zip file. .. py:class:: AbstractDeviceBaseCredentialDownloadView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.IssuedCredentialModel`\ ] View to download a password protected application credential in the desired format. Inherited by the domain and application credential download views. It is not intended for direct use. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/credentials/credential_download.html' .. py:attribute:: context_object_name :value: 'credential' .. py:attribute:: form_class .. py:attribute:: is_browser_download :value: False .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds information about the credential to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: post(_request, *_args, **_kwargs) Processing the valid form data. This will use the contained form data to start the download process of the desired file. :param _request: The django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: If successful, this will start the file download. Otherwise, a Http404 will be raised and displayed. .. py:class:: DeviceManualCredentialDownloadView Bases: :py:obj:`AbstractDeviceBaseCredentialDownloadView` View to download a password protected domain or application credential in the desired format. .. py:attribute:: page_name :value: 'devices' .. py:class:: DeviceBrowserCredentialDownloadView Bases: :py:obj:`DownloadTokenRequiredAuthenticationMixin`, :py:obj:`AbstractDeviceBaseCredentialDownloadView` View to download a password protected domain or app credential in the desired format from a remote client. .. py:attribute:: is_browser_download :value: True .. py:class:: AbstractBrowserOnboardingOTPView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.IssuedCredentialModel`\ ] View to display the OTP for remote credential download (aka. browser onboarding). .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/credentials/onboarding/browser/otp_view.html' .. py:attribute:: redirection_view :value: 'devices:devices' .. py:attribute:: context_object_name :value: 'credential' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds information about the credential and otp for the browser download process. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to render the page. .. py:class:: DeviceBrowserOnboardingOTPView Bases: :py:obj:`AbstractBrowserOnboardingOTPView` The browser onboarding OTP view for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBrowserOnboardingOTPView Bases: :py:obj:`AbstractBrowserOnboardingOTPView` The browser onboarding OTP view for the OPC UA GDS section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractBrowserOnboardingCancelView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.IssuedCredentialModel`\ ] View to cancel the browser onboarding process and delete the associated RemoteDeviceCredentialDownloadModel. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'credential' .. py:attribute:: permanent :value: False .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get(request, *_args, **_kwargs) Cancels the browser onboarding process and deletes the associated RemoteDeviceCredentialDownloadModel. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: The HttpResponseBase object with the desired redirection URL. .. py:class:: DeviceBrowserOnboardingCancelView Bases: :py:obj:`AbstractBrowserOnboardingCancelView` Cancels the browser onboarding for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBrowserOnboardingCancelView Bases: :py:obj:`AbstractBrowserOnboardingCancelView` Cancels the browser onboarding for the OPC UA GDS section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: DeviceOnboardingBrowserLoginView Bases: :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`devices.forms.BrowserLoginForm`\ ] View to handle certificate download requests. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: template_name :value: 'devices/credentials/onboarding/browser/login.html' .. py:attribute:: form_class .. py:attribute:: cleaned_data :type: dict[str, Any] .. py:method:: get_success_url() Gets the success url to redirect to after successful processing of the POST data following a form submit. :returns: The success url to redirect to after successful processing of the POST data following a form submit. .. py:method:: form_invalid(form) Adds an error message in the case of an invalid OTP. :param form: The corresponding form object. :returns: The Django HttpResponse object. .. py:method:: form_valid(form) Performed if the form was validated successfully and adds the cleaned data to the instance. :param form: The corresponding form object. :returns: The Django HttpResponse object. .. py:class:: AbstractIssuedCredentialRevocationView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.IssuedCredentialModel`\ ] Revokes a specific issued credential. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/confirm_revoke.html' .. py:attribute:: context_object_name :value: 'issued_credential' .. py:attribute:: pk_url_kwarg :value: 'pk' .. py:attribute:: form_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the primary keys to the context. :param kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data. .. py:method:: post(_request, *_args, **_kwargs) Will try to revoke the requested issued credential. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: Redirect to the devices summary. .. py:class:: DeviceIssuedCredentialRevocationView Bases: :py:obj:`AbstractIssuedCredentialRevocationView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssuedCredentialRevocationView Bases: :py:obj:`AbstractIssuedCredentialRevocationView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushIssuedCredentialRevocationView Bases: :py:obj:`AbstractIssuedCredentialRevocationView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: AbstractBulkRevokeView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to confirm the deletion of multiple Devices. .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/confirm_bulk_revoke.html' .. py:attribute:: context_object_name :value: 'devices' .. py:attribute:: missing :type: str :value: '' .. py:attribute:: pks :type: str :value: '' .. py:attribute:: queryset :type: django.db.models.QuerySet[devices.models.DeviceModel] .. py:attribute:: form_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the primary keys to the context. :param kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data. .. py:method:: get_queryset() Gets the queryset of DeviceModel objects that are requested to be revoked. :returns: The queryset of DeviceModel objects that are requested to be revoked. .. py:method:: get(request, *args, **kwargs) HTTP GET processing. :param request: The Django request object. :param \*args: Positional arguments passed to super().get(). :param \*\*kwargs: Keyword arguments passed to super().get(). :returns: The device deletion view or a redirect to the devices view if one or more pks were not found. .. py:method:: post(request, *_args, **_kwargs) Will try to revoke all certificate assiciated with the requested DeviceModel records. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: Redirect to the devices summary. .. py:class:: DeviceBulkRevokeView Bases: :py:obj:`AbstractBulkRevokeView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBulkRevokeView Bases: :py:obj:`AbstractBulkRevokeView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsPushBulkRevokeView Bases: :py:obj:`AbstractBulkRevokeView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: AbstractBulkDeleteView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to confirm the deletion of multiple Devices. .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/confirm_delete.html' .. py:attribute:: context_object_name :value: 'devices' .. py:attribute:: missing :type: str :value: '' .. py:attribute:: pks :type: str :value: '' .. py:attribute:: queryset :type: django.db.models.QuerySet[devices.models.DeviceModel] .. py:attribute:: form_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the primary keys to the context. :param kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data. .. py:method:: get_queryset() Gets the queryset of DeviceModel objects that are requested to be deleted. :returns: The queryset of DeviceModel objects that are requested to be deleted. .. py:method:: get(request, *args, **kwargs) HTTP GET processing. :param request: The Django request object. :param \*args: Positional arguments passed to super().get(). :param \*\*kwargs: Keyword arguments passed to super().get(). :returns: The device deletion view or a redirect to the devices view if one or more pks were not found. .. py:method:: post(request, *_args, **_kwargs) HTTP POST processing which will try to delete all requested DeviceModel records. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: Redirect to the devices summary. .. py:class:: DeviceBulkDeleteView Bases: :py:obj:`AbstractBulkDeleteView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBulkDeleteView Bases: :py:obj:`AbstractBulkDeleteView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: OpcUaGdsPushBulkDeleteView Bases: :py:obj:`AbstractBulkDeleteView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: DeviceViewSet(**kwargs) Bases: :py:obj:`rest_framework.viewsets.ModelViewSet`\ [\ :py:obj:`devices.models.DeviceModel`\ ] ViewSet for managing Device instances. Supports standard CRUD operations such as list, retrieve, create, update, and delete. .. py:attribute:: queryset .. py:attribute:: serializer_class .. py:attribute:: action_descriptions :type: ClassVar[dict[str, str]] .. py:method:: get_view_description(html = False) Return a description for the given action.