From dc87cfa9ab5b242119d24b5a5637177dc5d20edd Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Tue, 9 Jan 2024 14:59:59 -0600 Subject: [PATCH] NIFI-12591 Upgraded from Swagger Annotations 1.6.12 to 2.2.20 - Added nifi-swagger-integration with ObjectMapperProcessor for enum customization - Changed nifi-web-api REST API documentation to use HTML template from swagger-codegen-maven-plugin Upgraded references in multiple modules: - c2-protocol-api - c2-protocol-component-api - minifi-c2-service - nifi-api - nifi-client-dto - nifi-extension-manifest-model - nifi-registry-revision-entity-model - nifi-registry-data-model - nifi-registry-web-api - nifi-web-api Signed-off-by: Csaba Bejan This closes #8232. --- .../nifi/c2/protocol/api/AgentInfo.java | 19 +- .../nifi/c2/protocol/api/AgentManifest.java | 7 +- .../c2/protocol/api/AgentRepositories.java | 5 - .../protocol/api/AgentRepositoryStatus.java | 16 +- .../api/AgentResourceConsumption.java | 9 +- .../nifi/c2/protocol/api/AgentStatus.java | 13 +- .../nifi/c2/protocol/api/C2Heartbeat.java | 24 +- .../c2/protocol/api/C2HeartbeatResponse.java | 4 - .../nifi/c2/protocol/api/C2Operation.java | 22 +- .../nifi/c2/protocol/api/C2OperationAck.java | 15 +- .../c2/protocol/api/C2OperationState.java | 11 +- .../nifi/c2/protocol/api/ComponentStatus.java | 4 - .../nifi/c2/protocol/api/DeviceInfo.java | 13 +- .../apache/nifi/c2/protocol/api/FlowInfo.java | 13 +- .../nifi/c2/protocol/api/FlowQueueStatus.java | 16 +- .../apache/nifi/c2/protocol/api/FlowUri.java | 6 +- .../apache/nifi/c2/protocol/api/Location.java | 6 - .../nifi/c2/protocol/api/NetworkInfo.java | 11 +- .../nifi/c2/protocol/api/Operation.java | 25 +- .../c2/protocol/api/SupportedOperation.java | 9 +- .../nifi/c2/protocol/api/SystemInfo.java | 16 +- .../c2-protocol-component-api/pom.xml | 2 +- .../c2/protocol/component/api/Attribute.java | 8 +- .../c2/protocol/component/api/BuildInfo.java | 17 +- .../c2/protocol/component/api/Bundle.java | 21 +- .../component/api/ComponentManifest.java | 13 +- .../api/ConfigurableExtensionDefinition.java | 10 +- .../api/ControllerServiceDefinition.java | 3 - .../protocol/component/api/DefinedType.java | 17 +- .../component/api/DynamicProperty.java | 12 +- .../component/api/DynamicRelationship.java | 8 +- .../component/api/ExtensionComponent.java | 30 +- .../component/api/ProcessorDefinition.java | 42 +- .../component/api/PropertyAllowableValue.java | 10 +- .../component/api/PropertyDependency.java | 10 +- .../component/api/PropertyDescriptor.java | 36 +- .../api/PropertyResourceDefinition.java | 8 +- .../protocol/component/api/Relationship.java | 9 +- .../api/ReportingTaskDefinition.java | 10 +- .../protocol/component/api/Restriction.java | 8 +- .../component/api/RuntimeManifest.java | 20 +- .../component/api/SchedulingDefaults.java | 20 +- .../c2/protocol/component/api/Stateful.java | 8 +- .../api/SystemResourceConsideration.java | 8 +- minifi/minifi-c2/minifi-c2-service/pom.xml | 2 +- .../nifi/minifi/c2/service/ConfigService.java | 45 +- nifi-api/pom.xml | 2 +- .../java/org/apache/nifi/flow/BatchSize.java | 8 +- .../java/org/apache/nifi/flow/Bundle.java | 8 +- .../nifi/flow/ConnectableComponent.java | 14 +- .../nifi/flow/ControllerServiceAPI.java | 6 +- .../ExternalControllerServiceReference.java | 9 +- .../nifi/flow/ParameterProviderReference.java | 13 +- .../java/org/apache/nifi/flow/Position.java | 9 +- .../apache/nifi/flow/VersionedComponent.java | 14 +- .../flow/VersionedConfigurableExtension.java | 10 +- .../apache/nifi/flow/VersionedConnection.java | 33 +- .../nifi/flow/VersionedControllerService.java | 10 +- .../nifi/flow/VersionedFlowAnalysisRule.java | 6 +- .../nifi/flow/VersionedFlowCoordinates.java | 14 +- .../flow/VersionedFlowRegistryClient.java | 6 +- .../org/apache/nifi/flow/VersionedLabel.java | 14 +- .../apache/nifi/flow/VersionedParameter.java | 12 +- .../nifi/flow/VersionedParameterContext.java | 14 +- .../nifi/flow/VersionedParameterProvider.java | 12 +- .../org/apache/nifi/flow/VersionedPort.java | 12 +- .../nifi/flow/VersionedProcessGroup.java | 44 +- .../apache/nifi/flow/VersionedProcessor.java | 42 +- .../flow/VersionedPropertyDescriptor.java | 14 +- .../nifi/flow/VersionedRemoteGroupPort.java | 14 +- .../flow/VersionedRemoteProcessGroup.java | 22 +- .../nifi/flow/VersionedReportingTask.java | 10 +- .../flow/VersionedReportingTaskSnapshot.java | 9 +- .../flow/VersionedResourceDefinition.java | 6 +- nifi-commons/nifi-swagger-integration/pom.xml | 34 + .../StandardObjectMapperProcessor.java | 33 + nifi-commons/pom.xml | 1 + .../nifi-extension-manifest-model/pom.xml | 2 +- .../extension/manifest/AllowableValue.java | 12 +- .../nifi/extension/manifest/Attribute.java | 8 +- .../nifi/extension/manifest/BuildInfo.java | 16 +- .../nifi/extension/manifest/Cardinality.java | 3 - .../manifest/ControllerServiceDefinition.java | 12 +- .../extension/manifest/DefaultSchedule.java | 10 +- .../extension/manifest/DefaultSettings.java | 10 +- .../nifi/extension/manifest/Dependency.java | 10 +- .../extension/manifest/DependentValues.java | 6 +- .../extension/manifest/DeprecationNotice.java | 8 +- .../extension/manifest/DynamicProperty.java | 14 +- .../manifest/DynamicRelationship.java | 10 +- .../manifest/ExpressionLanguageScope.java | 3 - .../nifi/extension/manifest/Extension.java | 58 +- .../extension/manifest/ExtensionManifest.java | 18 +- .../extension/manifest/InputRequirement.java | 3 - .../manifest/MultiProcessorUseCase.java | 3 - .../nifi/extension/manifest/ParentNar.java | 10 +- .../manifest/ProcessorConfiguration.java | 3 - .../nifi/extension/manifest/Property.java | 32 +- .../manifest/ProvidedServiceAPI.java | 12 +- .../nifi/extension/manifest/Relationship.java | 10 +- .../manifest/ResourceDefinition.java | 8 +- .../nifi/extension/manifest/ResourceType.java | 3 - .../nifi/extension/manifest/Restricted.java | 8 +- .../nifi/extension/manifest/Restriction.java | 8 +- .../apache/nifi/extension/manifest/Scope.java | 3 - .../nifi/extension/manifest/Stateful.java | 8 +- .../manifest/SystemResourceConsideration.java | 8 +- .../nifi/extension/manifest/UseCase.java | 3 - .../nifi-framework/nifi-client-dto/pom.xml | 2 +- .../org/apache/nifi/web/api/dto/AboutDTO.java | 35 +- .../web/api/dto/AccessConfigurationDTO.java | 7 +- .../nifi/web/api/dto/AccessPolicyDTO.java | 6 +- .../web/api/dto/AccessPolicySummaryDTO.java | 11 +- .../nifi/web/api/dto/AccessStatusDTO.java | 17 +- .../web/api/dto/AccessTokenExpirationDTO.java | 9 +- .../web/api/dto/AffectedComponentDTO.java | 18 +- .../nifi/web/api/dto/AllowableValueDTO.java | 11 +- .../web/api/dto/AnalyzeFlowRequestDTO.java | 4 +- .../web/api/dto/AsynchronousRequestDTO.java | 20 +- .../apache/nifi/web/api/dto/BannerDTO.java | 8 +- .../nifi/web/api/dto/BatchSettingsDTO.java | 11 +- .../nifi/web/api/dto/BulletinBoardDTO.java | 10 +- .../apache/nifi/web/api/dto/BulletinDTO.java | 34 +- .../nifi/web/api/dto/BulletinQueryDTO.java | 20 +- .../apache/nifi/web/api/dto/BundleDTO.java | 11 +- .../apache/nifi/web/api/dto/ClusterDTO.java | 10 +- .../nifi/web/api/dto/ClusterSummaryDTO.java | 14 +- .../apache/nifi/web/api/dto/ComponentDTO.java | 13 +- .../web/api/dto/ComponentDifferenceDTO.java | 12 +- .../nifi/web/api/dto/ComponentHistoryDTO.java | 8 +- .../web/api/dto/ComponentReferenceDTO.java | 11 +- .../ComponentRestrictionPermissionDTO.java | 8 +- .../nifi/web/api/dto/ComponentStateDTO.java | 14 +- .../api/dto/ComponentValidationResultDTO.java | 8 +- .../api/dto/ConfigVerificationResultDTO.java | 8 +- .../web/api/dto/ConfigurationAnalysisDTO.java | 10 +- .../nifi/web/api/dto/ConnectableDTO.java | 34 +- .../nifi/web/api/dto/ConnectionDTO.java | 50 +- .../api/dto/ControllerConfigurationDTO.java | 5 +- .../nifi/web/api/dto/ControllerDTO.java | 53 +- .../web/api/dto/ControllerServiceApiDTO.java | 8 +- .../web/api/dto/ControllerServiceDTO.java | 69 +- ...trollerServiceReferencingComponentDTO.java | 38 +- .../apache/nifi/web/api/dto/CounterDTO.java | 17 +- .../apache/nifi/web/api/dto/CountersDTO.java | 6 +- .../nifi/web/api/dto/CountersSnapshotDTO.java | 9 +- .../nifi/web/api/dto/DifferenceDTO.java | 6 +- .../nifi/web/api/dto/DimensionsDTO.java | 8 +- .../nifi/web/api/dto/DocumentedTypeDTO.java | 29 +- .../nifi/web/api/dto/DropRequestDTO.java | 57 +- .../web/api/dto/ExplicitRestrictionDTO.java | 8 +- .../nifi/web/api/dto/FlowAnalysisRuleDTO.java | 54 +- .../web/api/dto/FlowConfigurationDTO.java | 36 +- .../apache/nifi/web/api/dto/FlowFileDTO.java | 23 +- .../nifi/web/api/dto/FlowFileSummaryDTO.java | 35 +- .../web/api/dto/FlowRegistryBucketDTO.java | 10 +- .../web/api/dto/FlowRegistryClientDTO.java | 43 +- .../nifi/web/api/dto/FlowSnippetDTO.java | 29 +- .../web/api/dto/FlowUpdateRequestDTO.java | 18 +- .../nifi/web/api/dto/JmxMetricsResultDTO.java | 8 +- .../org/apache/nifi/web/api/dto/LabelDTO.java | 17 +- .../nifi/web/api/dto/ListingRequestDTO.java | 41 +- .../web/api/dto/NodeCountersSnapshotDTO.java | 10 +- .../org/apache/nifi/web/api/dto/NodeDTO.java | 61 +- .../apache/nifi/web/api/dto/NodeEventDTO.java | 13 +- .../dto/NodeSystemDiagnosticsSnapshotDTO.java | 10 +- .../nifi/web/api/dto/ParameterContextDTO.java | 16 +- .../api/dto/ParameterContextReferenceDTO.java | 6 +- .../dto/ParameterContextUpdateRequestDTO.java | 8 +- .../ParameterContextValidationRequestDTO.java | 8 +- .../apache/nifi/web/api/dto/ParameterDTO.java | 27 +- ...eterProviderApplyParametersRequestDTO.java | 12 +- .../ParameterProviderConfigurationDTO.java | 10 +- .../web/api/dto/ParameterProviderDTO.java | 57 +- ...ameterProviderReferencingComponentDTO.java | 8 +- .../nifi/web/api/dto/ParameterStatusDTO.java | 6 +- .../nifi/web/api/dto/PermissionsDTO.java | 12 +- .../org/apache/nifi/web/api/dto/PortDTO.java | 28 +- .../apache/nifi/web/api/dto/PositionDTO.java | 8 +- .../nifi/web/api/dto/PreviousValueDTO.java | 13 +- .../nifi/web/api/dto/ProcessGroupDTO.java | 85 +- .../nifi/web/api/dto/ProcessGroupNameDTO.java | 6 +- .../nifi/web/api/dto/ProcessorConfigDTO.java | 68 +- .../apache/nifi/web/api/dto/ProcessorDTO.java | 65 +- .../api/dto/ProcessorRunStatusDetailsDTO.java | 13 +- .../web/api/dto/PropertyDependencyDTO.java | 6 +- .../web/api/dto/PropertyDescriptorDTO.java | 40 +- .../nifi/web/api/dto/PropertyHistoryDTO.java | 5 +- .../apache/nifi/web/api/dto/QueueSizeDTO.java | 8 +- .../nifi/web/api/dto/ReadablePermission.java | 7 +- .../nifi/web/api/dto/RelationshipDTO.java | 14 +- .../dto/RemoteProcessGroupContentsDTO.java | 8 +- .../web/api/dto/RemoteProcessGroupDTO.java | 63 +- .../api/dto/RemoteProcessGroupPortDTO.java | 39 +- .../nifi/web/api/dto/ReportingTaskDTO.java | 69 +- .../web/api/dto/RequiredPermissionDTO.java | 8 +- .../apache/nifi/web/api/dto/ResourceDTO.java | 8 +- .../apache/nifi/web/api/dto/RevisionDTO.java | 22 +- .../apache/nifi/web/api/dto/SnippetDTO.java | 41 +- .../nifi/web/api/dto/StateEntryDTO.java | 14 +- .../apache/nifi/web/api/dto/StateMapDTO.java | 11 +- .../web/api/dto/SystemDiagnosticsDTO.java | 6 +- .../api/dto/SystemDiagnosticsSnapshotDTO.java | 141 +- .../apache/nifi/web/api/dto/TenantDTO.java | 6 +- .../nifi/web/api/dto/UpdateStepDTO.java | 8 +- .../org/apache/nifi/web/api/dto/UserDTO.java | 12 +- .../apache/nifi/web/api/dto/UserGroupDTO.java | 9 +- .../web/api/dto/VerifyConfigRequestDTO.java | 12 +- .../api/dto/VersionControlInformationDTO.java | 28 +- .../nifi/web/api/dto/VersionedFlowDTO.java | 16 +- .../dto/VersionedFlowUpdateRequestDTO.java | 6 +- .../nifi/web/api/dto/WritablePermission.java | 7 +- .../nifi/web/api/dto/action/ActionDTO.java | 31 +- .../nifi/web/api/dto/action/HistoryDTO.java | 13 +- .../web/api/dto/action/HistoryQueryDTO.java | 30 +- .../details/ExtensionDetailsDTO.java | 5 +- .../details/RemoteProcessGroupDetailsDTO.java | 5 +- .../action/details/ConfigureDetailsDTO.java | 11 +- .../dto/action/details/ConnectDetailsDTO.java | 23 +- .../dto/action/details/MoveDetailsDTO.java | 14 +- .../dto/action/details/PurgeDetailsDTO.java | 7 +- .../ClassLoaderDiagnosticsDTO.java | 6 +- .../diagnostics/ConnectionDiagnosticsDTO.java | 10 +- .../ConnectionDiagnosticsSnapshotDTO.java | 10 +- .../ControllerServiceDiagnosticsDTO.java | 6 +- .../diagnostics/GCDiagnosticsSnapshotDTO.java | 8 +- .../GarbageCollectionDiagnosticsDTO.java | 6 +- .../JVMControllerDiagnosticsSnapshotDTO.java | 8 +- .../dto/diagnostics/JVMDiagnosticsDTO.java | 10 +- .../JVMDiagnosticsSnapshotDTO.java | 22 +- .../JVMFlowDiagnosticsSnapshotDTO.java | 10 +- .../JVMSystemDiagnosticsSnapshotDTO.java | 26 +- .../diagnostics/LocalQueuePartitionDTO.java | 24 +- .../NodeGCDiagnosticsSnapshotDTO.java | 10 +- .../NodeJVMDiagnosticsSnapshotDTO.java | 10 +- .../diagnostics/ProcessorDiagnosticsDTO.java | 18 +- .../diagnostics/RemoteQueuePartitionDTO.java | 22 +- .../dto/diagnostics/RepositoryUsageDTO.java | 16 +- .../api/dto/diagnostics/ThreadDumpDTO.java | 16 +- .../web/api/dto/flow/FlowBreadcrumbDTO.java | 11 +- .../apache/nifi/web/api/dto/flow/FlowDTO.java | 26 +- .../web/api/dto/flow/ProcessGroupFlowDTO.java | 24 +- .../web/api/dto/provenance/AttributeDTO.java | 11 +- .../web/api/dto/provenance/ProvenanceDTO.java | 30 +- .../dto/provenance/ProvenanceEventDTO.java | 127 +- .../dto/provenance/ProvenanceOptionsDTO.java | 5 +- .../dto/provenance/ProvenanceRequestDTO.java | 33 +- .../dto/provenance/ProvenanceResultsDTO.java | 27 +- .../provenance/ProvenanceSearchValueDTO.java | 8 +- .../ProvenanceSearchableFieldDTO.java | 14 +- .../dto/provenance/lineage/LineageDTO.java | 30 +- .../provenance/lineage/LineageRequestDTO.java | 18 +- .../provenance/lineage/LineageResultsDTO.java | 11 +- .../provenance/lineage/ProvenanceLinkDTO.java | 19 +- .../provenance/lineage/ProvenanceNodeDTO.java | 31 +- .../nifi/web/api/dto/remote/PeerDTO.java | 14 +- .../dto/search/ComponentSearchResultDTO.java | 20 +- .../api/dto/search/NodeSearchResultDTO.java | 8 +- .../api/dto/search/SearchResultGroupDTO.java | 10 +- .../web/api/dto/search/SearchResultsDTO.java | 38 +- .../web/api/dto/status/ClusterStatusDTO.java | 5 +- .../api/dto/status/ComponentStatusDTO.java | 15 +- .../dto/status/ConnectionStatisticsDTO.java | 13 +- .../ConnectionStatisticsSnapshotDTO.java | 18 +- .../api/dto/status/ConnectionStatusDTO.java | 25 +- ...onnectionStatusPredictionsSnapshotDTO.java | 16 +- .../status/ConnectionStatusSnapshotDTO.java | 46 +- .../status/ControllerServiceStatusDTO.java | 6 +- .../api/dto/status/ControllerStatusDTO.java | 34 +- .../dto/status/FlowAnalysisRuleStatusDTO.java | 6 +- .../NodeConnectionStatisticsSnapshotDTO.java | 10 +- .../NodeConnectionStatusSnapshotDTO.java | 10 +- .../web/api/dto/status/NodePortStatusDTO.java | 8 +- .../dto/status/NodePortStatusSnapshotDTO.java | 10 +- .../NodeProcessGroupStatusSnapshotDTO.java | 10 +- .../NodeProcessorStatusSnapshotDTO.java | 10 +- ...deRemoteProcessGroupStatusSnapshotDTO.java | 10 +- .../web/api/dto/status/NodeStatusDTO.java | 8 +- .../dto/status/NodeStatusSnapshotsDTO.java | 13 +- .../web/api/dto/status/PortStatusDTO.java | 22 +- .../api/dto/status/PortStatusSnapshotDTO.java | 31 +- .../api/dto/status/ProcessGroupStatusDTO.java | 15 +- .../status/ProcessGroupStatusSnapshotDTO.java | 81 +- .../api/dto/status/ProcessorStatusDTO.java | 21 +- .../status/ProcessorStatusSnapshotDTO.java | 48 +- .../status/RemoteProcessGroupStatusDTO.java | 25 +- .../RemoteProcessGroupStatusSnapshotDTO.java | 26 +- .../dto/status/ReportingTaskStatusDTO.java | 6 +- .../api/dto/status/StatusDescriptorDTO.java | 14 +- .../web/api/dto/status/StatusHistoryDTO.java | 15 +- .../web/api/dto/status/StatusSnapshotDTO.java | 8 +- .../web/api/entity/AccessPolicyEntity.java | 7 +- .../nifi/web/api/entity/ActionEntity.java | 7 +- .../ActivateControllerServicesEntity.java | 11 +- .../api/entity/AffectedComponentEntity.java | 6 +- .../nifi/web/api/entity/BulletinEntity.java | 7 +- .../nifi/web/api/entity/ComponentEntity.java | 23 +- .../api/entity/ComponentReferenceEntity.java | 5 +- .../api/entity/ComponentRunStatusEntity.java | 11 +- .../web/api/entity/ComponentStateEntity.java | 5 +- .../ComponentValidationResultsEntity.java | 4 +- .../entity/ConfigurationAnalysisEntity.java | 4 +- .../nifi/web/api/entity/ConnectionEntity.java | 36 +- .../ConnectionStatisticsSnapshotEntity.java | 4 +- .../ConnectionStatusSnapshotEntity.java | 4 +- .../api/entity/ControllerBulletinsEntity.java | 14 +- .../entity/ControllerConfigurationEntity.java | 14 +- .../api/entity/ControllerServiceEntity.java | 13 +- ...llerServiceReferencingComponentEntity.java | 5 +- .../ControllerServiceRunStatusEntity.java | 13 +- .../api/entity/ControllerServicesEntity.java | 7 +- .../api/entity/CopySnippetRequestEntity.java | 14 +- .../api/entity/CreateActiveRequestEntity.java | 7 +- .../web/api/entity/CurrentUserEntity.java | 26 +- .../api/entity/FlowAnalysisRuleEntity.java | 6 +- .../FlowAnalysisRuleRunStatusEntity.java | 5 +- .../web/api/entity/FlowBreadcrumbEntity.java | 22 +- .../web/api/entity/FlowComparisonEntity.java | 4 +- .../api/entity/FlowConfigurationEntity.java | 5 +- .../api/entity/FlowRegistryClientsEntity.java | 7 +- .../api/entity/FlowUpdateRequestEntity.java | 6 +- .../nifi/web/api/entity/LabelEntity.java | 5 +- .../NodeReplayLastEventSnapshotDTO.java | 10 +- .../api/entity/ParameterContextEntity.java | 4 +- .../ParameterContextReferenceEntity.java | 8 +- .../entity/ParameterContextUpdateEntity.java | 10 +- .../ParameterContextUpdateRequestEntity.java | 6 +- ...rameterContextValidationRequestEntity.java | 6 +- .../api/entity/ParameterContextsEntity.java | 11 +- .../nifi/web/api/entity/ParameterEntity.java | 6 +- .../ParameterGroupConfigurationEntity.java | 14 +- ...rProviderApplyParametersRequestEntity.java | 4 +- .../ParameterProviderConfigurationEntity.java | 8 +- .../api/entity/ParameterProviderEntity.java | 5 +- ...terProviderParameterApplicationEntity.java | 14 +- ...ParameterProviderParameterFetchEntity.java | 11 +- ...terProviderReferencingComponentEntity.java | 5 +- .../nifi/web/api/entity/PortEntity.java | 11 +- .../web/api/entity/PortRunStatusEntity.java | 5 +- .../api/entity/PortStatusSnapshotEntity.java | 4 +- .../entity/ProcessGroupDescriptorEntity.java | 7 +- .../web/api/entity/ProcessGroupEntity.java | 70 +- .../api/entity/ProcessGroupFlowEntity.java | 5 +- .../api/entity/ProcessGroupImportEntity.java | 4 +- .../ProcessGroupReplaceRequestEntity.java | 6 +- .../ProcessGroupStatusSnapshotEntity.java | 4 +- .../entity/ProcessorDiagnosticsEntity.java | 4 +- .../nifi/web/api/entity/ProcessorEntity.java | 8 +- .../ProcessorRunStatusDetailsEntity.java | 8 +- .../api/entity/ProcessorRunStatusEntity.java | 12 +- .../entity/ProcessorStatusSnapshotEntity.java | 4 +- .../api/entity/RemotePortRunStatusEntity.java | 5 +- .../api/entity/RemoteProcessGroupEntity.java | 14 +- .../entity/RemoteProcessGroupPortEntity.java | 5 +- ...emoteProcessGroupStatusSnapshotEntity.java | 4 +- .../entity/ReplayLastEventRequestEntity.java | 7 +- .../entity/ReplayLastEventResponseEntity.java | 11 +- .../entity/ReplayLastEventSnapshotDTO.java | 8 +- .../web/api/entity/ReportingTaskEntity.java | 10 +- .../entity/ReportingTaskRunStatusEntity.java | 5 +- .../web/api/entity/ReportingTasksEntity.java | 7 +- .../entity/RunStatusDetailsRequestEntity.java | 4 +- .../api/entity/ScheduleComponentsEntity.java | 14 +- .../nifi/web/api/entity/SnippetEntity.java | 7 +- .../StartVersionControlRequestEntity.java | 9 +- .../api/entity/SubmitReplayRequestEntity.java | 8 +- ...ntrollerServiceReferenceRequestEntity.java | 22 +- .../nifi/web/api/entity/UsersEntity.java | 7 +- .../api/entity/VerifyConfigRequestEntity.java | 4 +- .../VersionControlComponentMappingEntity.java | 11 +- .../VersionControlInformationEntity.java | 4 +- .../web/api/entity/VersionedFlowEntity.java | 4 +- .../entity/VersionedFlowSnapshotEntity.java | 13 +- .../VersionedFlowSnapshotMetadataEntity.java | 6 +- .../VersionedFlowUpdateRequestEntity.java | 4 +- ...ionedReportingTaskImportRequestEntity.java | 6 +- ...onedReportingTaskImportResponseEntity.java | 6 +- .../nifi-web/nifi-web-api/pom.xml | 17 +- .../web/api/AbstractParameterResource.java | 3 +- .../nifi/web/api/AccessPolicyResource.java | 203 +- .../apache/nifi/web/api/AccessResource.java | 139 +- .../nifi/web/api/ApplicationResource.java | 65 +- .../nifi/web/api/ConnectionResource.java | 145 +- .../nifi/web/api/ControllerResource.java | 1110 ++- .../web/api/ControllerServiceResource.java | 532 +- .../apache/nifi/web/api/CountersResource.java | 97 +- .../nifi/web/api/DataTransferResource.java | 229 +- .../nifi/web/api/FlowFileQueueResource.java | 303 +- .../org/apache/nifi/web/api/FlowResource.java | 1587 ++-- .../nifi/web/api/FlowUpdateResource.java | 98 +- .../apache/nifi/web/api/FunnelResource.java | 140 +- .../nifi/web/api/InputPortResource.java | 168 +- .../apache/nifi/web/api/LabelResource.java | 136 +- .../nifi/web/api/OutputPortResource.java | 168 +- .../web/api/ParameterContextResource.java | 749 +- .../web/api/ParameterProviderResource.java | 533 +- .../nifi/web/api/ProcessGroupResource.java | 6658 ++++++++--------- .../nifi/web/api/ProcessorResource.java | 587 +- .../nifi/web/api/ProvenanceEventResource.java | 253 +- .../nifi/web/api/ProvenanceResource.java | 259 +- .../web/api/RemoteProcessGroupResource.java | 467 +- .../nifi/web/api/ReportingTaskResource.java | 458 +- .../apache/nifi/web/api/ResourceResource.java | 38 +- .../nifi/web/api/SiteToSiteResource.java | 62 +- .../apache/nifi/web/api/SnippetResource.java | 133 +- .../web/api/SystemDiagnosticsResource.java | 82 +- .../apache/nifi/web/api/TenantsResource.java | 393 +- .../apache/nifi/web/api/VersionsResource.java | 999 +-- .../JsonContentConversionExceptionMapper.java | 18 +- .../src/main/resources/openapi/openapi.yaml | 1 + .../main/resources/templates/index.mustache | 734 -- .../main/resources/templates/model.mustache | 61 - .../resources/templates/operation.mustache | 133 - .../resources/templates/style.css.mustache | 138 + .../web/api/TestProcessGroupResource.java | 2 +- .../nifi-registry-data-model/pom.xml | 2 +- .../nifi/registry/RegistryConfiguration.java | 22 +- .../nifi/registry/about/RegistryAbout.java | 10 +- .../registry/authorization/AccessPolicy.java | 8 +- .../authorization/AccessPolicySummary.java | 24 +- .../registry/authorization/CurrentUser.java | 14 +- .../registry/authorization/Permissions.java | 22 +- .../nifi/registry/authorization/Resource.java | 8 +- .../authorization/ResourcePermissions.java | 30 +- .../nifi/registry/authorization/Tenant.java | 42 +- .../nifi/registry/authorization/User.java | 10 +- .../registry/authorization/UserGroup.java | 6 +- .../apache/nifi/registry/bucket/Bucket.java | 24 +- .../nifi/registry/bucket/BucketItem.java | 22 +- .../registry/diff/ComponentDifference.java | 12 +- .../diff/ComponentDifferenceGroup.java | 12 +- .../diff/VersionedFlowDifference.java | 10 +- .../registry/extension/bundle/BuildInfo.java | 18 +- .../registry/extension/bundle/Bundle.java | 14 +- .../registry/extension/bundle/BundleInfo.java | 20 +- .../registry/extension/bundle/BundleType.java | 3 - .../extension/bundle/BundleVersion.java | 12 +- .../bundle/BundleVersionDependency.java | 10 +- .../bundle/BundleVersionMetadata.java | 28 +- .../component/ExtensionFilterParams.java | 10 +- .../component/ExtensionMetadata.java | 28 +- .../component/ExtensionMetadataContainer.java | 10 +- .../extension/component/TagCount.java | 8 +- .../extension/repo/ExtensionRepoArtifact.java | 10 +- .../extension/repo/ExtensionRepoBucket.java | 6 +- .../repo/ExtensionRepoExtensionMetadata.java | 10 +- .../extension/repo/ExtensionRepoGroup.java | 8 +- .../extension/repo/ExtensionRepoVersion.java | 20 +- .../repo/ExtensionRepoVersionSummary.java | 16 +- .../nifi/registry/flow/VersionedFlow.java | 12 +- .../registry/flow/VersionedFlowSnapshot.java | 20 +- .../flow/VersionedFlowSnapshotMetadata.java | 18 +- .../apache/nifi/registry/link/JaxbLink.java | 8 +- .../nifi/registry/link/LinkableEntity.java | 8 +- .../jackson/SerializationContainer.java | 6 +- .../pom.xml | 2 +- .../revision/entity/RevisionInfo.java | 19 +- .../nifi-registry-web-api/pom.xml | 22 +- .../src/main/asciidoc/rest-api.adoc | 20 - .../web/api/AccessPolicyResource.java | 264 +- .../nifi/registry/web/api/AccessResource.java | 237 +- .../registry/web/api/ApplicationResource.java | 3 +- .../web/api/BucketBundleResource.java | 122 +- .../registry/web/api/BucketFlowResource.java | 509 +- .../nifi/registry/web/api/BucketResource.java | 185 +- .../nifi/registry/web/api/BundleResource.java | 457 +- .../nifi/registry/web/api/ConfigResource.java | 48 +- .../web/api/ExtensionRepoResource.java | 491 +- .../registry/web/api/ExtensionResource.java | 119 +- .../nifi/registry/web/api/FlowResource.java | 202 +- .../nifi/registry/web/api/ItemResource.java | 81 +- .../web/api/RegistryAboutResource.java | 27 +- .../nifi/registry/web/api/TenantResource.java | 394 +- .../ExportedVersionedFlowSnapshot.java | 2 - .../src/main/resources/openapi/openapi.yaml | 1 + nifi-toolkit/nifi-toolkit-api/pom.xml | 15 +- pom.xml | 14 +- 477 files changed, 12785 insertions(+), 14834 deletions(-) create mode 100644 nifi-commons/nifi-swagger-integration/pom.xml create mode 100644 nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardObjectMapperProcessor.java delete mode 100644 nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.mustache delete mode 100644 nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/model.mustache delete mode 100644 nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.mustache create mode 100644 nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/style.css.mustache delete mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/asciidoc/rest-api.adoc diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentInfo.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentInfo.java index 5660b8c2eb..24c02a7c64 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentInfo.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentInfo.java @@ -17,13 +17,11 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.c2.protocol.component.api.RuntimeManifest; import java.io.Serializable; -@ApiModel public class AgentInfo implements Serializable { private static final long serialVersionUID = 1L; @@ -33,10 +31,7 @@ public class AgentInfo implements Serializable { private RuntimeManifest agentManifest; private AgentStatus status; - @ApiModelProperty( - value = "A unique identifier for the Agent", - notes = "Usually set when the agent is provisioned and deployed", - required = true) + @Schema(description = "A unique identifier for the Agent. Usually set when the agent is provisioned and deployed") public String getIdentifier() { return identifier; } @@ -45,9 +40,7 @@ public class AgentInfo implements Serializable { this.identifier = identifier; } - @ApiModelProperty( - value = "The class or category label of the agent, e.g., 'sensor-collector'", - notes = "Usually set when the agent is provisioned and deployed") + @Schema(description = "The class or category label of the agent, e.g., 'sensor-collector'. Usually set when the agent is provisioned and deployed") public String getAgentClass() { return agentClass; } @@ -56,7 +49,7 @@ public class AgentInfo implements Serializable { this.agentClass = agentClass; } - @ApiModelProperty("The hash code of the manifest definition generated by the agent.") + @Schema(description = "The hash code of the manifest definition generated by the agent.") public String getAgentManifestHash() { return this.agentManifestHash; } @@ -65,7 +58,7 @@ public class AgentInfo implements Serializable { this.agentManifestHash = agentManifestHash; } - @ApiModelProperty("The specification of the agent's capabilities") + @Schema(description = "The specification of the agent's capabilities") public RuntimeManifest getAgentManifest() { return agentManifest; } @@ -74,7 +67,7 @@ public class AgentInfo implements Serializable { this.agentManifest = runtimeManifest; } - @ApiModelProperty("A summary of the runtime status of the agent") + @Schema(description = "A summary of the runtime status of the agent") public AgentStatus getStatus() { return status; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentManifest.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentManifest.java index 3263fd3889..e8d527394b 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentManifest.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentManifest.java @@ -17,17 +17,16 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.util.Objects; import java.util.Set; + +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.c2.protocol.component.api.RuntimeManifest; -@ApiModel public class AgentManifest extends RuntimeManifest { private static final long serialVersionUID = 1L; - @ApiModelProperty("All supported operations by agent") + @Schema(description = "All supported operations by agent") private Set supportedOperations; public AgentManifest() { diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositories.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositories.java index aa6eb5e37e..cdabb18227 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositories.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositories.java @@ -17,18 +17,14 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; -@ApiModel public class AgentRepositories implements Serializable { private static final long serialVersionUID = 1L; private AgentRepositoryStatus flowFile; private AgentRepositoryStatus provenance; - @ApiModelProperty public AgentRepositoryStatus getFlowFile() { return flowFile; } @@ -37,7 +33,6 @@ public class AgentRepositories implements Serializable { this.flowFile = flowFile; } - @ApiModelProperty public AgentRepositoryStatus getProvenance() { return provenance; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositoryStatus.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositoryStatus.java index 2b91b0ae47..b4e8fa2460 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositoryStatus.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentRepositoryStatus.java @@ -17,12 +17,10 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; -@ApiModel public class AgentRepositoryStatus implements Serializable { private static final long serialVersionUID = 1L; @@ -31,7 +29,7 @@ public class AgentRepositoryStatus implements Serializable { private Long dataSize; private Long dataSizeMax; - @ApiModelProperty(value = "The number of items in the repository", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The number of items in the repository", allowableValues = "range[0, 9223372036854775807]") public Long getSize() { return size; } @@ -40,7 +38,7 @@ public class AgentRepositoryStatus implements Serializable { this.size = size; } - @ApiModelProperty(value = "The maximum number of items the repository is capable of storing", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The maximum number of items the repository is capable of storing", allowableValues = "range[0, 9223372036854775807]") public Long getSizeMax() { return sizeMax; } @@ -49,7 +47,7 @@ public class AgentRepositoryStatus implements Serializable { this.sizeMax = sizeMax; } - @ApiModelProperty(value = "The data size (in Bytes) of all items in the repository", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The data size (in Bytes) of all items in the repository", allowableValues = "range[0, 9223372036854775807]") public Long getDataSize() { return dataSize; } @@ -58,7 +56,7 @@ public class AgentRepositoryStatus implements Serializable { this.dataSize = dataSize; } - @ApiModelProperty(value = "The maximum data size (in Bytes) that the repository is capable of storing", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The maximum data size (in Bytes) that the repository is capable of storing", allowableValues = "range[0, 9223372036854775807]") public Long getDataSizeMax() { return dataSizeMax; } @@ -75,7 +73,7 @@ public class AgentRepositoryStatus implements Serializable { * * @return a decimal between [0, 1] representing the sizeMax utilization percentage */ - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public Double getSizeUtilization() { return size != null && sizeMax != null && sizeMax > 0 ? (double) size / (double) sizeMax : null; } @@ -86,7 +84,7 @@ public class AgentRepositoryStatus implements Serializable { * * @return a decimal between [0, 1] representing the dataSizeMax utilization percentage */ - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public Double getDataSizeUtilization() { return dataSize != null && dataSizeMax != null && dataSizeMax > 0 ? (double) dataSize / (double) dataSizeMax : null; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentResourceConsumption.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentResourceConsumption.java index 2ceb170564..47e72bd7e3 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentResourceConsumption.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentResourceConsumption.java @@ -17,21 +17,20 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; /** * Resource consumption of the given agent */ -@ApiModel public class AgentResourceConsumption implements Serializable { private static final long serialVersionUID = 1L; private Long memoryUsage; private Double cpuUtilization; - @ApiModelProperty("The memory footprint of the agent in bytes.") + @Schema(description = "The memory footprint of the agent in bytes.") public Long getMemoryUsage() { return memoryUsage; } @@ -40,7 +39,7 @@ public class AgentResourceConsumption implements Serializable { this.memoryUsage = memoryUsage; } - @ApiModelProperty("The CPU utilisation of the agent [0.0 - 1.0] and -1.0 in case of errors.") + @Schema(description = "The CPU utilisation of the agent [0.0 - 1.0] and -1.0 in case of errors.") public Double getCpuUtilization() { return cpuUtilization; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentStatus.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentStatus.java index bb24961714..1d40294d5d 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentStatus.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/AgentStatus.java @@ -17,8 +17,8 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Map; @@ -26,7 +26,6 @@ import java.util.Map; * Status of the aspects of the agent, including any agent components that are controllable by the C2 server, ie: * - Repositories that can be cleared and their current state */ -@ApiModel public class AgentStatus implements Serializable { private static final long serialVersionUID = 1L; @@ -35,7 +34,7 @@ public class AgentStatus implements Serializable { private Map components; private AgentResourceConsumption resourceConsumption; - @ApiModelProperty("The number of milliseconds since the agent started.") + @Schema(description = "The number of milliseconds since the agent started.") public Long getUptime() { return uptime; } @@ -44,7 +43,7 @@ public class AgentStatus implements Serializable { this.uptime = uptime; } - @ApiModelProperty("Status and metrics for the agent repositories") + @Schema(description = "Status and metrics for the agent repositories") public AgentRepositories getRepositories() { return repositories; } @@ -53,7 +52,7 @@ public class AgentStatus implements Serializable { this.repositories = repositories; } - @ApiModelProperty("Status for shared agent components (that is, components that exist outside the context of a specific flow).") + @Schema(description = "Status for shared agent components (that is, components that exist outside the context of a specific flow).") public Map getComponents() { return components; } @@ -62,7 +61,7 @@ public class AgentStatus implements Serializable { this.components = components; } - @ApiModelProperty("Resource consumption details of the agent.") + @Schema(description = "Resource consumption details of the agent.") public AgentResourceConsumption getResourceConsumption() { return resourceConsumption; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Heartbeat.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Heartbeat.java index 4c69c51f7e..e09760fe64 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Heartbeat.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Heartbeat.java @@ -17,8 +17,7 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.Objects; @@ -26,7 +25,6 @@ import java.util.Objects; /** * An object representation of a Heartbeat in the C2 protocol */ -@ApiModel public class C2Heartbeat implements Serializable { private static final long serialVersionUID = 1L; @@ -37,7 +35,7 @@ public class C2Heartbeat implements Serializable { private AgentInfo agentInfo; private FlowInfo flowInfo; - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getIdentifier() { return identifier; } @@ -46,7 +44,7 @@ public class C2Heartbeat implements Serializable { this.identifier = identifier; } - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public Long getCreated() { return created; } @@ -55,7 +53,7 @@ public class C2Heartbeat implements Serializable { this.created = created; } - @ApiModelProperty("Metadata for the device") + @Schema(description = "Metadata for the device") public DeviceInfo getDeviceInfo() { return deviceInfo; } @@ -64,7 +62,7 @@ public class C2Heartbeat implements Serializable { this.deviceInfo = deviceInfo; } - @ApiModelProperty("Metadata for the agent installed on the device") + @Schema(description = "Metadata for the agent installed on the device") public AgentInfo getAgentInfo() { return agentInfo; } @@ -73,7 +71,7 @@ public class C2Heartbeat implements Serializable { this.agentInfo = agentInfo; } - @ApiModelProperty("Metadata for the flow currently deployed to the agent") + @Schema(description = "Metadata for the flow currently deployed to the agent") public FlowInfo getFlowInfo() { return flowInfo; } @@ -83,22 +81,22 @@ public class C2Heartbeat implements Serializable { } // Convenience getters - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getDeviceId() { return deviceInfo != null ? deviceInfo.getIdentifier() : null; } - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getAgentId() { return agentInfo != null ? agentInfo.getIdentifier() : null; } - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getAgentClass() { return agentInfo != null ? agentInfo.getAgentClass() : null; } - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getAgentManifestId() { if (agentInfo != null && agentInfo.getAgentManifest() != null) { return agentInfo.getAgentManifest().getIdentifier(); @@ -106,7 +104,7 @@ public class C2Heartbeat implements Serializable { return null; } - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getFlowId() { return flowInfo != null ? flowInfo.getFlowId() : null; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2HeartbeatResponse.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2HeartbeatResponse.java index 210504756e..4803b714fc 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2HeartbeatResponse.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2HeartbeatResponse.java @@ -17,18 +17,14 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.List; -@ApiModel public class C2HeartbeatResponse implements Serializable { private static final long serialVersionUID = 1L; private List requestedOperations; - @ApiModelProperty public List getRequestedOperations() { return requestedOperations; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Operation.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Operation.java index a8c5edd742..6dca210258 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Operation.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2Operation.java @@ -17,8 +17,8 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Map; import java.util.Objects; @@ -26,7 +26,6 @@ import java.util.Set; import static java.lang.String.format; -@ApiModel public class C2Operation implements Serializable { private static final long serialVersionUID = 1L; @@ -36,7 +35,7 @@ public class C2Operation implements Serializable { private Map args; private Set dependencies; - @ApiModelProperty(value = "A unique identifier for the operation", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "A unique identifier for the operation", accessMode = Schema.AccessMode.READ_ONLY) public String getIdentifier() { return identifier; } @@ -45,7 +44,7 @@ public class C2Operation implements Serializable { this.identifier = identifier; } - @ApiModelProperty(value = "The type of operation", required = true) + @Schema(description = "The type of operation") public OperationType getOperation() { return operation; } @@ -58,13 +57,7 @@ public class C2Operation implements Serializable { this.operation = operation; } - @ApiModelProperty( - value = "The primary operand of the operation", - notes = "This is an optional field which contains the name of the entity that is target of the operation. " + - "Most operations can be fully specified with zero or one operands." + - "If no operand is needed, this field will be absent." + - "If one operand is insufficient, the operation will contain an args map" + - "with additional keyword parameters and values (see 'args').") + @Schema(description = "The primary operand of the operation") public OperandType getOperand() { return operand; } @@ -77,8 +70,7 @@ public class C2Operation implements Serializable { this.operand = operand; } - @ApiModelProperty(value = "If the operation requires arguments ", - notes = "This is an optional field and only provided when an operation has arguments " + + @Schema(description = "This is an optional field and only provided when an operation has arguments " + "in additional to the primary operand or optional parameters. Arguments are " + "arbitrary key-value pairs whose interpretation is subject to the context" + "of the operation and operand. For example, given:" + @@ -95,7 +87,7 @@ public class C2Operation implements Serializable { this.args = args; } - @ApiModelProperty("Optional set of operation ids that this operation depends on. " + + @Schema(description = "Optional set of operation ids that this operation depends on. " + "Executing this operation is conditional on the success of all dependency operations.") public Set getDependencies() { return dependencies; diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationAck.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationAck.java index d74967e34f..08729e1b1f 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationAck.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationAck.java @@ -17,29 +17,28 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Objects; -@ApiModel public class C2OperationAck implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty("The id of the requested operation that is being acknowledged") + @Schema(description = "The id of the requested operation that is being acknowledged") private String operationId; - @ApiModelProperty("The agent's status response for this operation ID") + @Schema(description = "The agent's status response for this operation ID") private C2OperationState operationState; // Optional, additional details that can be included in an ACK - @ApiModelProperty("Optionally, an ack can include device info that is relevant to the operation being acknowledged") + @Schema(description = "Optionally, an ack can include device info that is relevant to the operation being acknowledged") private DeviceInfo deviceInfo; - @ApiModelProperty("Optionally, an ack can include agent info that is relevant to the operation being acknowledged") + @Schema(description = "Optionally, an ack can include agent info that is relevant to the operation being acknowledged") private AgentInfo agentInfo; - @ApiModelProperty("Optionally, an ack can include flow info that is relevant to the operation being acknowledged") + @Schema(description = "Optionally, an ack can include flow info that is relevant to the operation being acknowledged") private FlowInfo flowInfo; diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationState.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationState.java index dc4e303e43..1e9c1e5bf2 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationState.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/C2OperationState.java @@ -17,8 +17,8 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Objects; @@ -33,16 +33,13 @@ import java.util.Objects; * some insight, but a pre-condition and post-condition failure may better indicate how to arrive at operational * success. */ -@ApiModel public class C2OperationState implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "State of the operation performed", required = true, example = "FULLY_APPLIED") + @Schema(description = "State of the operation performed", example = "FULLY_APPLIED") private OperationState state; - @ApiModelProperty( - value = "Additional details about the state", - example = "Operation failed due to missing processor(s)") + @Schema(description = "Additional details about the state") private String details; public String getDetails() { diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/ComponentStatus.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/ComponentStatus.java index 172ea7f9f7..e9303a718a 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/ComponentStatus.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/ComponentStatus.java @@ -17,17 +17,13 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; -@ApiModel public class ComponentStatus implements Serializable { private static final long serialVersionUID = 1L; private Boolean running; - @ApiModelProperty public Boolean getRunning() { return running; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/DeviceInfo.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/DeviceInfo.java index 88d8be30f1..85aa3fa471 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/DeviceInfo.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/DeviceInfo.java @@ -17,24 +17,21 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Objects; -@ApiModel public class DeviceInfo implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty( - value = "A unique, long-lived identifier for the device", - required = true) + @Schema(description = "A unique, long-lived identifier for the device") private String identifier; - @ApiModelProperty("Metadata for the device hardware and operating system") + @Schema(description = "Metadata for the device hardware and operating system") private SystemInfo systemInfo; - @ApiModelProperty("Metadata for the network interface of this device") + @Schema(description = "Metadata for the network interface of this device") private NetworkInfo networkInfo; public String getIdentifier() { diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowInfo.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowInfo.java index caf2626afc..b6c9cc93ec 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowInfo.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowInfo.java @@ -17,12 +17,11 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Map; -@ApiModel public class FlowInfo implements Serializable { private static final long serialVersionUID = 1L; @@ -31,7 +30,7 @@ public class FlowInfo implements Serializable { private Map components; private Map queues; - @ApiModelProperty(value = "A unique identifier of the flow currently deployed on the agent", required = true) + @Schema(description = "A unique identifier of the flow currently deployed on the agent") public String getFlowId() { return flowId; } @@ -40,7 +39,7 @@ public class FlowInfo implements Serializable { this.flowId = flowId; } - @ApiModelProperty("The Uniform Resource Identifier (URI) for the flow") + @Schema(description = "The Uniform Resource Identifier (URI) for the flow") public FlowUri getFlowUri() { return flowUri; } @@ -49,7 +48,7 @@ public class FlowInfo implements Serializable { this.flowUri = flowUri; } - @ApiModelProperty("Status and for each component that is part of the flow (e.g., processors)") + @Schema(description = "Status and for each component that is part of the flow (e.g., processors)") public Map getComponents() { return components; } @@ -58,7 +57,7 @@ public class FlowInfo implements Serializable { this.components = components; } - @ApiModelProperty("Status and metrics for each flow connection queue") + @Schema(description = "Status and metrics for each flow connection queue") public Map getQueues() { return queues; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowQueueStatus.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowQueueStatus.java index 0d59267f51..5173185c07 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowQueueStatus.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowQueueStatus.java @@ -17,12 +17,10 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; -@ApiModel public class FlowQueueStatus implements Serializable { private static final long serialVersionUID = 1L; @@ -31,7 +29,7 @@ public class FlowQueueStatus implements Serializable { private Long dataSize; private Long dataSizeMax; - @ApiModelProperty(value = "The number of flow files in the queue", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The number of flow files in the queue", allowableValues = "range[0, 9223372036854775807]") public Long getSize() { return size; } @@ -40,7 +38,7 @@ public class FlowQueueStatus implements Serializable { this.size = size; } - @ApiModelProperty(value = "The maximum number of flow files that the queue is configured to hold", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The maximum number of flow files that the queue is configured to hold", allowableValues = "range[0, 9223372036854775807]") public Long getSizeMax() { return sizeMax; } @@ -49,7 +47,7 @@ public class FlowQueueStatus implements Serializable { this.sizeMax = sizeMax; } - @ApiModelProperty(value = "The size (in Bytes) of all flow files in the queue", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The size (in Bytes) of all flow files in the queue", allowableValues = "range[0, 9223372036854775807]") public Long getDataSize() { return dataSize; } @@ -58,7 +56,7 @@ public class FlowQueueStatus implements Serializable { this.dataSize = dataSize; } - @ApiModelProperty(value = "The maximum size (in Bytes) that the queue is configured to hold", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "The maximum size (in Bytes) that the queue is configured to hold", allowableValues = "range[0, 9223372036854775807]") public Long getDataSizeMax() { return dataSizeMax; } @@ -75,7 +73,7 @@ public class FlowQueueStatus implements Serializable { * * @return a decimal between [0, 1] representing the sizeMax utilization percentage */ - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public Double getSizeUtilization() { return size != null && sizeMax != null && sizeMax > 0 ? (double) size / (double) sizeMax : null; } @@ -86,7 +84,7 @@ public class FlowQueueStatus implements Serializable { * * @return a decimal between [0, 1] representing the dataSizeMax utilization percentage */ - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public Double getDataSizeUtilization() { return dataSize != null && dataSizeMax != null && dataSizeMax > 0 ? (double) dataSize / (double) dataSizeMax : null; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowUri.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowUri.java index 9c3d7cd584..e668161db7 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowUri.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/FlowUri.java @@ -17,14 +17,12 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.Objects; -@ApiModel( - value = "FlowUri", - description = "Uniform Resource Identifier for flows, used to uniquely identify a flow version ") +@Schema(description = "Uniform Resource Identifier for flows, used to uniquely identify a flow version") public class FlowUri implements Serializable { private static final long serialVersionUID = 1L; diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Location.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Location.java index da02e2fe5d..b1f8f412b6 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Location.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Location.java @@ -17,20 +17,14 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - import java.io.Serializable; import java.util.Objects; -@ApiModel public class Location implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty private Double latitude; - @ApiModelProperty private Double longitude; public Double getLatitude() { diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/NetworkInfo.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/NetworkInfo.java index 17ea0b2165..f9a64d7bf1 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/NetworkInfo.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/NetworkInfo.java @@ -17,21 +17,20 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; -@ApiModel public class NetworkInfo implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty("The device network interface ID") + @Schema(description = "The device network interface ID") private String deviceId; - @ApiModelProperty("The device network hostname") + @Schema(description = "The device network hostname") private String hostname; - @ApiModelProperty("The device network interface IP Address (v4 or v6)") + @Schema(description = "The device network interface IP Address (v4 or v6)") private String ipAddress; public String getDeviceId() { diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Operation.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Operation.java index 89f2c0e602..3a1edd2909 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Operation.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/Operation.java @@ -17,10 +17,8 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class Operation extends C2Operation { private static final long serialVersionUID = 1L; @@ -32,7 +30,7 @@ public class Operation extends C2Operation { private Long created; private Long updated; - @ApiModelProperty("The identifier of the agent to which the operation applies") + @Schema(description = "The identifier of the agent to which the operation applies") public String getTargetAgentId() { return targetAgentId; } @@ -41,9 +39,7 @@ public class Operation extends C2Operation { this.targetAgentId = targetAgentId; } - @ApiModelProperty( - value = "The current state of the operation", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The current state of the operation", accessMode = Schema.AccessMode.READ_ONLY) public OperationState getState() { return state; } @@ -52,7 +48,7 @@ public class Operation extends C2Operation { this.state = state; } - @ApiModelProperty(hidden = true) + @Schema(hidden = true) public String getBulkOperationId() { return bulkOperationId; } @@ -61,11 +57,8 @@ public class Operation extends C2Operation { this.bulkOperationId = bulkOperationId; } - @ApiModelProperty(value = "The verified identity of the C2 client that created the operation", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, - notes = "This field is set by the server when an operation request is submitted to identify the origin. " + - "When the C2 instance is secured, this is the client principal identity (e.g., certificate DN). " + - "When the C2 instances is unsecured, this will be 'anonymous' as client identity can not be authenticated.") + @Schema(description = "The verified identity of the C2 client that created the operation", + accessMode = Schema.AccessMode.READ_ONLY) public String getCreatedBy() { return createdBy; } @@ -74,7 +67,7 @@ public class Operation extends C2Operation { this.createdBy = createdBy; } - @ApiModelProperty("The time (in milliseconds since Epoch) that this operation was created") + @Schema(description = "The time (in milliseconds since Epoch) that this operation was created") public Long getCreated() { return created; } @@ -83,7 +76,7 @@ public class Operation extends C2Operation { this.created = created; } - @ApiModelProperty("The time (in milliseconds since Epoch) that this operation was last updated") + @Schema(description = "The time (in milliseconds since Epoch) that this operation was last updated") public Long getUpdated() { return updated; } @@ -92,7 +85,7 @@ public class Operation extends C2Operation { this.updated = updated; } - @ApiModelProperty(value = "Additional details about the state of this operation (such as an error message).") + @Schema(description = "Additional details about the state of this operation (such as an error message).") public String getDetails() { return details; } diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SupportedOperation.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SupportedOperation.java index ede22079a6..b90e981b00 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SupportedOperation.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SupportedOperation.java @@ -17,20 +17,19 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Map; import java.util.Objects; -@ApiModel public class SupportedOperation implements Serializable { private static final long serialVersionUID = 1; - @ApiModelProperty("The type of the operation supported by the agent") + @Schema(description = "The type of the operation supported by the agent") private OperationType type; - @ApiModelProperty("Operand specific properties defined by the agent") + @Schema(description = "Operand specific properties defined by the agent") private Map> properties; public OperationType getType() { diff --git a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SystemInfo.java b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SystemInfo.java index cd07ef19b7..8371c6fcb2 100644 --- a/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SystemInfo.java +++ b/c2/c2-protocol/c2-protocol-api/src/main/java/org/apache/nifi/c2/protocol/api/SystemInfo.java @@ -17,34 +17,32 @@ package org.apache.nifi.c2.protocol.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; -@ApiModel public class SystemInfo implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty("Machine architecture of the device, e.g., ARM, x86") + @Schema(description = "Machine architecture of the device, e.g., ARM, x86") private String machineArch; private String operatingSystem; - @ApiModelProperty(value = "Size of physical memory of the device in bytes", allowableValues = "range[0, 9223372036854775807]") + @Schema(description = "Size of physical memory of the device in bytes", allowableValues = "range[0, 9223372036854775807]") private Long physicalMem; - @ApiModelProperty( - value = "Number of virtual cores on the device", + @Schema(description = "Number of virtual cores on the device", name = "vCores", allowableValues = "range[0, 2147483647]") private Integer vCores; - @ApiModelProperty + @Schema(description = "Memory usage") private Long memoryUsage; - @ApiModelProperty + @Schema(description = "CPU utilization") private Double cpuUtilization; + private Double cpuLoadAverage; public String getMachineArch() { diff --git a/c2/c2-protocol/c2-protocol-component-api/pom.xml b/c2/c2-protocol/c2-protocol-component-api/pom.xml index 36b9824628..c281fd78d3 100644 --- a/c2/c2-protocol/c2-protocol-component-api/pom.xml +++ b/c2/c2-protocol/c2-protocol-component-api/pom.xml @@ -31,7 +31,7 @@ limitations under the License. nifi-api - io.swagger + io.swagger.core.v3 swagger-annotations compile diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Attribute.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Attribute.java index d6155fdea4..457162dfa8 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Attribute.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Attribute.java @@ -16,16 +16,14 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class Attribute { private String name; private String description; - @ApiModelProperty(value = "The name of the attribute") + @Schema(description = "The name of the attribute") public String getName() { return name; } @@ -34,7 +32,7 @@ public class Attribute { this.name = name; } - @ApiModelProperty(value = "The description of the attribute") + @Schema(description = "The description of the attribute") public String getDescription() { return description; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/BuildInfo.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/BuildInfo.java index fe1e75f831..4e25a46e62 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/BuildInfo.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/BuildInfo.java @@ -17,11 +17,10 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; -@ApiModel public class BuildInfo implements Serializable { private static final long serialVersionUID = 1L; @@ -32,7 +31,7 @@ public class BuildInfo implements Serializable { private String compiler; private String compilerFlags; - @ApiModelProperty("The version number of the built component.") + @Schema(description = "The version number of the built component.") public String getVersion() { return version; } @@ -41,7 +40,7 @@ public class BuildInfo implements Serializable { this.version = version; } - @ApiModelProperty("The SCM revision id of the source code used for this build.") + @Schema(description = "The SCM revision id of the source code used for this build.") public String getRevision() { return revision; } @@ -50,7 +49,7 @@ public class BuildInfo implements Serializable { this.revision = revision; } - @ApiModelProperty("The timestamp (milliseconds since Epoch) of the build.") + @Schema(description = "The timestamp (milliseconds since Epoch) of the build.") public Long getTimestamp() { return timestamp; } @@ -59,7 +58,7 @@ public class BuildInfo implements Serializable { this.timestamp = timestamp; } - @ApiModelProperty("The target architecture of the built component.") + @Schema(description = "The target architecture of the built component.") public String getTargetArch() { return targetArch; } @@ -68,7 +67,7 @@ public class BuildInfo implements Serializable { this.targetArch = targetArch; } - @ApiModelProperty("The compiler used for the build") + @Schema(description = "The compiler used for the build") public String getCompiler() { return compiler; } @@ -77,7 +76,7 @@ public class BuildInfo implements Serializable { this.compiler = compiler; } - @ApiModelProperty("The compiler flags used for the build.") + @Schema(description = "The compiler flags used for the build.") public String getCompilerFlags() { return compilerFlags; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Bundle.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Bundle.java index 6c009e7c9b..559e10fb50 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Bundle.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Bundle.java @@ -17,13 +17,11 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.Objects; -@ApiModel public class Bundle implements Serializable { private static final long serialVersionUID = 1L; @@ -49,10 +47,7 @@ public class Bundle implements Serializable { return new Bundle(DEFAULT_GROUP, DEFAULT_ARTIFACT, DEFAULT_VERSION); } - @ApiModelProperty( - value = "The group id of the bundle", - notes = "A globally unique group namespace, e.g., org.apache.nifi", - required = true) + @Schema(description = "The group id of the bundle") public String getGroup() { return group; } @@ -61,10 +56,7 @@ public class Bundle implements Serializable { this.group = group; } - @ApiModelProperty( - value = "The artifact id of the bundle", - notes = "Unique within the group", - required = true) + @Schema(description = "The artifact id of the bundle") public String getArtifact() { return artifact; } @@ -73,7 +65,7 @@ public class Bundle implements Serializable { this.artifact = artifact; } - @ApiModelProperty("The version of the bundle artifact") + @Schema(description = "The version of the bundle artifact") public String getVersion() { return version; } @@ -82,10 +74,7 @@ public class Bundle implements Serializable { this.version = version; } - @ApiModelProperty(value = "The full specification of the bundle contents", - notes = "This is optional, as the group, artifact, and version are " + - "also enough to reference a bundle in the case the bundle " + - "specification has been published to a registry.") + @Schema(description = "The full specification of the bundle contents") public ComponentManifest getComponentManifest() { return componentManifest; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java index 0be6779318..d7199d5467 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java @@ -17,13 +17,12 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; import java.util.Collections; import java.util.List; -@ApiModel public class ComponentManifest implements Serializable { private static final long serialVersionUID = 1L; @@ -32,7 +31,7 @@ public class ComponentManifest implements Serializable { private List processors; private List reportingTasks; - @ApiModelProperty("Public interfaces defined in this bundle") + @Schema(description = "Public interfaces defined in this bundle") public List getApis() { return (apis != null ? Collections.unmodifiableList(apis) : null); } @@ -41,7 +40,7 @@ public class ComponentManifest implements Serializable { this.apis = apis; } - @ApiModelProperty("Controller Services provided in this bundle") + @Schema(description = "Controller Services provided in this bundle") public List getControllerServices() { return (controllerServices != null ? Collections.unmodifiableList(controllerServices) : null); } @@ -50,7 +49,7 @@ public class ComponentManifest implements Serializable { this.controllerServices = controllerServices; } - @ApiModelProperty("Processors provided in this bundle") + @Schema(description = "Processors provided in this bundle") public List getProcessors() { return (processors != null ? Collections.unmodifiableList(processors) : null); } @@ -59,7 +58,7 @@ public class ComponentManifest implements Serializable { this.processors = processors; } - @ApiModelProperty("Reporting Tasks provided in this bundle") + @Schema(description = "Reporting Tasks provided in this bundle") public List getReportingTasks() { return (reportingTasks != null ? Collections.unmodifiableList(reportingTasks) : null); } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java index 99216c7cf9..b7321ac9df 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collections; import java.util.LinkedHashMap; @@ -33,7 +33,7 @@ public abstract class ConfigurableExtensionDefinition extends ExtensionComponent private List dynamicProperties; @Override - @ApiModelProperty("Descriptions of configuration properties applicable to this component.") + @Schema(description = "Descriptions of configuration properties applicable to this component.") public Map getPropertyDescriptors() { return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null); } @@ -44,7 +44,7 @@ public abstract class ConfigurableExtensionDefinition extends ExtensionComponent } @Override - @ApiModelProperty("Whether or not this component makes use of dynamic (user-set) properties.") + @Schema(description = "Whether or not this component makes use of dynamic (user-set) properties.") public boolean getSupportsDynamicProperties() { return supportsDynamicProperties; } @@ -55,7 +55,7 @@ public abstract class ConfigurableExtensionDefinition extends ExtensionComponent } @Override - @ApiModelProperty("Whether or not this component makes use of sensitive dynamic (user-set) properties.") + @Schema(description = "Whether or not this component makes use of sensitive dynamic (user-set) properties.") public boolean getSupportsSensitiveDynamicProperties() { return supportsSensitiveDynamicProperties; } @@ -66,7 +66,7 @@ public abstract class ConfigurableExtensionDefinition extends ExtensionComponent } @Override - @ApiModelProperty("Describes the dynamic properties supported by this component") + @Schema(description = "Describes the dynamic properties supported by this component") public List getDynamicProperties() { return dynamicProperties; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java index 89279e04d7..0457b11c34 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java @@ -17,9 +17,6 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; - -@ApiModel public class ControllerServiceDefinition extends ConfigurableExtensionDefinition { private static final long serialVersionUID = 1L; diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DefinedType.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DefinedType.java index b59f00cb62..91acb08d62 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DefinedType.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DefinedType.java @@ -17,8 +17,7 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.Objects; @@ -26,7 +25,6 @@ import java.util.Objects; /** * A reference to a defined type identified by bundle and fully qualified class type identifiers */ -@ApiModel public class DefinedType implements Serializable { private static final long serialVersionUID = 1L; @@ -36,7 +34,7 @@ public class DefinedType implements Serializable { private String type; private String typeDescription; - @ApiModelProperty("The group name of the bundle that provides the referenced type.") + @Schema(description = "The group name of the bundle that provides the referenced type.") public String getGroup() { return group; } @@ -45,7 +43,7 @@ public class DefinedType implements Serializable { this.group = group; } - @ApiModelProperty("The artifact name of the bundle that provides the referenced type.") + @Schema(description = "The artifact name of the bundle that provides the referenced type.") public String getArtifact() { return artifact; } @@ -54,7 +52,7 @@ public class DefinedType implements Serializable { this.artifact = artifact; } - @ApiModelProperty("The version of the bundle that provides the referenced type.") + @Schema(description = "The version of the bundle that provides the referenced type.") public String getVersion() { return version; } @@ -63,10 +61,7 @@ public class DefinedType implements Serializable { this.version = version; } - @ApiModelProperty( - value = "The fully-qualified class type", - required = true, - notes = "For example, 'org.apache.nifi.GetFile' or 'org::apache:nifi::minifi::GetFile'") + @Schema(description = "The fully-qualified class type") public String getType() { return type; } @@ -75,7 +70,7 @@ public class DefinedType implements Serializable { this.type = type; } - @ApiModelProperty("The description of the type.") + @Schema(description = "The description of the type.") public String getTypeDescription() { return typeDescription; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicProperty.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicProperty.java index 25e247dbec..a219b94282 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicProperty.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicProperty.java @@ -16,11 +16,9 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.expression.ExpressionLanguageScope; -@ApiModel public class DynamicProperty { private String name; @@ -28,7 +26,7 @@ public class DynamicProperty { private String description; private ExpressionLanguageScope expressionLanguageScope; - @ApiModelProperty(value = "The description of the dynamic property name") + @Schema(description = "The description of the dynamic property name") public String getName() { return name; } @@ -37,7 +35,7 @@ public class DynamicProperty { this.name = name; } - @ApiModelProperty(value = "The description of the dynamic property value") + @Schema(description = "The description of the dynamic property value") public String getValue() { return value; } @@ -46,7 +44,7 @@ public class DynamicProperty { this.value = value; } - @ApiModelProperty(value = "The description of the dynamic property") + @Schema(description = "The description of the dynamic property") public String getDescription() { return description; } @@ -55,7 +53,7 @@ public class DynamicProperty { this.description = description; } - @ApiModelProperty(value = "The scope of the expression language support") + @Schema(description = "The scope of the expression language support") public ExpressionLanguageScope getExpressionLanguageScope() { return expressionLanguageScope; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicRelationship.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicRelationship.java index 0934490ee3..5b6efff25d 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicRelationship.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/DynamicRelationship.java @@ -16,16 +16,14 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class DynamicRelationship { private String name; private String description; - @ApiModelProperty(value = "The description of the dynamic relationship name") + @Schema(description = "The description of the dynamic relationship name") public String getName() { return name; } @@ -34,7 +32,7 @@ public class DynamicRelationship { this.name = name; } - @ApiModelProperty(value = "The description of the dynamic relationship") + @Schema(description = "The description of the dynamic relationship") public String getDescription() { return description; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ExtensionComponent.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ExtensionComponent.java index 485ee1563c..f3e94a246c 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ExtensionComponent.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ExtensionComponent.java @@ -17,8 +17,7 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collections; import java.util.List; @@ -28,7 +27,6 @@ import java.util.Set; /** * A component provided by an extension bundle */ -@ApiModel public class ExtensionComponent extends DefinedType { private static final long serialVersionUID = 1L; @@ -52,7 +50,7 @@ public class ExtensionComponent extends DefinedType { private boolean additionalDetails; - @ApiModelProperty("The build metadata for this component") + @Schema(description = "The build metadata for this component") public BuildInfo getBuildInfo() { return buildInfo; } @@ -61,7 +59,7 @@ public class ExtensionComponent extends DefinedType { this.buildInfo = buildInfo; } - @ApiModelProperty("If this type represents a provider for an interface, this lists the APIs it implements") + @Schema(description = "If this type represents a provider for an interface, this lists the APIs it implements") public List getProvidedApiImplementations() { return (providedApiImplementations != null ? Collections.unmodifiableList(providedApiImplementations) : null); @@ -71,7 +69,7 @@ public class ExtensionComponent extends DefinedType { this.providedApiImplementations = providedApiImplementations; } - @ApiModelProperty("The tags associated with this type") + @Schema(description = "The tags associated with this type") public Set getTags() { return (tags != null ? Collections.unmodifiableSet(tags) : null); } @@ -80,7 +78,7 @@ public class ExtensionComponent extends DefinedType { this.tags = tags; } - @ApiModelProperty("The names of other component types that may be related") + @Schema(description = "The names of other component types that may be related") public Set getSeeAlso() { return seeAlso; } @@ -89,7 +87,7 @@ public class ExtensionComponent extends DefinedType { this.seeAlso = seeAlso; } - @ApiModelProperty("Whether or not the component has been deprecated") + @Schema(description = "Whether or not the component has been deprecated") public Boolean getDeprecated() { return deprecated; } @@ -98,7 +96,7 @@ public class ExtensionComponent extends DefinedType { this.deprecated = deprecated; } - @ApiModelProperty("If this component has been deprecated, this optional field can be used to provide an explanation") + @Schema(description = "If this component has been deprecated, this optional field can be used to provide an explanation") public String getDeprecationReason() { return deprecationReason; } @@ -107,7 +105,7 @@ public class ExtensionComponent extends DefinedType { this.deprecationReason = deprecationReason; } - @ApiModelProperty("If this component has been deprecated, this optional field provides alternatives to use") + @Schema(description = "If this component has been deprecated, this optional field provides alternatives to use") public Set getDeprecationAlternatives() { return deprecationAlternatives; } @@ -116,7 +114,7 @@ public class ExtensionComponent extends DefinedType { this.deprecationAlternatives = deprecationAlternatives; } - @ApiModelProperty("Whether or not the component has a general restriction") + @Schema(description = "Whether or not the component has a general restriction") public Boolean isRestricted() { return restricted; } @@ -129,7 +127,7 @@ public class ExtensionComponent extends DefinedType { this.restricted = restricted; } - @ApiModelProperty("An optional description of the general restriction") + @Schema(description = "An optional description of the general restriction") public String getRestrictedExplanation() { return restrictedExplanation; } @@ -138,7 +136,7 @@ public class ExtensionComponent extends DefinedType { this.restrictedExplanation = restrictedExplanation; } - @ApiModelProperty("Explicit restrictions that indicate a require permission to use the component") + @Schema(description = "Explicit restrictions that indicate a require permission to use the component") public Set getExplicitRestrictions() { return explicitRestrictions; } @@ -147,7 +145,7 @@ public class ExtensionComponent extends DefinedType { this.explicitRestrictions = explicitRestrictions; } - @ApiModelProperty("Indicates if the component stores state") + @Schema(description = "Indicates if the component stores state") public Stateful getStateful() { return stateful; } @@ -156,7 +154,7 @@ public class ExtensionComponent extends DefinedType { this.stateful = stateful; } - @ApiModelProperty("The system resource considerations for the given component") + @Schema(description = "The system resource considerations for the given component") public List getSystemResourceConsiderations() { return systemResourceConsiderations; } @@ -165,7 +163,7 @@ public class ExtensionComponent extends DefinedType { this.systemResourceConsiderations = systemResourceConsiderations; } - @ApiModelProperty("Indicates if the component has additional details documentation") + @Schema(description = "Indicates if the component has additional details documentation") public boolean isAdditionalDetails() { return additionalDetails; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java index 99ea2429b5..ef092d54a2 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java @@ -17,15 +17,13 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.annotation.behavior.InputRequirement; import java.util.Collections; import java.util.List; import java.util.Map; -@ApiModel public class ProcessorDefinition extends ConfigurableExtensionDefinition { private static final long serialVersionUID = 1L; @@ -53,7 +51,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { private List readsAttributes; private List writesAttributes; - @ApiModelProperty("Any input requirements this processor has.") + @Schema(description = "Any input requirements this processor has.") public InputRequirement.Requirement getInputRequirement() { return inputRequirement; } @@ -62,7 +60,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.inputRequirement = inputRequirement; } - @ApiModelProperty("The supported relationships for this processor.") + @Schema(description = "The supported relationships for this processor.") public List getSupportedRelationships() { return (supportedRelationships == null ? Collections.emptyList() : Collections.unmodifiableList(supportedRelationships)); } @@ -71,7 +69,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.supportedRelationships = supportedRelationships; } - @ApiModelProperty("Whether or not this processor supports dynamic relationships.") + @Schema(description = "Whether or not this processor supports dynamic relationships.") public boolean getSupportsDynamicRelationships() { return supportsDynamicRelationships; } @@ -80,7 +78,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.supportsDynamicRelationships = supportsDynamicRelationships; } - @ApiModelProperty("If the processor supports dynamic relationships, this describes the dynamic relationship") + @Schema(description = "If the processor supports dynamic relationships, this describes the dynamic relationship") public DynamicRelationship getDynamicRelationship() { return dynamicRelationship; } @@ -89,7 +87,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.dynamicRelationship = dynamicRelationship; } - @ApiModelProperty("Whether or not this processor should be triggered serially (i.e. no concurrent execution).") + @Schema(description = "Whether or not this processor should be triggered serially (i.e. no concurrent execution).") public boolean getTriggerSerially() { return triggerSerially; } @@ -98,7 +96,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.triggerSerially = triggerSerially; } - @ApiModelProperty("Whether or not this processor should be triggered when incoming queues are empty.") + @Schema(description = "Whether or not this processor should be triggered when incoming queues are empty.") public boolean getTriggerWhenEmpty() { return triggerWhenEmpty; } @@ -107,7 +105,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.triggerWhenEmpty = triggerWhenEmpty; } - @ApiModelProperty("Whether or not this processor should be triggered when any destination queue has room.") + @Schema(description = "Whether or not this processor should be triggered when any destination queue has room.") public boolean getTriggerWhenAnyDestinationAvailable() { return triggerWhenAnyDestinationAvailable; } @@ -116,7 +114,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.triggerWhenAnyDestinationAvailable = triggerWhenAnyDestinationAvailable; } - @ApiModelProperty("Whether or not this processor supports batching. If a Processor uses this annotation, " + + @Schema(description = "Whether or not this processor supports batching. If a Processor uses this annotation, " + "it allows the Framework to batch calls to session commits, as well as allowing the Framework to return " + "the same session multiple times.") public boolean getSupportsBatching() { @@ -127,7 +125,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.supportsBatching = supportsBatching; } - @ApiModelProperty("Whether or not this processor should be scheduled only on the primary node in a cluster.") + @Schema(description = "Whether or not this processor should be scheduled only on the primary node in a cluster.") public boolean getPrimaryNodeOnly() { return primaryNodeOnly; } @@ -136,7 +134,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.primaryNodeOnly = primaryNodeOnly; } - @ApiModelProperty("Whether or not this processor is considered side-effect free. Side-effect free indicate that the " + + @Schema(description = "Whether or not this processor is considered side-effect free. Side-effect free indicate that the " + "processor's operations on FlowFiles can be safely repeated across process sessions.") public boolean getSideEffectFree() { return sideEffectFree; @@ -146,7 +144,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.sideEffectFree = sideEffectFree; } - @ApiModelProperty("The supported scheduling strategies, such as TIME_DRIVER, CRON, or EVENT_DRIVEN.") + @Schema(description = "The supported scheduling strategies, such as TIME_DRIVER, CRON, or EVENT_DRIVEN.") public List getSupportedSchedulingStrategies() { return supportedSchedulingStrategies; } @@ -155,7 +153,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.supportedSchedulingStrategies = supportedSchedulingStrategies; } - @ApiModelProperty("The default scheduling strategy for the processor.") + @Schema(description = "The default scheduling strategy for the processor.") public String getDefaultSchedulingStrategy() { return defaultSchedulingStrategy; } @@ -164,7 +162,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.defaultSchedulingStrategy = defaultSchedulingStrategy; } - @ApiModelProperty("The default concurrent tasks for each scheduling strategy.") + @Schema(description = "The default concurrent tasks for each scheduling strategy.") public Map getDefaultConcurrentTasksBySchedulingStrategy() { return defaultConcurrentTasksBySchedulingStrategy != null ? Collections.unmodifiableMap(defaultConcurrentTasksBySchedulingStrategy) : null; } @@ -173,7 +171,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.defaultConcurrentTasksBySchedulingStrategy = defaultConcurrentTasksBySchedulingStrategy; } - @ApiModelProperty("The default scheduling period for each scheduling strategy. " + + @Schema(description = "The default scheduling period for each scheduling strategy. " + "The scheduling period is expected to be a time period, such as \"30 sec\".") public Map getDefaultSchedulingPeriodBySchedulingStrategy() { return defaultSchedulingPeriodBySchedulingStrategy != null ? Collections.unmodifiableMap(defaultSchedulingPeriodBySchedulingStrategy) : null; @@ -183,7 +181,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.defaultSchedulingPeriodBySchedulingStrategy = defaultSchedulingPeriodBySchedulingStrategy; } - @ApiModelProperty("The default penalty duration as a time period, such as \"30 sec\".") + @Schema(description = "The default penalty duration as a time period, such as \"30 sec\".") public String getDefaultPenaltyDuration() { return defaultPenaltyDuration; } @@ -192,7 +190,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.defaultPenaltyDuration = defaultPenaltyDuration; } - @ApiModelProperty("The default yield duration as a time period, such as \"1 sec\".") + @Schema(description = "The default yield duration as a time period, such as \"1 sec\".") public String getDefaultYieldDuration() { return defaultYieldDuration; } @@ -201,7 +199,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.defaultYieldDuration = defaultYieldDuration; } - @ApiModelProperty("The default bulletin level, such as WARN, INFO, DEBUG, etc.") + @Schema(description = "The default bulletin level, such as WARN, INFO, DEBUG, etc.") public String getDefaultBulletinLevel() { return defaultBulletinLevel; } @@ -210,7 +208,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.defaultBulletinLevel = defaultBulletinLevel; } - @ApiModelProperty("The FlowFile attributes this processor reads") + @Schema(description = "The FlowFile attributes this processor reads") public List getReadsAttributes() { return readsAttributes; } @@ -219,7 +217,7 @@ public class ProcessorDefinition extends ConfigurableExtensionDefinition { this.readsAttributes = readsAttributes; } - @ApiModelProperty("The FlowFile attributes this processor writes/updates") + @Schema(description = "The FlowFile attributes this processor writes/updates") public List getWritesAttributes() { return writesAttributes; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyAllowableValue.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyAllowableValue.java index e70e80a5ac..7e33631e7d 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyAllowableValue.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyAllowableValue.java @@ -17,13 +17,11 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.Objects; -@ApiModel public class PropertyAllowableValue implements Serializable { private static final long serialVersionUID = 1L; @@ -31,7 +29,7 @@ public class PropertyAllowableValue implements Serializable { private String displayName; private String description; - @ApiModelProperty(value = "The internal value", required = true) + @Schema(description = "The internal value") public String getValue() { return value; } @@ -40,7 +38,7 @@ public class PropertyAllowableValue implements Serializable { this.value = value; } - @ApiModelProperty("The display name of the value, if different from the internal value") + @Schema(description = "The display name of the value, if different from the internal value") public String getDisplayName() { return displayName; } @@ -49,7 +47,7 @@ public class PropertyAllowableValue implements Serializable { this.displayName = displayName; } - @ApiModelProperty("The description of the value, e.g., the behavior it produces.") + @Schema(description = "The description of the value, e.g., the behavior it produces.") public String getDescription() { return description; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDependency.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDependency.java index dbac2d16de..c49193c09d 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDependency.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDependency.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.List; -@ApiModel public class PropertyDependency implements Serializable { private static final long serialVersionUID = 1L; @@ -30,7 +28,7 @@ public class PropertyDependency implements Serializable { private String propertyDisplayName; private List dependentValues; - @ApiModelProperty("The name of the property that is depended upon") + @Schema(description = "The name of the property that is depended upon") public String getPropertyName() { return propertyName; } @@ -39,7 +37,7 @@ public class PropertyDependency implements Serializable { this.propertyName = propertyName; } - @ApiModelProperty("The name of the property that is depended upon") + @Schema(description = "The name of the property that is depended upon") public String getPropertyDisplayName() { return propertyDisplayName; } @@ -48,7 +46,7 @@ public class PropertyDependency implements Serializable { this.propertyDisplayName = propertyDisplayName; } - @ApiModelProperty("The values that satisfy the dependency") + @Schema(description = "The values that satisfy the dependency") public List getDependentValues() { return dependentValues; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java index 2ebd040bc0..c0fe2ce527 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java @@ -16,15 +16,13 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.Collections; import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.expression.ExpressionLanguageScope; - -@ApiModel public class PropertyDescriptor implements Serializable { private static final long serialVersionUID = 1L; @@ -44,7 +42,7 @@ public class PropertyDescriptor implements Serializable { private PropertyResourceDefinition resourceDefinition; private List dependencies; - @ApiModelProperty(value = "The name of the property key", required = true) + @Schema(description = "The name of the property key") public String getName() { return name; } @@ -53,7 +51,7 @@ public class PropertyDescriptor implements Serializable { this.name = name; } - @ApiModelProperty("The display name of the property key, if different from the name") + @Schema(description = "The display name of the property key, if different from the name") public String getDisplayName() { return displayName; } @@ -62,7 +60,7 @@ public class PropertyDescriptor implements Serializable { this.displayName = displayName; } - @ApiModelProperty("The description of what the property does") + @Schema(description = "The description of what the property does") public String getDescription() { return description; } @@ -71,7 +69,7 @@ public class PropertyDescriptor implements Serializable { this.description = description; } - @ApiModelProperty("A list of the allowable values for the property") + @Schema(description = "A list of the allowable values for the property") public List getAllowableValues() { return (allowableValues != null ? Collections.unmodifiableList(allowableValues) : null); } @@ -80,7 +78,7 @@ public class PropertyDescriptor implements Serializable { this.allowableValues = allowableValues; } - @ApiModelProperty("The default value if a user-set value is not specified") + @Schema(description = "The default value if a user-set value is not specified") public String getDefaultValue() { return defaultValue; } @@ -89,7 +87,7 @@ public class PropertyDescriptor implements Serializable { this.defaultValue = defaultValue; } - @ApiModelProperty("Whether or not the property is required for the component") + @Schema(description = "Whether or not the property is required for the component") public boolean getRequired() { return required; } @@ -98,7 +96,7 @@ public class PropertyDescriptor implements Serializable { this.required = required; } - @ApiModelProperty("Whether or not the value of the property is considered sensitive (e.g., passwords and keys)") + @Schema(description = "Whether or not the value of the property is considered sensitive (e.g., passwords and keys)") public boolean getSensitive() { return sensitive; } @@ -107,7 +105,7 @@ public class PropertyDescriptor implements Serializable { this.sensitive = sensitive; } - @ApiModelProperty("The scope of expression language supported by this property") + @Schema(description = "The scope of expression language supported by this property") public ExpressionLanguageScope getExpressionLanguageScope() { return expressionLanguageScope; } @@ -117,12 +115,12 @@ public class PropertyDescriptor implements Serializable { this.expressionLanguageScopeDescription = expressionLanguageScope == null ? null : expressionLanguageScope.getDescription(); } - @ApiModelProperty(value = "The description of the expression language scope supported by this property", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The description of the expression language scope supported by this property", accessMode = Schema.AccessMode.READ_ONLY) public String getExpressionLanguageScopeDescription() { return expressionLanguageScope == null ? null : expressionLanguageScope.getDescription(); } - @ApiModelProperty("Indicates that this property is for selecting a controller service of the specified type") + @Schema(description = "Indicates that this property is for selecting a controller service of the specified type") public DefinedType getTypeProvidedByValue() { return typeProvidedByValue; } @@ -131,7 +129,7 @@ public class PropertyDescriptor implements Serializable { this.typeProvidedByValue = typeProvidedByValue; } - @ApiModelProperty("A regular expression that can be used to validate the value of this property") + @Schema(description = "A regular expression that can be used to validate the value of this property") public String getValidRegex() { return validRegex; } @@ -140,7 +138,7 @@ public class PropertyDescriptor implements Serializable { this.validRegex = validRegex; } - @ApiModelProperty("Name of the validator used for this property descriptor") + @Schema(description = "Name of the validator used for this property descriptor") public String getValidator() { return validator; } @@ -149,7 +147,7 @@ public class PropertyDescriptor implements Serializable { this.validator = validator; } - @ApiModelProperty("Whether or not the descriptor is for a dynamically added property") + @Schema(description = "Whether or not the descriptor is for a dynamically added property") public boolean isDynamic() { return dynamic; } @@ -158,7 +156,7 @@ public class PropertyDescriptor implements Serializable { this.dynamic = dynamic; } - @ApiModelProperty("Indicates that this property references external resources") + @Schema(description = "Indicates that this property references external resources") public PropertyResourceDefinition getResourceDefinition() { return resourceDefinition; } @@ -167,7 +165,7 @@ public class PropertyDescriptor implements Serializable { this.resourceDefinition = resourceDefinition; } - @ApiModelProperty("The dependencies that this property has on other properties") + @Schema(description = "The dependencies that this property has on other properties") public List getDependencies() { return dependencies; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyResourceDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyResourceDefinition.java index ebc6d2bdc9..0e8d26fef5 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyResourceDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyResourceDefinition.java @@ -16,22 +16,20 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.components.resource.ResourceCardinality; import org.apache.nifi.components.resource.ResourceType; import java.io.Serializable; import java.util.Set; -@ApiModel public class PropertyResourceDefinition implements Serializable { private static final long serialVersionUID = 1L; private ResourceCardinality cardinality; private Set resourceTypes; - @ApiModelProperty("The cardinality of the resource definition (i.e. single or multiple)") + @Schema(description = "The cardinality of the resource definition (i.e. single or multiple)") public ResourceCardinality getCardinality() { return cardinality; } @@ -40,7 +38,7 @@ public class PropertyResourceDefinition implements Serializable { this.cardinality = cardinality; } - @ApiModelProperty("The types of resources that can be referenced") + @Schema(description = "The types of resources that can be referenced") public Set getResourceTypes() { return resourceTypes; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Relationship.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Relationship.java index 84135a896d..e7066b9b01 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Relationship.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Relationship.java @@ -17,18 +17,17 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; + import java.io.Serializable; -@ApiModel public class Relationship implements Serializable { private static final long serialVersionUID = 1L; private String name; private String description; - @ApiModelProperty("The name of the relationship") + @Schema(description = "The name of the relationship") public String getName() { return name; } @@ -37,7 +36,7 @@ public class Relationship implements Serializable { this.name = name; } - @ApiModelProperty("The description of the relationship") + @Schema(description = "The description of the relationship") public String getDescription() { return description; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java index aa51e36c76..19bbf25d96 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java @@ -17,14 +17,12 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collections; import java.util.List; import java.util.Map; -@ApiModel public class ReportingTaskDefinition extends ConfigurableExtensionDefinition { private static final long serialVersionUID = 1L; @@ -32,7 +30,7 @@ public class ReportingTaskDefinition extends ConfigurableExtensionDefinition { private String defaultSchedulingStrategy; private Map defaultSchedulingPeriodBySchedulingStrategy; - @ApiModelProperty("The supported scheduling strategies, such as TIME_DRIVER or CRON.") + @Schema(description = "The supported scheduling strategies, such as TIME_DRIVER or CRON.") public List getSupportedSchedulingStrategies() { return (supportedSchedulingStrategies != null ? Collections.unmodifiableList(supportedSchedulingStrategies) : null); } @@ -41,7 +39,7 @@ public class ReportingTaskDefinition extends ConfigurableExtensionDefinition { this.supportedSchedulingStrategies = supportedSchedulingStrategies; } - @ApiModelProperty("The default scheduling strategy for the reporting task.") + @Schema(description = "The default scheduling strategy for the reporting task.") public String getDefaultSchedulingStrategy() { return defaultSchedulingStrategy; } @@ -50,7 +48,7 @@ public class ReportingTaskDefinition extends ConfigurableExtensionDefinition { this.defaultSchedulingStrategy = defaultSchedulingStrategy; } - @ApiModelProperty("The default scheduling period for each scheduling strategy. " + + @Schema(description = "The default scheduling period for each scheduling strategy. " + "The scheduling period is expected to be a time period, such as \"30 sec\".") public Map getDefaultSchedulingPeriodBySchedulingStrategy() { return defaultSchedulingPeriodBySchedulingStrategy != null ? Collections.unmodifiableMap(defaultSchedulingPeriodBySchedulingStrategy) : null; diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Restriction.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Restriction.java index 9b0f24dbab..b44eee01cd 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Restriction.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Restriction.java @@ -16,18 +16,16 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; -@ApiModel public class Restriction { private String requiredPermission; private String explanation; - @ApiModelProperty(value = "The permission required for this restriction") + @Schema(description = "The permission required for this restriction") public String getRequiredPermission() { return requiredPermission; } @@ -36,7 +34,7 @@ public class Restriction { this.requiredPermission = requiredPermission; } - @ApiModelProperty(value = "The explanation of this restriction") + @Schema(description = "The explanation of this restriction") public String getExplanation() { return explanation; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/RuntimeManifest.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/RuntimeManifest.java index 8b12fa9009..f6b6f28f6c 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/RuntimeManifest.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/RuntimeManifest.java @@ -17,15 +17,13 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; import java.util.Collections; import java.util.List; import java.util.Objects; -@ApiModel public class RuntimeManifest implements Serializable { private static final long serialVersionUID = 1L; @@ -36,7 +34,7 @@ public class RuntimeManifest implements Serializable { private List bundles; private SchedulingDefaults schedulingDefaults; - @ApiModelProperty("A unique identifier for the manifest") + @Schema(description = "A unique identifier for the manifest") public String getIdentifier() { return identifier; } @@ -45,9 +43,7 @@ public class RuntimeManifest implements Serializable { this.identifier = identifier; } - @ApiModelProperty( - value = "The type of the runtime binary, e.g., 'minifi-java' or 'minifi-cpp'", - notes = "Usually set when the runtime is built.") + @Schema(description = "The type of the runtime binary, e.g., 'minifi-java' or 'minifi-cpp'") public String getAgentType() { return agentType; } @@ -56,9 +52,7 @@ public class RuntimeManifest implements Serializable { this.agentType = agentType; } - @ApiModelProperty( - value = "The version of the runtime binary, e.g., '1.0.1'", - notes = "Usually set when the runtime is built.") + @Schema(description = "The version of the runtime binary, e.g., '1.0.1'") public String getVersion() { return version; } @@ -67,7 +61,7 @@ public class RuntimeManifest implements Serializable { this.version = version; } - @ApiModelProperty("Build summary for this runtime binary") + @Schema(description = "Build summary for this runtime binary") public BuildInfo getBuildInfo() { return buildInfo; } @@ -76,7 +70,7 @@ public class RuntimeManifest implements Serializable { this.buildInfo = buildInfo; } - @ApiModelProperty("All extension bundles included with this runtime") + @Schema(description = "All extension bundles included with this runtime") public List getBundles() { return (bundles != null ? Collections.unmodifiableList(bundles) : null); } @@ -85,7 +79,7 @@ public class RuntimeManifest implements Serializable { this.bundles = bundles; } - @ApiModelProperty("Scheduling defaults for components defined in this manifest") + @Schema(description = "Scheduling defaults for components defined in this manifest") public SchedulingDefaults getSchedulingDefaults() { return schedulingDefaults; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SchedulingDefaults.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SchedulingDefaults.java index 9a9d6d999e..c2875d6e01 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SchedulingDefaults.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SchedulingDefaults.java @@ -17,15 +17,13 @@ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.scheduling.SchedulingStrategy; import java.io.Serializable; import java.util.Collections; import java.util.Map; -@ApiModel public class SchedulingDefaults implements Serializable { private static final long serialVersionUID = 1L; @@ -39,7 +37,7 @@ public class SchedulingDefaults implements Serializable { private Map defaultConcurrentTasksBySchedulingStrategy; private Map defaultSchedulingPeriodsBySchedulingStrategy; - @ApiModelProperty("The name of the default scheduling strategy") + @Schema(description = "The name of the default scheduling strategy") public SchedulingStrategy getDefaultSchedulingStrategy() { return defaultSchedulingStrategy; } @@ -48,7 +46,7 @@ public class SchedulingDefaults implements Serializable { this.defaultSchedulingStrategy = defaultSchedulingStrategy; } - @ApiModelProperty("The default scheduling period in milliseconds") + @Schema(description = "The default scheduling period in milliseconds") public long getDefaultSchedulingPeriodMillis() { return defaultSchedulingPeriodMillis; } @@ -57,7 +55,7 @@ public class SchedulingDefaults implements Serializable { this.defaultSchedulingPeriodMillis = defaultSchedulingPeriodMillis; } - @ApiModelProperty("The default penalization period in milliseconds") + @Schema(description = "The default penalization period in milliseconds") public long getPenalizationPeriodMillis() { return penalizationPeriodMillis; } @@ -66,7 +64,7 @@ public class SchedulingDefaults implements Serializable { this.penalizationPeriodMillis = penalizationPeriodMillis; } - @ApiModelProperty("The default yield duration in milliseconds") + @Schema(description = "The default yield duration in milliseconds") public long getYieldDurationMillis() { return yieldDurationMillis; } @@ -75,7 +73,7 @@ public class SchedulingDefaults implements Serializable { this.yieldDurationMillis = yieldDurationMillis; } - @ApiModelProperty("The default run duration in nano-seconds") + @Schema(description = "The default run duration in nano-seconds") public long getDefaultRunDurationNanos() { return defaultRunDurationNanos; } @@ -84,7 +82,7 @@ public class SchedulingDefaults implements Serializable { this.defaultRunDurationNanos = defaultRunDurationNanos; } - @ApiModelProperty("The default concurrent tasks") + @Schema(description = "The default concurrent tasks") public String getDefaultMaxConcurrentTasks() { return defaultMaxConcurrentTasks; } @@ -93,7 +91,7 @@ public class SchedulingDefaults implements Serializable { this.defaultMaxConcurrentTasks = defaultMaxConcurrentTasks; } - @ApiModelProperty("The default concurrent tasks for each scheduling strategy") + @Schema(description = "The default concurrent tasks for each scheduling strategy") public Map getDefaultConcurrentTasksBySchedulingStrategy() { return defaultConcurrentTasksBySchedulingStrategy != null ? Collections.unmodifiableMap(defaultConcurrentTasksBySchedulingStrategy) : null; } @@ -102,7 +100,7 @@ public class SchedulingDefaults implements Serializable { this.defaultConcurrentTasksBySchedulingStrategy = defaultConcurrentTasksBySchedulingStrategy; } - @ApiModelProperty("The default scheduling period for each scheduling strategy") + @Schema(description = "The default scheduling period for each scheduling strategy") public Map getDefaultSchedulingPeriodsBySchedulingStrategy() { return defaultSchedulingPeriodsBySchedulingStrategy != null ? Collections.unmodifiableMap(defaultSchedulingPeriodsBySchedulingStrategy) : null; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Stateful.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Stateful.java index b7c6a21198..742307272e 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Stateful.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/Stateful.java @@ -16,19 +16,17 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.components.state.Scope; import java.util.Set; -@ApiModel public class Stateful { private String description; private Set scopes; - @ApiModelProperty(value = "Description of what information is being stored in the StateManager") + @Schema(description = "Description of what information is being stored in the StateManager") public String getDescription() { return description; } @@ -37,7 +35,7 @@ public class Stateful { this.description = description; } - @ApiModelProperty(value = "Indicates the Scope(s) associated with the State that is stored and retrieved") + @Schema(description = "Indicates the Scope(s) associated with the State that is stored and retrieved") public Set getScopes() { return scopes; } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SystemResourceConsideration.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SystemResourceConsideration.java index 3c008f1f72..8c3f45b911 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SystemResourceConsideration.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/SystemResourceConsideration.java @@ -16,16 +16,14 @@ */ package org.apache.nifi.c2.protocol.component.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class SystemResourceConsideration { private String resource; private String description; - @ApiModelProperty(value = "The resource to consider") + @Schema(description = "The resource to consider") public String getResource() { return resource; } @@ -34,7 +32,7 @@ public class SystemResourceConsideration { this.resource = resource; } - @ApiModelProperty(value = "The description of how the resource is affected") + @Schema(description = "The description of how the resource is affected") public String getDescription() { return description; } diff --git a/minifi/minifi-c2/minifi-c2-service/pom.xml b/minifi/minifi-c2/minifi-c2-service/pom.xml index 70664942db..a8c96d3125 100644 --- a/minifi/minifi-c2/minifi-c2-service/pom.xml +++ b/minifi/minifi-c2/minifi-c2-service/pom.xml @@ -97,7 +97,7 @@ limitations under the License. provided - io.swagger + io.swagger.core.v3 swagger-annotations provided diff --git a/minifi/minifi-c2/minifi-c2-service/src/main/java/org/apache/nifi/minifi/c2/service/ConfigService.java b/minifi/minifi-c2/minifi-c2-service/src/main/java/org/apache/nifi/minifi/c2/service/ConfigService.java index f362ccea22..b233e77492 100644 --- a/minifi/minifi-c2/minifi-c2-service/src/main/java/org/apache/nifi/minifi/c2/service/ConfigService.java +++ b/minifi/minifi-c2/minifi-c2-service/src/main/java/org/apache/nifi/minifi/c2/service/ConfigService.java @@ -26,11 +26,12 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.util.concurrent.UncheckedExecutionException; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -77,10 +78,6 @@ import org.springframework.security.core.context.SecurityContextHolder; @Configuration @Path("/config") -@ApiModel( - value = "/config", - description = "Provides configuration and heartbeat/acknowledge capabilities for MiNiFi instances" -) public class ConfigService { public static final String MESSAGE_400 = "MiNiFi C2 server was unable to complete the request because it was invalid. The request should not be retried without modification."; @@ -177,15 +174,23 @@ public class ConfigService { @Path("/heartbeat") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "An endpoint for a MiNiFi Agent to send a heartbeat to the C2 server", - response = C2HeartbeatResponse.class + @Operation( + description = "An endpoint for a MiNiFi Agent to send a heartbeat to the C2 server" ) @ApiResponses({ - @ApiResponse(code = 400, message = MESSAGE_400)}) + @ApiResponse( + responseCode = "200", + description = "Success", + content = @Content(schema = @Schema(implementation = C2HeartbeatResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = MESSAGE_400 + ) + }) public Response heartbeat( @Context HttpServletRequest request, @Context HttpHeaders httpHeaders, @Context UriInfo uriInfo, - @ApiParam(required = true) final C2Heartbeat heartbeat) { + @Parameter(required = true) final C2Heartbeat heartbeat) { try { authorizer.authorize(SecurityContextHolder.getContext().getAuthentication(), uriInfo); @@ -275,13 +280,17 @@ public class ConfigService { @Path("/acknowledge") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "An endpoint for a MiNiFi Agent to send an operation acknowledgement to the C2 server" + @Operation( + description = "An endpoint for a MiNiFi Agent to send an operation acknowledgement to the C2 server" ) @ApiResponses({ - @ApiResponse(code = 400, message = MESSAGE_400)}) + @ApiResponse( + responseCode = "400", + description = MESSAGE_400 + ) + }) public Response acknowledge( - @ApiParam(required = true) final C2OperationAck operationAck) { + @Parameter(required = true) final C2OperationAck operationAck) { final C2ProtocolContext ackContext = C2ProtocolContext.builder() .baseUri(getBaseUri()) diff --git a/nifi-api/pom.xml b/nifi-api/pom.xml index 92265155f2..a45c9e1354 100644 --- a/nifi-api/pom.xml +++ b/nifi-api/pom.xml @@ -34,7 +34,7 @@ --> - io.swagger + io.swagger.core.v3 swagger-annotations compile true diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/BatchSize.java b/nifi-api/src/main/java/org/apache/nifi/flow/BatchSize.java index 305807a67c..05ba824f60 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/BatchSize.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/BatchSize.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -26,7 +26,7 @@ public class BatchSize { private String size; private String duration; - @ApiModelProperty("Preferred number of flow files to include in a transaction.") + @Schema(description = "Preferred number of flow files to include in a transaction.") public Integer getCount() { return count; } @@ -35,7 +35,7 @@ public class BatchSize { this.count = count; } - @ApiModelProperty("Preferred number of bytes to include in a transaction.") + @Schema(description = "Preferred number of bytes to include in a transaction.") public String getSize() { return size; } @@ -44,7 +44,7 @@ public class BatchSize { this.size = size; } - @ApiModelProperty("Preferred amount of time that a transaction should span.") + @Schema(description = "Preferred amount of time that a transaction should span.") public String getDuration() { return duration; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/Bundle.java b/nifi-api/src/main/java/org/apache/nifi/flow/Bundle.java index 019b052559..ddfd5678d9 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/Bundle.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/Bundle.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -35,7 +35,7 @@ public class Bundle { this.version = version; } - @ApiModelProperty("The group of the bundle") + @Schema(description = "The group of the bundle") public String getGroup() { return group; } @@ -44,7 +44,7 @@ public class Bundle { this.group = group; } - @ApiModelProperty("The artifact of the bundle") + @Schema(description = "The artifact of the bundle") public String getArtifact() { return artifact; } @@ -53,7 +53,7 @@ public class Bundle { this.artifact = artifact; } - @ApiModelProperty("The version of the bundle") + @Schema(description = "The version of the bundle") public String getVersion() { return version; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/ConnectableComponent.java b/nifi-api/src/main/java/org/apache/nifi/flow/ConnectableComponent.java index 7926ed2266..c4264db94e 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/ConnectableComponent.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/ConnectableComponent.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -29,7 +29,7 @@ public class ConnectableComponent { private String name; private String comments; - @ApiModelProperty(value = "The id of the connectable component.", required = true) + @Schema(description = "The id of the connectable component.") public String getId() { return id; } @@ -38,7 +38,7 @@ public class ConnectableComponent { this.id = id; } - @ApiModelProperty("The instance ID of an existing component that is described by this VersionedComponent, or null if this is not mapped to an instantiated component") + @Schema(description = "The instance ID of an existing component that is described by this VersionedComponent, or null if this is not mapped to an instantiated component") public String getInstanceIdentifier() { return instanceId; } @@ -47,7 +47,7 @@ public class ConnectableComponent { this.instanceId = instanceIdentifier; } - @ApiModelProperty(value = "The type of component the connectable is.", required = true) + @Schema(description = "The type of component the connectable is.") public ConnectableComponentType getType() { return type; } @@ -56,7 +56,7 @@ public class ConnectableComponent { this.type = type; } - @ApiModelProperty(value = "The id of the group that the connectable component resides in", required = true) + @Schema(description = "The id of the group that the connectable component resides in") public String getGroupId() { return groupId; } @@ -65,7 +65,7 @@ public class ConnectableComponent { this.groupId = groupId; } - @ApiModelProperty("The name of the connectable component") + @Schema(description = "The name of the connectable component") public String getName() { return name; } @@ -74,7 +74,7 @@ public class ConnectableComponent { this.name = name; } - @ApiModelProperty("The comments for the connectable component.") + @Schema(description = "The comments for the connectable component.") public String getComments() { return comments; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/ControllerServiceAPI.java b/nifi-api/src/main/java/org/apache/nifi/flow/ControllerServiceAPI.java index ab7648f6be..ab28fc353b 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/ControllerServiceAPI.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/ControllerServiceAPI.java @@ -19,13 +19,13 @@ package org.apache.nifi.flow; import java.util.Objects; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class ControllerServiceAPI { private String type; private Bundle bundle; - @ApiModelProperty("The fully qualified name of the service interface.") + @Schema(description = "The fully qualified name of the service interface.") public String getType() { return type; } @@ -34,7 +34,7 @@ public class ControllerServiceAPI { this.type = type; } - @ApiModelProperty("The details of the artifact that bundled this service interface.") + @Schema(description = "The details of the artifact that bundled this service interface.") public Bundle getBundle() { return bundle; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/ExternalControllerServiceReference.java b/nifi-api/src/main/java/org/apache/nifi/flow/ExternalControllerServiceReference.java index 2e7ba92fbc..f7d023e989 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/ExternalControllerServiceReference.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/ExternalControllerServiceReference.java @@ -16,16 +16,15 @@ */ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel +@Schema public class ExternalControllerServiceReference { private String identifier; private String name; - @ApiModelProperty("The identifier of the controller service") + @Schema(description = "The identifier of the controller service") public String getIdentifier() { return identifier; } @@ -34,7 +33,7 @@ public class ExternalControllerServiceReference { this.identifier = identifier; } - @ApiModelProperty("The name of the controller service") + @Schema(description = "The name of the controller service") public String getName() { return name; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/ParameterProviderReference.java b/nifi-api/src/main/java/org/apache/nifi/flow/ParameterProviderReference.java index 93e7041dd8..e8c8256175 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/ParameterProviderReference.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/ParameterProviderReference.java @@ -16,10 +16,9 @@ */ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel +@Schema public class ParameterProviderReference { private String identifier; @@ -27,7 +26,7 @@ public class ParameterProviderReference { private String type; private Bundle bundle; - @ApiModelProperty("The fully qualified name of the parameter provider class.") + @Schema(description = "The fully qualified name of the parameter provider class.") public String getType() { return type; } @@ -36,7 +35,7 @@ public class ParameterProviderReference { this.type = type; } - @ApiModelProperty("The details of the artifact that bundled this parameter provider.") + @Schema(description = "The details of the artifact that bundled this parameter provider.") public Bundle getBundle() { return bundle; } @@ -45,7 +44,7 @@ public class ParameterProviderReference { this.bundle = bundle; } - @ApiModelProperty("The identifier of the parameter provider") + @Schema(description = "The identifier of the parameter provider") public String getIdentifier() { return identifier; } @@ -54,7 +53,7 @@ public class ParameterProviderReference { this.identifier = identifier; } - @ApiModelProperty("The name of the parameter provider") + @Schema(description = "The name of the parameter provider") public String getName() { return name; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/Position.java b/nifi-api/src/main/java/org/apache/nifi/flow/Position.java index f7c1c272a4..d9a1e5a3c7 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/Position.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/Position.java @@ -17,12 +17,11 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; -@ApiModel(description = "The position of a component on the graph") +@Schema(description = "The position of a component on the graph") public class Position { private double x; private double y; @@ -35,7 +34,7 @@ public class Position { this.y = y; } - @ApiModelProperty("The x coordinate.") + @Schema(description = "The x coordinate.") public double getX() { return x; } @@ -44,7 +43,7 @@ public class Position { this.x = x; } - @ApiModelProperty("The y coordinate.") + @Schema(description = "The y coordinate.") public double getY() { return y; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedComponent.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedComponent.java index 639d6fb3bb..d645069433 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedComponent.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedComponent.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -31,7 +31,7 @@ public abstract class VersionedComponent { private String comments; private Position position; - @ApiModelProperty("The component's unique identifier") + @Schema(description = "The component's unique identifier") public String getIdentifier() { return identifier; } @@ -40,7 +40,7 @@ public abstract class VersionedComponent { this.identifier = identifier; } - @ApiModelProperty("The instance ID of an existing component that is described by this VersionedComponent, or null if this is not mapped to an instantiated component") + @Schema(description = "The instance ID of an existing component that is described by this VersionedComponent, or null if this is not mapped to an instantiated component") public String getInstanceIdentifier() { return instanceIdentifier; } @@ -49,7 +49,7 @@ public abstract class VersionedComponent { this.instanceIdentifier = instanceIdentifier; } - @ApiModelProperty("The ID of the Process Group that this component belongs to") + @Schema(description = "The ID of the Process Group that this component belongs to") public String getGroupIdentifier() { return groupId; } @@ -58,7 +58,7 @@ public abstract class VersionedComponent { this.groupId = groupId; } - @ApiModelProperty("The component's name") + @Schema(description = "The component's name") public String getName() { return name; } @@ -67,7 +67,7 @@ public abstract class VersionedComponent { this.name = name; } - @ApiModelProperty("The component's position on the graph") + @Schema(description = "The component's position on the graph") public Position getPosition() { return position; } @@ -76,7 +76,7 @@ public abstract class VersionedComponent { this.position = position; } - @ApiModelProperty("The user-supplied comments for the component") + @Schema(description = "The user-supplied comments for the component") public String getComments() { return comments; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java index 5e3b5076d8..d21059d521 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; @@ -30,7 +30,7 @@ public abstract class VersionedConfigurableExtension extends VersionedComponent private Map propertyDescriptors; @Override - @ApiModelProperty("The type of the extension component") + @Schema(description = "The type of the extension component") public String getType() { return type; } @@ -41,7 +41,7 @@ public abstract class VersionedConfigurableExtension extends VersionedComponent } @Override - @ApiModelProperty("Information about the bundle from which the component came") + @Schema(description = "Information about the bundle from which the component came") public Bundle getBundle() { return bundle; } @@ -53,7 +53,7 @@ public abstract class VersionedConfigurableExtension extends VersionedComponent @Override - @ApiModelProperty("The properties for the component. Properties whose value is not set will only contain the property name.") + @Schema(description = "The properties for the component. Properties whose value is not set will only contain the property name.") public Map getProperties() { return properties; } @@ -64,7 +64,7 @@ public abstract class VersionedConfigurableExtension extends VersionedComponent } @Override - @ApiModelProperty("The property descriptors for the component.") + @Schema(description = "The property descriptors for the component.") public Map getPropertyDescriptors() { return propertyDescriptors; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConnection.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConnection.java index 44725b8475..c8e36df7b5 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConnection.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConnection.java @@ -20,7 +20,7 @@ package org.apache.nifi.flow; import java.util.List; import java.util.Set; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class VersionedConnection extends VersionedComponent { private ConnectableComponent source; @@ -39,8 +39,7 @@ public class VersionedConnection extends VersionedComponent { private String partitioningAttribute; private String loadBalanceCompression; - - @ApiModelProperty("The source of the connection.") + @Schema(description = "The source of the connection.") public ConnectableComponent getSource() { return source; } @@ -49,7 +48,7 @@ public class VersionedConnection extends VersionedComponent { this.source = source; } - @ApiModelProperty("The destination of the connection.") + @Schema(description = "The destination of the connection.") public ConnectableComponent getDestination() { return destination; } @@ -58,7 +57,7 @@ public class VersionedConnection extends VersionedComponent { this.destination = destination; } - @ApiModelProperty("The bend points on the connection.") + @Schema(description = "The bend points on the connection.") public List getBends() { return bends; } @@ -67,7 +66,7 @@ public class VersionedConnection extends VersionedComponent { this.bends = bends; } - @ApiModelProperty("The index of the bend point where to place the connection label.") + @Schema(description = "The index of the bend point where to place the connection label.") public Integer getLabelIndex() { return labelIndex; } @@ -76,8 +75,8 @@ public class VersionedConnection extends VersionedComponent { this.labelIndex = labelIndex; } - @ApiModelProperty( - value = "The z index of the connection.", + @Schema( + description = "The z index of the connection.", name = "zIndex") // Jackson maps this method name to JSON key "zIndex", but Swagger does not by default public Long getzIndex() { return zIndex; @@ -87,7 +86,7 @@ public class VersionedConnection extends VersionedComponent { this.zIndex = zIndex; } - @ApiModelProperty("The selected relationship that comprise the connection.") + @Schema(description = "The selected relationship that comprise the connection.") public Set getSelectedRelationships() { return selectedRelationships; } @@ -96,8 +95,7 @@ public class VersionedConnection extends VersionedComponent { this.selectedRelationships = relationships; } - - @ApiModelProperty("The object count threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing files " + @Schema(description = "The object count threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing files " + "over the limit are affected but it does help feeder processors to stop pushing too much into this work queue.") public Long getBackPressureObjectThreshold() { return backPressureObjectThreshold; @@ -107,8 +105,7 @@ public class VersionedConnection extends VersionedComponent { this.backPressureObjectThreshold = backPressureObjectThreshold; } - - @ApiModelProperty("The object data size threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing " + @Schema(description = "The object data size threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing " + "files over the limit are affected but it does help feeder processors to stop pushing too much into this work queue.") public String getBackPressureDataSizeThreshold() { return backPressureDataSizeThreshold; @@ -119,7 +116,7 @@ public class VersionedConnection extends VersionedComponent { } - @ApiModelProperty("The amount of time a flow file may be in the flow before it will be automatically aged out of the flow. Once a flow file reaches this age it will be terminated from " + @Schema(description = "The amount of time a flow file may be in the flow before it will be automatically aged out of the flow. Once a flow file reaches this age it will be terminated from " + "the flow the next time a processor attempts to start work on it.") public String getFlowFileExpiration() { return flowFileExpiration; @@ -130,7 +127,7 @@ public class VersionedConnection extends VersionedComponent { } - @ApiModelProperty("The comparators used to prioritize the queue.") + @Schema(description = "The comparators used to prioritize the queue.") public List getPrioritizers() { return prioritizers; } @@ -139,7 +136,7 @@ public class VersionedConnection extends VersionedComponent { this.prioritizers = prioritizers; } - @ApiModelProperty(value = "The Strategy to use for load balancing data across the cluster, or null, if no Load Balance Strategy has been specified.", + @Schema(description = "The Strategy to use for load balancing data across the cluster, or null, if no Load Balance Strategy has been specified.", allowableValues = "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, SINGLE_NODE") public String getLoadBalanceStrategy() { return loadBalanceStrategy; @@ -149,7 +146,7 @@ public class VersionedConnection extends VersionedComponent { this.loadBalanceStrategy = loadBalanceStrategy; } - @ApiModelProperty("The attribute to use for partitioning data as it is load balanced across the cluster. If the Load Balance Strategy is configured to use PARTITION_BY_ATTRIBUTE, the value " + + @Schema(description = "The attribute to use for partitioning data as it is load balanced across the cluster. If the Load Balance Strategy is configured to use PARTITION_BY_ATTRIBUTE, the value " + "returned by this method is the name of the FlowFile Attribute that will be used to determine which node in the cluster should receive a given FlowFile. If the Load Balance Strategy is " + "unset or is set to any other value, the Partitioning Attribute has no effect.") public String getPartitioningAttribute() { @@ -160,7 +157,7 @@ public class VersionedConnection extends VersionedComponent { this.partitioningAttribute = partitioningAttribute; } - @ApiModelProperty(value = "Whether or not compression should be used when transferring FlowFiles between nodes", + @Schema(description = "Whether or not compression should be used when transferring FlowFiles between nodes", allowableValues = "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, COMPRESS_ATTRIBUTES_AND_CONTENT") public String getLoadBalanceCompression() { return loadBalanceCompression; diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java index 67f01080dd..25b857ba95 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; @@ -29,7 +29,7 @@ public class VersionedControllerService extends VersionedConfigurableExtension { private ScheduledState scheduledState; private String bulletinLevel; - @ApiModelProperty(value = "Lists the APIs this Controller Service implements.") + @Schema(description = "Lists the APIs this Controller Service implements.") public List getControllerServiceApis() { return controllerServiceApis; } @@ -38,7 +38,7 @@ public class VersionedControllerService extends VersionedConfigurableExtension { this.controllerServiceApis = controllerServiceApis; } - @ApiModelProperty(value = "The annotation for the controller service. This is how the custom UI relays configuration to the controller service.") + @Schema(description = "The annotation for the controller service. This is how the custom UI relays configuration to the controller service.") public String getAnnotationData() { return annotationData; } @@ -52,7 +52,7 @@ public class VersionedControllerService extends VersionedConfigurableExtension { return ComponentType.CONTROLLER_SERVICE; } - @ApiModelProperty("The ScheduledState denoting whether the Controller Service is ENABLED or DISABLED") + @Schema(description = "The ScheduledState denoting whether the Controller Service is ENABLED or DISABLED") public ScheduledState getScheduledState() { return scheduledState; } @@ -61,7 +61,7 @@ public class VersionedControllerService extends VersionedConfigurableExtension { this.scheduledState = scheduledState; } - @ApiModelProperty("The level at which the controller service will report bulletins.") + @Schema(description = "The level at which the controller service will report bulletins.") public String getBulletinLevel() { return bulletinLevel; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowAnalysisRule.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowAnalysisRule.java index 233fd4adb0..0d5abd829b 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowAnalysisRule.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowAnalysisRule.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.flowanalysis.EnforcementPolicy; public class VersionedFlowAnalysisRule extends VersionedConfigurableExtension { @@ -25,7 +25,7 @@ public class VersionedFlowAnalysisRule extends VersionedConfigurableExtension { private ScheduledState scheduledState; private EnforcementPolicy enforcementPolicy; - @ApiModelProperty("How to handle violations.") + @Schema(description = "How to handle violations.") public EnforcementPolicy getEnforcementPolicy() { return enforcementPolicy; } @@ -39,7 +39,7 @@ public class VersionedFlowAnalysisRule extends VersionedConfigurableExtension { return ComponentType.FLOW_ANALYSIS_RULE; } - @ApiModelProperty("Indicates the scheduled state for the flow analysis rule") + @Schema(description = "Indicates the scheduled state for the flow analysis rule") public ScheduledState getScheduledState() { return scheduledState; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowCoordinates.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowCoordinates.java index 3d5fb2e47c..125982297c 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowCoordinates.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowCoordinates.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -29,7 +29,7 @@ public class VersionedFlowCoordinates { private int version; private Boolean latest; - @ApiModelProperty("The identifier of the Flow Registry that contains the flow") + @Schema(description = "The identifier of the Flow Registry that contains the flow") public String getRegistryId() { return registryId; } @@ -38,7 +38,7 @@ public class VersionedFlowCoordinates { this.registryId = registryId; } - @ApiModelProperty("The location of the Flow Registry that stores the flow") + @Schema(description = "The location of the Flow Registry that stores the flow") public String getStorageLocation() { return storageLocation; } @@ -47,7 +47,7 @@ public class VersionedFlowCoordinates { this.storageLocation = storageLocation; } - @ApiModelProperty("The UUID of the bucket that the flow resides in") + @Schema(description = "The UUID of the bucket that the flow resides in") public String getBucketId() { return bucketId; } @@ -56,7 +56,7 @@ public class VersionedFlowCoordinates { this.bucketId = bucketId; } - @ApiModelProperty("The UUID of the flow") + @Schema(description = "The UUID of the flow") public String getFlowId() { return flowId; } @@ -65,7 +65,7 @@ public class VersionedFlowCoordinates { this.flowId = flowId; } - @ApiModelProperty("The version of the flow") + @Schema(description = "The version of the flow") public int getVersion() { return version; } @@ -74,7 +74,7 @@ public class VersionedFlowCoordinates { this.version = version; } - @ApiModelProperty("Whether or not these coordinates point to the latest version of the flow") + @Schema(description = "Whether or not these coordinates point to the latest version of the flow") public Boolean getLatest() { return latest; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowRegistryClient.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowRegistryClient.java index b0212bd0e7..3b4c9eb5a0 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowRegistryClient.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowRegistryClient.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class VersionedFlowRegistryClient extends VersionedConfigurableExtension { private String description; @@ -28,7 +28,7 @@ public class VersionedFlowRegistryClient extends VersionedConfigurableExtension return ComponentType.FLOW_REGISTRY_CLIENT; } - @ApiModelProperty("The description of the registry") + @Schema(description = "The description of the registry") public String getDescription() { return description; } @@ -37,7 +37,7 @@ public class VersionedFlowRegistryClient extends VersionedConfigurableExtension this.description = description; } - @ApiModelProperty(value = "The annotation for the reporting task. This is how the custom UI relays configuration to the reporting task.") + @Schema(description = "The annotation for the reporting task. This is how the custom UI relays configuration to the reporting task.") public String getAnnotationData() { return annotationData; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedLabel.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedLabel.java index 0020309251..d0e8e24486 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedLabel.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedLabel.java @@ -19,7 +19,7 @@ package org.apache.nifi.flow; import java.util.Map; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class VersionedLabel extends VersionedComponent { private String label; @@ -31,7 +31,7 @@ public class VersionedLabel extends VersionedComponent { private Map style; - @ApiModelProperty("The text that appears in the label.") + @Schema(description = "The text that appears in the label.") public String getLabel() { return label; } @@ -40,7 +40,7 @@ public class VersionedLabel extends VersionedComponent { this.label = label; } - @ApiModelProperty("The styles for this label (font-size : 12px, background-color : #eee, etc).") + @Schema(description = "The styles for this label (font-size : 12px, background-color : #eee, etc).") public Map getStyle() { return style; } @@ -49,7 +49,7 @@ public class VersionedLabel extends VersionedComponent { this.style = style; } - @ApiModelProperty("The height of the label in pixels when at a 1:1 scale.") + @Schema(description = "The height of the label in pixels when at a 1:1 scale.") public Double getHeight() { return height; } @@ -58,7 +58,7 @@ public class VersionedLabel extends VersionedComponent { this.height = height; } - @ApiModelProperty("The width of the label in pixels when at a 1:1 scale.") + @Schema(description = "The width of the label in pixels when at a 1:1 scale.") public Double getWidth() { return width; } @@ -67,8 +67,8 @@ public class VersionedLabel extends VersionedComponent { this.width = width; } - @ApiModelProperty( - value = "The z index of the connection.", + @Schema( + description = "The z index of the connection.", name = "zIndex") // Jackson maps this method name to JSON key "zIndex", but Swagger does not by default public Long getzIndex() { return zIndex; diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameter.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameter.java index 9f71a7e21b..987e23ad4d 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameter.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameter.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -28,7 +28,7 @@ public class VersionedParameter { private boolean provided; private String value; - @ApiModelProperty("The name of the parameter") + @Schema(description = "The name of the parameter") public String getName() { return name; } @@ -37,7 +37,7 @@ public class VersionedParameter { this.name = name; } - @ApiModelProperty("The description of the param") + @Schema(description = "The description of the param") public String getDescription() { return description; } @@ -46,7 +46,7 @@ public class VersionedParameter { this.description = description; } - @ApiModelProperty("Whether or not the parameter value is sensitive") + @Schema(description = "Whether or not the parameter value is sensitive") public boolean isSensitive() { return sensitive; } @@ -55,7 +55,7 @@ public class VersionedParameter { this.sensitive = sensitive; } - @ApiModelProperty("Whether or not the parameter value is provided by a ParameterProvider") + @Schema(description = "Whether or not the parameter value is provided by a ParameterProvider") public boolean isProvided() { return provided; } @@ -64,7 +64,7 @@ public class VersionedParameter { this.provided = provided; } - @ApiModelProperty("The value of the parameter") + @Schema(description = "The value of the parameter") public String getValue() { return value; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterContext.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterContext.java index e7bcfc1fe3..717ccbdcc2 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterContext.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterContext.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import java.util.Set; @@ -29,7 +29,7 @@ public class VersionedParameterContext extends VersionedComponent { private String parameterGroupName; private Boolean isSynchronized; - @ApiModelProperty("The description of the parameter context") + @Schema(description = "The description of the parameter context") public String getDescription() { return description; } @@ -38,7 +38,7 @@ public class VersionedParameterContext extends VersionedComponent { this.description = description; } - @ApiModelProperty("The parameters in the context") + @Schema(description = "The parameters in the context") public Set getParameters() { return parameters; } @@ -47,7 +47,7 @@ public class VersionedParameterContext extends VersionedComponent { this.parameters = parameters; } - @ApiModelProperty("The names of additional parameter contexts from which to inherit parameters") + @Schema(description = "The names of additional parameter contexts from which to inherit parameters") public List getInheritedParameterContexts() { return inheritedParameterContexts; } @@ -61,7 +61,7 @@ public class VersionedParameterContext extends VersionedComponent { return ComponentType.PARAMETER_CONTEXT; } - @ApiModelProperty("The identifier of an optional parameter provider") + @Schema(description = "The identifier of an optional parameter provider") public String getParameterProvider() { return parameterProvider; } @@ -70,7 +70,7 @@ public class VersionedParameterContext extends VersionedComponent { this.parameterProvider = parameterProvider; } - @ApiModelProperty("The corresponding parameter group name fetched from the parameter provider, if applicable") + @Schema(description = "The corresponding parameter group name fetched from the parameter provider, if applicable") public String getParameterGroupName() { return parameterGroupName; } @@ -79,7 +79,7 @@ public class VersionedParameterContext extends VersionedComponent { this.parameterGroupName = parameterGroupName; } - @ApiModelProperty("True if the parameter provider is set and the context should receive updates when its parameters are next fetched") + @Schema(description = "True if the parameter provider is set and the context should receive updates when its parameters are next fetched") public Boolean isSynchronized() { return isSynchronized; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterProvider.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterProvider.java index b37d5e04a3..576b1d0ddb 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterProvider.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedParameterProvider.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; @@ -30,7 +30,7 @@ public class VersionedParameterProvider extends VersionedComponent implements Ve @Override - @ApiModelProperty(value = "The type of the parameter provider.") + @Schema(description = "The type of the parameter provider.") public String getType() { return type; } @@ -41,7 +41,7 @@ public class VersionedParameterProvider extends VersionedComponent implements Ve } @Override - @ApiModelProperty(value = "The details of the artifact that bundled this parameter provider type.") + @Schema(description = "The details of the artifact that bundled this parameter provider type.") public Bundle getBundle() { return bundle; } @@ -52,7 +52,7 @@ public class VersionedParameterProvider extends VersionedComponent implements Ve } @Override - @ApiModelProperty(value = "The properties of the parameter provider.") + @Schema(description = "The properties of the parameter provider.") public Map getProperties() { return properties; } @@ -63,7 +63,7 @@ public class VersionedParameterProvider extends VersionedComponent implements Ve } @Override - @ApiModelProperty("The property descriptors for the parameter provider.") + @Schema(description = "The property descriptors for the parameter provider.") public Map getPropertyDescriptors() { return propertyDescriptors; } @@ -73,7 +73,7 @@ public class VersionedParameterProvider extends VersionedComponent implements Ve this.propertyDescriptors = propertyDescriptors; } - @ApiModelProperty(value = "The annotation for the parameter provider. This is how the custom UI relays configuration to the parameter provider.") + @Schema(description = "The annotation for the parameter provider. This is how the custom UI relays configuration to the parameter provider.") public String getAnnotationData() { return annotationData; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPort.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPort.java index 6f62d159cd..a5f40b2086 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPort.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPort.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.components.PortFunction; public class VersionedPort extends VersionedComponent { @@ -27,7 +27,7 @@ public class VersionedPort extends VersionedComponent { private Boolean allowRemoteAccess; private PortFunction portFunction; - @ApiModelProperty("The number of tasks that should be concurrently scheduled for the port.") + @Schema(description = "The number of tasks that should be concurrently scheduled for the port.") public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; } @@ -36,7 +36,7 @@ public class VersionedPort extends VersionedComponent { this.concurrentlySchedulableTaskCount = concurrentlySchedulableTaskCount; } - @ApiModelProperty("The type of port.") + @Schema(description = "The type of port.") public PortType getType() { return type; } @@ -45,7 +45,7 @@ public class VersionedPort extends VersionedComponent { this.type = type; } - @ApiModelProperty("The scheduled state of the component") + @Schema(description = "The scheduled state of the component") public ScheduledState getScheduledState() { return scheduledState; } @@ -54,7 +54,7 @@ public class VersionedPort extends VersionedComponent { this.scheduledState = scheduledState; } - @ApiModelProperty("Whether or not this port allows remote access for site-to-site") + @Schema(description = "Whether or not this port allows remote access for site-to-site") public Boolean isAllowRemoteAccess() { return ((allowRemoteAccess != null) && allowRemoteAccess); } @@ -67,7 +67,7 @@ public class VersionedPort extends VersionedComponent { this.allowRemoteAccess = allowRemoteAccess; } - @ApiModelProperty("Specifies how the Port should function") + @Schema(description = "Specifies how the Port should function") public PortFunction getPortFunction() { return portFunction; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessGroup.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessGroup.java index 00980aff47..e63c59b9e6 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessGroup.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessGroup.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.HashSet; import java.util.Set; @@ -50,7 +50,7 @@ public class VersionedProcessGroup extends VersionedComponent { private String logFileSuffix; - @ApiModelProperty("The child Process Groups") + @Schema(description = "The child Process Groups") public Set getProcessGroups() { return processGroups; } @@ -59,7 +59,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.processGroups = new HashSet<>(processGroups); } - @ApiModelProperty("The Remote Process Groups") + @Schema(description = "The Remote Process Groups") public Set getRemoteProcessGroups() { return remoteProcessGroups; } @@ -68,7 +68,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.remoteProcessGroups = new HashSet<>(remoteProcessGroups); } - @ApiModelProperty("The Processors") + @Schema(description = "The Processors") public Set getProcessors() { return processors; } @@ -77,7 +77,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.processors = new HashSet<>(processors); } - @ApiModelProperty("The Input Ports") + @Schema(description = "The Input Ports") public Set getInputPorts() { return inputPorts; } @@ -86,7 +86,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.inputPorts = new HashSet<>(inputPorts); } - @ApiModelProperty("The Output Ports") + @Schema(description = "The Output Ports") public Set getOutputPorts() { return outputPorts; } @@ -95,7 +95,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.outputPorts = new HashSet<>(outputPorts); } - @ApiModelProperty("The Connections") + @Schema(description = "The Connections") public Set getConnections() { return connections; } @@ -104,7 +104,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.connections = new HashSet<>(connections); } - @ApiModelProperty("The Labels") + @Schema(description = "The Labels") public Set getLabels() { return labels; } @@ -113,7 +113,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.labels = new HashSet<>(labels); } - @ApiModelProperty("The Funnels") + @Schema(description = "The Funnels") public Set getFunnels() { return funnels; } @@ -122,7 +122,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.funnels = new HashSet<>(funnels); } - @ApiModelProperty("The Controller Services") + @Schema(description = "The Controller Services") public Set getControllerServices() { return controllerServices; } @@ -140,12 +140,12 @@ public class VersionedProcessGroup extends VersionedComponent { this.versionedFlowCoordinates = flowCoordinates; } - @ApiModelProperty("The coordinates where the remote flow is stored, or null if the Process Group is not directly under Version Control") + @Schema(description = "The coordinates where the remote flow is stored, or null if the Process Group is not directly under Version Control") public VersionedFlowCoordinates getVersionedFlowCoordinates() { return versionedFlowCoordinates; } - @ApiModelProperty("The name of the parameter context used by this process group") + @Schema(description = "The name of the parameter context used by this process group") public String getParameterContextName() { return parameterContextName; } @@ -154,7 +154,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.parameterContextName = parameterContextName; } - @ApiModelProperty(value = "The configured FlowFile Concurrency for the Process Group") + @Schema(description = "The configured FlowFile Concurrency for the Process Group") public String getFlowFileConcurrency() { return flowfileConcurrency; } @@ -163,7 +163,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.flowfileConcurrency = flowfileConcurrency; } - @ApiModelProperty(value = "The FlowFile Outbound Policy for the Process Group") + @Schema(description = "The FlowFile Outbound Policy for the Process Group") public String getFlowFileOutboundPolicy() { return flowfileOutboundPolicy; } @@ -172,7 +172,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.flowfileOutboundPolicy = outboundPolicy; } - @ApiModelProperty(value = "The default FlowFile Expiration for this Process Group.") + @Schema(description = "The default FlowFile Expiration for this Process Group.") public String getDefaultFlowFileExpiration() { return defaultFlowFileExpiration; } @@ -181,7 +181,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.defaultFlowFileExpiration = defaultFlowFileExpiration; } - @ApiModelProperty(value = "Default value used in this Process Group for the maximum number of objects that can be queued before back pressure is applied.") + @Schema(description = "Default value used in this Process Group for the maximum number of objects that can be queued before back pressure is applied.") public Long getDefaultBackPressureObjectThreshold() { return defaultBackPressureObjectThreshold; } @@ -190,7 +190,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.defaultBackPressureObjectThreshold = defaultBackPressureObjectThreshold; } - @ApiModelProperty(value = "Default value used in this Process Group for the maximum data size of objects that can be queued before back pressure is applied.") + @Schema(description = "Default value used in this Process Group for the maximum data size of objects that can be queued before back pressure is applied.") public String getDefaultBackPressureDataSizeThreshold() { return defaultBackPressureDataSizeThreshold; } @@ -199,7 +199,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.defaultBackPressureDataSizeThreshold = defaultBackPressureDataSizeThreshold; } - @ApiModelProperty(value = "The log file suffix for this Process Group for dedicated logging.") + @Schema(description = "The log file suffix for this Process Group for dedicated logging.") public String getLogFileSuffix() { return logFileSuffix; } @@ -208,7 +208,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.logFileSuffix = logFileSuffix; } - @ApiModelProperty("The Scheduled State of the Process Group, if the group is configured to use the Stateless Execution Engine. Otherwise, this value has no relevance.") + @Schema(description = "The Scheduled State of the Process Group, if the group is configured to use the Stateless Execution Engine. Otherwise, this value has no relevance.") public ScheduledState getScheduledState() { return scheduledState; } @@ -217,7 +217,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.scheduledState = scheduledState; } - @ApiModelProperty("The Execution Engine that should be used to run the components within the group.") + @Schema(description = "The Execution Engine that should be used to run the components within the group.") public ExecutionEngine getExecutionEngine() { return executionEngine; } @@ -226,7 +226,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.executionEngine = executionEngine; } - @ApiModelProperty("The maximum number of concurrent tasks that should be scheduled for this Process Group when using the Stateless Engine") + @Schema(description = "The maximum number of concurrent tasks that should be scheduled for this Process Group when using the Stateless Engine") public Integer getMaxConcurrentTasks() { return maxConcurrentTasks; } @@ -235,7 +235,7 @@ public class VersionedProcessGroup extends VersionedComponent { this.maxConcurrentTasks = maxConcurrentTasks; } - @ApiModelProperty("The maximum amount of time that the flow is allows to run using the Stateless engine before it times out and is considered a failure") + @Schema(description = "The maximum amount of time that the flow is allows to run using the Stateless engine before it times out and is considered a failure") public String getStatelessFlowTimeout() { return statelessFlowTimeout; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java index f716a9a294..266c6e9b97 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; import java.util.Set; @@ -43,7 +43,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { private String backoffMechanism; private String maxBackoffPeriod; - @ApiModelProperty("The frequency with which to schedule the processor. The format of the value will depend on th value of schedulingStrategy.") + @Schema(description = "The frequency with which to schedule the processor. The format of the value will depend on th value of schedulingStrategy.") public String getSchedulingPeriod() { return schedulingPeriod; } @@ -52,7 +52,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.schedulingPeriod = setSchedulingPeriod; } - @ApiModelProperty("Indicates how the processor should be scheduled to run.") + @Schema(description = "Indicates how the processor should be scheduled to run.") public String getSchedulingStrategy() { return schedulingStrategy; } @@ -61,7 +61,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.schedulingStrategy = schedulingStrategy; } - @ApiModelProperty("Indicates the node where the process will execute.") + @Schema(description = "Indicates the node where the process will execute.") public String getExecutionNode() { return executionNode; } @@ -70,7 +70,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.executionNode = executionNode; } - @ApiModelProperty("The amout of time that is used when the process penalizes a flowfile.") + @Schema(description = "The amout of time that is used when the process penalizes a flowfile.") public String getPenaltyDuration() { return penaltyDuration; } @@ -79,7 +79,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.penaltyDuration = penaltyDuration; } - @ApiModelProperty("The amount of time that must elapse before this processor is scheduled again after yielding.") + @Schema(description = "The amount of time that must elapse before this processor is scheduled again after yielding.") public String getYieldDuration() { return yieldDuration; } @@ -88,7 +88,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.yieldDuration = yieldDuration; } - @ApiModelProperty("The level at which the processor will report bulletins.") + @Schema(description = "The level at which the processor will report bulletins.") public String getBulletinLevel() { return bulletinLevel; } @@ -97,7 +97,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.bulletinLevel = bulletinLevel; } - @ApiModelProperty("The number of tasks that should be concurrently schedule for the processor. If the processor doesn't allow parallol processing then any positive input will be ignored.") + @Schema(description = "The number of tasks that should be concurrently schedule for the processor. If the processor doesn't allow parallol processing then any positive input will be ignored.") public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; } @@ -106,7 +106,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.concurrentlySchedulableTaskCount = concurrentlySchedulableTaskCount; } - @ApiModelProperty("The annotation data for the processor used to relay configuration between a custom UI and the procesosr.") + @Schema(description = "The annotation data for the processor used to relay configuration between a custom UI and the procesosr.") public String getAnnotationData() { return annotationData; } @@ -116,7 +116,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { } - @ApiModelProperty("The names of all relationships that cause a flow file to be terminated if the relationship is not connected elsewhere. This property differs " + @Schema(description = "The names of all relationships that cause a flow file to be terminated if the relationship is not connected elsewhere. This property differs " + "from the 'isAutoTerminate' property of the RelationshipDTO in that the RelationshipDTO is meant to depict the current configuration, whereas this " + "property can be set in a DTO when updating a Processor in order to change which Relationships should be auto-terminated.") public Set getAutoTerminatedRelationships() { @@ -127,7 +127,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.autoTerminatedRelationships = autoTerminatedRelationships; } - @ApiModelProperty("The run duration for the processor in milliseconds.") + @Schema(description = "The run duration for the processor in milliseconds.") public Long getRunDurationMillis() { return runDurationMillis; } @@ -136,7 +136,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.runDurationMillis = runDurationMillis; } - @ApiModelProperty("Stylistic data for rendering in a UI") + @Schema(description = "Stylistic data for rendering in a UI") public Map getStyle() { return style; } @@ -145,7 +145,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.style = style; } - @ApiModelProperty("The scheduled state of the component") + @Schema(description = "The scheduled state of the component") public ScheduledState getScheduledState() { return scheduledState; } @@ -159,9 +159,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { return ComponentType.PROCESSOR; } - @ApiModelProperty( - value = "Overall number of retries." - ) + @Schema(description = "Overall number of retries.") public Integer getRetryCount() { return retryCount; } @@ -170,9 +168,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.retryCount = retryCount; } - @ApiModelProperty( - value = "All the relationships should be retried." - ) + @Schema(description = "All the relationships should be retried.") public Set getRetriedRelationships() { return retriedRelationships; } @@ -181,8 +177,8 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.retriedRelationships = retriedRelationships; } - @ApiModelProperty( - value = "Determines whether the FlowFile should be penalized or the processor should be yielded between retries.", + @Schema( + description = "Determines whether the FlowFile should be penalized or the processor should be yielded between retries.", allowableValues = "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ) public String getBackoffMechanism() { @@ -193,9 +189,7 @@ public class VersionedProcessor extends VersionedConfigurableExtension { this.backoffMechanism = backoffMechanism; } - @ApiModelProperty( - value = "Maximum amount of time to be waited during a retry period." - ) + @Schema(description = "Maximum amount of time to be waited during a retry period.") public String getMaxBackoffPeriod() { return maxBackoffPeriod; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPropertyDescriptor.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPropertyDescriptor.java index 25ded8cf54..15409351dc 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPropertyDescriptor.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedPropertyDescriptor.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class VersionedPropertyDescriptor { private String name; @@ -27,7 +27,7 @@ public class VersionedPropertyDescriptor { private boolean dynamic; private VersionedResourceDefinition resourceDefinition; - @ApiModelProperty("The name of the property") + @Schema(description = "The name of the property") public String getName() { return name; } @@ -36,7 +36,7 @@ public class VersionedPropertyDescriptor { this.name = name; } - @ApiModelProperty("The display name of the property") + @Schema(description = "The display name of the property") public String getDisplayName() { return displayName; } @@ -45,7 +45,7 @@ public class VersionedPropertyDescriptor { this.displayName = displayName; } - @ApiModelProperty("Whether or not the property provides the identifier of a Controller Service") + @Schema(description = "Whether or not the property provides the identifier of a Controller Service") public boolean getIdentifiesControllerService() { return identifiesControllerService; } @@ -54,7 +54,7 @@ public class VersionedPropertyDescriptor { this.identifiesControllerService = identifiesControllerService; } - @ApiModelProperty("Whether or not the property is considered sensitive") + @Schema(description = "Whether or not the property is considered sensitive") public boolean isSensitive() { return sensitive; } @@ -63,7 +63,7 @@ public class VersionedPropertyDescriptor { this.sensitive = sensitive; } - @ApiModelProperty("Whether or not the property is user-defined") + @Schema(description = "Whether or not the property is user-defined") public boolean isDynamic() { return dynamic; } @@ -72,7 +72,7 @@ public class VersionedPropertyDescriptor { this.dynamic = dynamic; } - @ApiModelProperty("Returns the Resource Definition that defines which type(s) of resource(s) this property references, if any") + @Schema(description = "Returns the Resource Definition that defines which type(s) of resource(s) this property references, if any") public VersionedResourceDefinition getResourceDefinition() { return resourceDefinition; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteGroupPort.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteGroupPort.java index 33b61b2efb..777866a508 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteGroupPort.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteGroupPort.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -30,7 +30,7 @@ public class VersionedRemoteGroupPort extends VersionedComponent { private String targetId; private ScheduledState scheduledState; - @ApiModelProperty("The number of task that may transmit flowfiles to the target port concurrently.") + @Schema(description = "The number of task that may transmit flowfiles to the target port concurrently.") public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; } @@ -39,7 +39,7 @@ public class VersionedRemoteGroupPort extends VersionedComponent { this.concurrentlySchedulableTaskCount = concurrentlySchedulableTaskCount; } - @ApiModelProperty("The id of the remote process group that the port resides in.") + @Schema(description = "The id of the remote process group that the port resides in.") public String getRemoteGroupId() { return remoteGroupId; } @@ -49,7 +49,7 @@ public class VersionedRemoteGroupPort extends VersionedComponent { } - @ApiModelProperty("Whether the flowfiles are compressed when sent to the target port.") + @Schema(description = "Whether the flowfiles are compressed when sent to the target port.") public Boolean isUseCompression() { return useCompression; } @@ -58,7 +58,7 @@ public class VersionedRemoteGroupPort extends VersionedComponent { this.useCompression = useCompression; } - @ApiModelProperty("The batch settings for data transmission.") + @Schema(description = "The batch settings for data transmission.") public BatchSize getBatchSize() { return batchSize; } @@ -67,7 +67,7 @@ public class VersionedRemoteGroupPort extends VersionedComponent { this.batchSize = batchSize; } - @ApiModelProperty("The ID of the port on the target NiFi instance") + @Schema(description = "The ID of the port on the target NiFi instance") public String getTargetId() { return targetId; } @@ -76,7 +76,7 @@ public class VersionedRemoteGroupPort extends VersionedComponent { this.targetId = targetId; } - @ApiModelProperty("The scheduled state of the component") + @Schema(description = "The scheduled state of the component") public ScheduledState getScheduledState() { return scheduledState; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteProcessGroup.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteProcessGroup.java index 9b11b469b2..53590ea111 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteProcessGroup.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedRemoteProcessGroup.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; @@ -36,11 +36,9 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { private Set inputPorts; private Set outputPorts; - - @ApiModelProperty( - value = "The target URIs of the remote process group." + - " If target uris is not set but target uri is set, then returns the single target uri." + - " If neither target uris nor target uri is set, then returns null.") + @Schema(description = "The target URIs of the remote process group. " + + "If target uris is not set but target uri is set, then returns the single target uri. " + + "If neither target uris nor target uri is set, then returns null.") public String getTargetUris() { return !isEmpty(targetUris) ? targetUris : null; @@ -54,7 +52,7 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { this.targetUris = targetUris; } - @ApiModelProperty("The time period used for the timeout when communicating with the target.") + @Schema(description = "The time period used for the timeout when communicating with the target.") public String getCommunicationsTimeout() { return communicationsTimeout; } @@ -63,7 +61,7 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { this.communicationsTimeout = communicationsTimeout; } - @ApiModelProperty("When yielding, this amount of time must elapse before the remote process group is scheduled again.") + @Schema(description = "When yielding, this amount of time must elapse before the remote process group is scheduled again.") public String getYieldDuration() { return yieldDuration; } @@ -72,7 +70,7 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { this.yieldDuration = yieldDuration; } - @ApiModelProperty(value = "The Transport Protocol that is used for Site-to-Site communications", allowableValues = "RAW, HTTP") + @Schema(description = "The Transport Protocol that is used for Site-to-Site communications", allowableValues = "RAW, HTTP") public String getTransportProtocol() { return transportProtocol; } @@ -81,7 +79,7 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { this.transportProtocol = transportProtocol; } - @ApiModelProperty("A Set of Input Ports that can be connected to, in order to send data to the remote NiFi instance") + @Schema(description = "A Set of Input Ports that can be connected to, in order to send data to the remote NiFi instance") public Set getInputPorts() { return inputPorts; } @@ -90,7 +88,7 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { this.inputPorts = inputPorts; } - @ApiModelProperty("A Set of Output Ports that can be connected to, in order to pull data from the remote NiFi instance") + @Schema(description = "A Set of Output Ports that can be connected to, in order to pull data from the remote NiFi instance") public Set getOutputPorts() { return outputPorts; } @@ -100,7 +98,7 @@ public class VersionedRemoteProcessGroup extends VersionedComponent { } - @ApiModelProperty("The local network interface to send/receive data. If not specified, any local address is used. If clustered, all nodes must have an interface with this identifier.") + @Schema(description = "The local network interface to send/receive data. If not specified, any local address is used. If clustered, all nodes must have an interface with this identifier.") public String getLocalNetworkInterface() { return localNetworkInterface; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java index 4450cedf3f..6e9cc03d6f 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class VersionedReportingTask extends VersionedConfigurableExtension { @@ -26,7 +26,7 @@ public class VersionedReportingTask extends VersionedConfigurableExtension { private String schedulingPeriod; private String schedulingStrategy; - @ApiModelProperty(value = "The annotation for the reporting task. This is how the custom UI relays configuration to the reporting task.") + @Schema(description = "The annotation for the reporting task. This is how the custom UI relays configuration to the reporting task.") public String getAnnotationData() { return annotationData; } @@ -35,7 +35,7 @@ public class VersionedReportingTask extends VersionedConfigurableExtension { this.annotationData = annotationData; } - @ApiModelProperty("The frequency with which to schedule the reporting task. The format of the value will depend on the value of schedulingStrategy.") + @Schema(description = "The frequency with which to schedule the reporting task. The format of the value will depend on the value of schedulingStrategy.") public String getSchedulingPeriod() { return schedulingPeriod; } @@ -44,7 +44,7 @@ public class VersionedReportingTask extends VersionedConfigurableExtension { this.schedulingPeriod = setSchedulingPeriod; } - @ApiModelProperty("Indicates scheduling strategy that should dictate how the reporting task is triggered.") + @Schema(description = "Indicates scheduling strategy that should dictate how the reporting task is triggered.") public String getSchedulingStrategy() { return schedulingStrategy; } @@ -58,7 +58,7 @@ public class VersionedReportingTask extends VersionedConfigurableExtension { return ComponentType.REPORTING_TASK; } - @ApiModelProperty("Indicates the scheduled state for the Reporting Task") + @Schema(description = "Indicates the scheduled state for the Reporting Task") public ScheduledState getScheduledState() { return scheduledState; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTaskSnapshot.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTaskSnapshot.java index 3da3f8c302..d1d7e538d5 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTaskSnapshot.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTaskSnapshot.java @@ -16,18 +16,17 @@ */ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; -@ApiModel +@Schema public class VersionedReportingTaskSnapshot { private List reportingTasks; private List controllerServices; - @ApiModelProperty(value = "The controller services") + @Schema(description = "The controller services") public List getControllerServices() { return controllerServices; } @@ -36,7 +35,7 @@ public class VersionedReportingTaskSnapshot { this.controllerServices = controllerServices; } - @ApiModelProperty(value = "The reporting tasks") + @Schema(description = "The reporting tasks") public List getReportingTasks() { return reportingTasks; } diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedResourceDefinition.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedResourceDefinition.java index 97c4e18210..a04e23bd1a 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedResourceDefinition.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedResourceDefinition.java @@ -17,7 +17,7 @@ package org.apache.nifi.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; @@ -25,7 +25,7 @@ public class VersionedResourceDefinition { private VersionedResourceCardinality cardinality; private Set resourceTypes; - @ApiModelProperty("The cardinality of the resource") + @Schema(description = "The cardinality of the resource") public VersionedResourceCardinality getCardinality() { return cardinality; } @@ -34,7 +34,7 @@ public class VersionedResourceDefinition { this.cardinality = cardinality; } - @ApiModelProperty("The types of resource that the Property Descriptor is allowed to reference") + @Schema(description = "The types of resource that the Property Descriptor is allowed to reference") public Set getResourceTypes() { return resourceTypes; } diff --git a/nifi-commons/nifi-swagger-integration/pom.xml b/nifi-commons/nifi-swagger-integration/pom.xml new file mode 100644 index 0000000000..fa20b5ab42 --- /dev/null +++ b/nifi-commons/nifi-swagger-integration/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + org.apache.nifi + nifi-commons + 2.0.0-SNAPSHOT + + nifi-swagger-integration + jar + + + + io.swagger.core.v3 + swagger-integration-jakarta + ${swagger.annotations.version} + provided + + + diff --git a/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardObjectMapperProcessor.java b/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardObjectMapperProcessor.java new file mode 100644 index 0000000000..c0c17ca7f2 --- /dev/null +++ b/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardObjectMapperProcessor.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.nifi.swagger.integration; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import io.swagger.v3.oas.integration.api.ObjectMapperProcessor; + +/** + * Standard Jackson Object Mapper Processor for customizing OpenAPI Specification generation + */ +public class StandardObjectMapperProcessor implements ObjectMapperProcessor { + + @Override + public void processJsonObjectMapper(final ObjectMapper mapper) { + // Write enums using name() instead of toString() + mapper.disable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + } +} diff --git a/nifi-commons/pom.xml b/nifi-commons/pom.xml index 034b39f123..d860e6c8e2 100644 --- a/nifi-commons/pom.xml +++ b/nifi-commons/pom.xml @@ -68,6 +68,7 @@ nifi-single-user-utils nifi-site-to-site-client nifi-socket-utils + nifi-swagger-integration nifi-utils nifi-uuid5 nifi-hashicorp-vault diff --git a/nifi-manifest/nifi-extension-manifest-model/pom.xml b/nifi-manifest/nifi-extension-manifest-model/pom.xml index 706d9ab686..2087ca6860 100644 --- a/nifi-manifest/nifi-extension-manifest-model/pom.xml +++ b/nifi-manifest/nifi-extension-manifest-model/pom.xml @@ -25,7 +25,7 @@ - io.swagger + io.swagger.core.v3 swagger-annotations diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/AllowableValue.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/AllowableValue.java index 02efeb28b6..cb927b3572 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/AllowableValue.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/AllowableValue.java @@ -16,13 +16,13 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel + @XmlAccessorType(XmlAccessType.FIELD) public class AllowableValue { @@ -30,7 +30,7 @@ public class AllowableValue { private String displayName; private String description; - @ApiModelProperty(value = "The value of the allowable value") + @Schema(description = "The value of the allowable value") public String getValue() { return value; } @@ -39,7 +39,7 @@ public class AllowableValue { this.value = value; } - @ApiModelProperty(value = "The display name of the allowable value") + @Schema(description = "The display name of the allowable value") public String getDisplayName() { return displayName; } @@ -48,7 +48,7 @@ public class AllowableValue { this.displayName = displayName; } - @ApiModelProperty(value = "The description of the allowable value") + @Schema(description = "The description of the allowable value") public String getDescription() { return description; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Attribute.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Attribute.java index 0f900ee94f..82ee5f06b0 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Attribute.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Attribute.java @@ -16,20 +16,18 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Attribute { private String name; private String description; - @ApiModelProperty(value = "The name of the attribute") + @Schema(description = "The name of the attribute") public String getName() { return name; } @@ -38,7 +36,7 @@ public class Attribute { this.name = name; } - @ApiModelProperty(value = "The description of the attribute") + @Schema(description = "The description of the attribute") public String getDescription() { return description; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/BuildInfo.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/BuildInfo.java index d884603bd6..a4f8774d73 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/BuildInfo.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/BuildInfo.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class BuildInfo { @@ -33,7 +31,7 @@ public class BuildInfo { private String builtBy; private String timestamp; - @ApiModelProperty(value = "The tag the NAR was built from") + @Schema(description = "The tag the NAR was built from") public String getTag() { return tag; } @@ -42,7 +40,7 @@ public class BuildInfo { this.tag = tag; } - @ApiModelProperty(value = "The branch the NAR was built from") + @Schema(description = "The branch the NAR was built from") public String getBranch() { return branch; } @@ -51,7 +49,7 @@ public class BuildInfo { this.branch = branch; } - @ApiModelProperty(value = "The revision the NAR was built from") + @Schema(description = "The revision the NAR was built from") public String getRevision() { return revision; } @@ -60,7 +58,7 @@ public class BuildInfo { this.revision = revision; } - @ApiModelProperty(value = "The JDK the NAR was built with") + @Schema(description = "The JDK the NAR was built with") public String getJdk() { return jdk; } @@ -69,7 +67,7 @@ public class BuildInfo { this.jdk = jdk; } - @ApiModelProperty(value = "The OS user that performed the build") + @Schema(description = "The OS user that performed the build") public String getBuiltBy() { return builtBy; } @@ -78,7 +76,7 @@ public class BuildInfo { this.builtBy = builtBy; } - @ApiModelProperty(value = "The timestamp of the build") + @Schema(description = "The timestamp of the build") public String getTimestamp() { return timestamp; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Cardinality.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Cardinality.java index 0b0966e2f3..5b0b2d5a2c 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Cardinality.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Cardinality.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - -@ApiModel public enum Cardinality { /** diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ControllerServiceDefinition.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ControllerServiceDefinition.java index c6670d1c76..37c623f8e8 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ControllerServiceDefinition.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ControllerServiceDefinition.java @@ -16,14 +16,12 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import java.util.Objects; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class ControllerServiceDefinition { @@ -32,7 +30,7 @@ public class ControllerServiceDefinition { private String artifactId; private String version; - @ApiModelProperty(value = "The class name of the service API") + @Schema(description = "The class name of the service API") public String getClassName() { return className; } @@ -41,7 +39,7 @@ public class ControllerServiceDefinition { this.className = className; } - @ApiModelProperty(value = "The group id of the service API") + @Schema(description = "The group id of the service API") public String getGroupId() { return groupId; } @@ -50,7 +48,7 @@ public class ControllerServiceDefinition { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of the service API") + @Schema(description = "The artifact id of the service API") public String getArtifactId() { return artifactId; } @@ -59,7 +57,7 @@ public class ControllerServiceDefinition { this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of the service API") + @Schema(description = "The version of the service API") public String getVersion() { return version; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSchedule.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSchedule.java index 8cd79aae54..6609ccc48b 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSchedule.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSchedule.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class DefaultSchedule { @@ -30,7 +28,7 @@ public class DefaultSchedule { private String period; private String concurrentTasks; - @ApiModelProperty("The default scheduling strategy") + @Schema(description = "The default scheduling strategy") public String getStrategy() { return strategy; } @@ -39,7 +37,7 @@ public class DefaultSchedule { this.strategy = strategy; } - @ApiModelProperty("The default scheduling period") + @Schema(description = "The default scheduling period") public String getPeriod() { return period; } @@ -48,7 +46,7 @@ public class DefaultSchedule { this.period = period; } - @ApiModelProperty("The default concurrent tasks") + @Schema(description = "The default concurrent tasks") public String getConcurrentTasks() { return concurrentTasks; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSettings.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSettings.java index a7b9799896..d4cf2ce0a0 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSettings.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DefaultSettings.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class DefaultSettings { @@ -30,7 +28,7 @@ public class DefaultSettings { private String penaltyDuration; private String bulletinLevel; - @ApiModelProperty("The default yield duration") + @Schema(description = "The default yield duration") public String getYieldDuration() { return yieldDuration; } @@ -39,7 +37,7 @@ public class DefaultSettings { this.yieldDuration = yieldDuration; } - @ApiModelProperty("The default penalty duration") + @Schema(description = "The default penalty duration") public String getPenaltyDuration() { return penaltyDuration; } @@ -48,7 +46,7 @@ public class DefaultSettings { this.penaltyDuration = penaltyDuration; } - @ApiModelProperty("The default bulletin level") + @Schema(description = "The default bulletin level") public String getBulletinLevel() { return bulletinLevel; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Dependency.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Dependency.java index fce50f5737..04aee18590 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Dependency.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Dependency.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Dependency { @@ -30,7 +28,7 @@ public class Dependency { private String propertyDisplayName; private DependentValues dependentValues; - @ApiModelProperty(value = "The name of the dependent property") + @Schema(description = "The name of the dependent property") public String getPropertyName() { return propertyName; } @@ -39,7 +37,7 @@ public class Dependency { this.propertyName = propertyName; } - @ApiModelProperty(value = "The display name of the dependent property") + @Schema(description = "The display name of the dependent property") public String getPropertyDisplayName() { return propertyDisplayName; } @@ -48,7 +46,7 @@ public class Dependency { this.propertyDisplayName = propertyDisplayName; } - @ApiModelProperty(value = "The values of the dependent property that enable the depending property") + @Schema(description = "The values of the dependent property that enable the depending property") public DependentValues getDependentValues() { return dependentValues; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DependentValues.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DependentValues.java index 0e88780ba6..bb13b126eb 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DependentValues.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DependentValues.java @@ -16,22 +16,20 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class DependentValues { @XmlElement(name = "dependentValue") private List values; - @ApiModelProperty(value = "The dependent values") + @Schema(description = "The dependent values") public List getValues() { return values; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DeprecationNotice.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DeprecationNotice.java index dbffb6a06c..3b271cc01f 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DeprecationNotice.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DeprecationNotice.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -25,7 +24,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class DeprecationNotice { @@ -35,7 +33,7 @@ public class DeprecationNotice { @XmlElement(name = "alternative") private List alternatives; - @ApiModelProperty(value = "The reason for the deprecation") + @Schema(description = "The reason for the deprecation") public String getReason() { return reason; } @@ -44,7 +42,7 @@ public class DeprecationNotice { this.reason = reason; } - @ApiModelProperty(value = "The alternatives to use") + @Schema(description = "The alternatives to use") public List getAlternatives() { return alternatives; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicProperty.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicProperty.java index 9de143aa1f..a049c95e40 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicProperty.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicProperty.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class DynamicProperty { @@ -32,7 +30,7 @@ public class DynamicProperty { private ExpressionLanguageScope expressionLanguageScope; private boolean expressionLanguageSupported; - @ApiModelProperty(value = "The description of the dynamic property name") + @Schema(description = "The description of the dynamic property name") public String getName() { return name; } @@ -41,7 +39,7 @@ public class DynamicProperty { this.name = name; } - @ApiModelProperty(value = "The description of the dynamic property value") + @Schema(description = "The description of the dynamic property value") public String getValue() { return value; } @@ -50,7 +48,7 @@ public class DynamicProperty { this.value = value; } - @ApiModelProperty(value = "The description of the dynamic property") + @Schema(description = "The description of the dynamic property") public String getDescription() { return description; } @@ -59,7 +57,7 @@ public class DynamicProperty { this.description = description; } - @ApiModelProperty(value = "Whether or not expression language is supported") + @Schema(description = "Whether or not expression language is supported") public boolean isExpressionLanguageSupported() { return expressionLanguageSupported; } @@ -68,7 +66,7 @@ public class DynamicProperty { this.expressionLanguageSupported = expressionLanguageSupported; } - @ApiModelProperty(value = "The scope of the expression language support") + @Schema(description = "The scope of the expression language support") public ExpressionLanguageScope getExpressionLanguageScope() { return expressionLanguageScope; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicRelationship.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicRelationship.java index bbf7501000..92185cdaf2 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicRelationship.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/DynamicRelationship.java @@ -16,20 +16,20 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel + @XmlAccessorType(XmlAccessType.FIELD) public class DynamicRelationship { private String name; private String description; - @ApiModelProperty(value = "The description of the dynamic relationship name") + @Schema(description = "The description of the dynamic relationship name") public String getName() { return name; } @@ -38,7 +38,7 @@ public class DynamicRelationship { this.name = name; } - @ApiModelProperty(value = "The description of the dynamic relationship") + @Schema(description = "The description of the dynamic relationship") public String getDescription() { return description; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExpressionLanguageScope.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExpressionLanguageScope.java index c713724d7d..9d2e6daca6 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExpressionLanguageScope.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExpressionLanguageScope.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - -@ApiModel public enum ExpressionLanguageScope { /** diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java index a0b2a380dd..3459efd491 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.Valid; import jakarta.xml.bind.annotation.XmlAccessType; @@ -27,7 +26,6 @@ import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; import java.util.Objects; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Extension { @@ -109,7 +107,7 @@ public class Extension { @XmlElement(name = "multiProcessorUseCase") private List multiProcessorUseCases; - @ApiModelProperty(value = "The name of the extension") + @Schema(description = "The name of the extension") public String getName() { return name; } @@ -118,7 +116,7 @@ public class Extension { this.name = name; } - @ApiModelProperty(value = "The type of the extension") + @Schema(description = "The type of the extension") public ExtensionType getType() { return type; } @@ -127,7 +125,7 @@ public class Extension { this.type = type; } - @ApiModelProperty(value = "The deprecation notice of the extension") + @Schema(description = "The deprecation notice of the extension") public DeprecationNotice getDeprecationNotice() { return deprecationNotice; } @@ -136,7 +134,7 @@ public class Extension { this.deprecationNotice = deprecationNotice; } - @ApiModelProperty(value = "The description of the extension") + @Schema(description = "The description of the extension") public String getDescription() { return description; } @@ -145,7 +143,7 @@ public class Extension { this.description = description; } - @ApiModelProperty(value = "The tags of the extension") + @Schema(description = "The tags of the extension") public List getTags() { return tags; } @@ -154,7 +152,7 @@ public class Extension { this.tags = tags; } - @ApiModelProperty(value = "The properties of the extension") + @Schema(description = "The properties of the extension") public List getProperties() { return properties; } @@ -171,7 +169,7 @@ public class Extension { this.supportsSensitiveDynamicProperties = supportsSensitiveDynamicProperties; } - @ApiModelProperty(value = "The dynamic properties of the extension") + @Schema(description = "The dynamic properties of the extension") public List getDynamicProperties() { return dynamicProperties; } @@ -180,7 +178,7 @@ public class Extension { this.dynamicProperties = dynamicProperties; } - @ApiModelProperty(value = "The relationships of the extension") + @Schema(description = "The relationships of the extension") public List getRelationships() { return relationships; } @@ -189,7 +187,7 @@ public class Extension { this.relationships = relationships; } - @ApiModelProperty(value = "The dynamic relationships of the extension") + @Schema(description = "The dynamic relationships of the extension") public DynamicRelationship getDynamicRelationship() { return dynamicRelationship; } @@ -198,7 +196,7 @@ public class Extension { this.dynamicRelationship = dynamicRelationship; } - @ApiModelProperty(value = "The attributes read from flow files by the extension") + @Schema(description = "The attributes read from flow files by the extension") public List getReadsAttributes() { return readsAttributes; } @@ -207,7 +205,7 @@ public class Extension { this.readsAttributes = readsAttributes; } - @ApiModelProperty(value = "The attributes written to flow files by the extension") + @Schema(description = "The attributes written to flow files by the extension") public List getWritesAttributes() { return writesAttributes; } @@ -216,7 +214,7 @@ public class Extension { this.writesAttributes = writesAttributes; } - @ApiModelProperty(value = "The information about how the extension stores state") + @Schema(description = "The information about how the extension stores state") public Stateful getStateful() { return stateful; } @@ -225,7 +223,7 @@ public class Extension { this.stateful = stateful; } - @ApiModelProperty(value = "The restrictions of the extension") + @Schema(description = "The restrictions of the extension") public Restricted getRestricted() { return restricted; } @@ -234,7 +232,7 @@ public class Extension { this.restricted = restricted; } - @ApiModelProperty(value = "The input requirement of the extension") + @Schema(description = "The input requirement of the extension") public InputRequirement getInputRequirement() { return inputRequirement; } @@ -243,7 +241,7 @@ public class Extension { this.inputRequirement = inputRequirement; } - @ApiModelProperty(value = "The resource considerations of the extension") + @Schema(description = "The resource considerations of the extension") public List getSystemResourceConsiderations() { return systemResourceConsiderations; } @@ -252,7 +250,7 @@ public class Extension { this.systemResourceConsiderations = systemResourceConsiderations; } - @ApiModelProperty(value = "The names of other extensions to see") + @Schema(description = "The names of other extensions to see") public List getSeeAlso() { return seeAlso; } @@ -261,7 +259,7 @@ public class Extension { this.seeAlso = seeAlso; } - @ApiModelProperty(value = "The service APIs provided by this extension") + @Schema(description = "The service APIs provided by this extension") public List getProvidedServiceAPIs() { return providedServiceAPIs; } @@ -270,7 +268,7 @@ public class Extension { this.providedServiceAPIs = providedServiceAPIs; } - @ApiModelProperty(value = "The default settings for a processor") + @Schema(description = "The default settings for a processor") public DefaultSettings getDefaultSettings() { return defaultSettings; } @@ -279,7 +277,7 @@ public class Extension { this.defaultSettings = defaultSettings; } - @ApiModelProperty(value = "The default schedule for a processor reporting task") + @Schema(description = "The default schedule for a processor reporting task") public DefaultSchedule getDefaultSchedule() { return defaultSchedule; } @@ -288,7 +286,7 @@ public class Extension { this.defaultSchedule = defaultSchedule; } - @ApiModelProperty(value = "Indicates that a processor should be triggered serially") + @Schema(description = "Indicates that a processor should be triggered serially") public boolean getTriggerSerially() { return triggerSerially; } @@ -297,7 +295,7 @@ public class Extension { this.triggerSerially = triggerSerially; } - @ApiModelProperty(value = "Indicates that a processor should be triggered when the incoming queues are empty") + @Schema(description = "Indicates that a processor should be triggered when the incoming queues are empty") public boolean getTriggerWhenEmpty() { return triggerWhenEmpty; } @@ -306,7 +304,7 @@ public class Extension { this.triggerWhenEmpty = triggerWhenEmpty; } - @ApiModelProperty(value = "Indicates that a processor should be triggered when any destinations have space for flow files") + @Schema(description = "Indicates that a processor should be triggered when any destinations have space for flow files") public boolean getTriggerWhenAnyDestinationAvailable() { return triggerWhenAnyDestinationAvailable; } @@ -315,7 +313,7 @@ public class Extension { this.triggerWhenAnyDestinationAvailable = triggerWhenAnyDestinationAvailable; } - @ApiModelProperty(value = "Indicates that a processor supports batching") + @Schema(description = "Indicates that a processor supports batching") public boolean getSupportsBatching() { return supportsBatching; } @@ -324,7 +322,7 @@ public class Extension { this.supportsBatching = supportsBatching; } - @ApiModelProperty(value = "Indicates that a processor should be scheduled only on the primary node") + @Schema(description = "Indicates that a processor should be scheduled only on the primary node") public boolean getPrimaryNodeOnly() { return primaryNodeOnly; } @@ -333,7 +331,7 @@ public class Extension { this.primaryNodeOnly = primaryNodeOnly; } - @ApiModelProperty(value = "Indicates that a processor is side effect free") + @Schema(description = "Indicates that a processor is side effect free") public boolean getSideEffectFree() { return sideEffectFree; } @@ -342,7 +340,7 @@ public class Extension { this.sideEffectFree = sideEffectFree; } - @ApiModelProperty(value = "Zero or more documented use cases for how the extension may be used") + @Schema(description = "Zero or more documented use cases for how the extension may be used") public List getUseCases() { return useCases; } @@ -351,7 +349,7 @@ public class Extension { this.useCases = useCases; } - @ApiModelProperty(value = "Zero or more documented use cases for how the processor may be used in conjunction with other processors") + @Schema(description = "Zero or more documented use cases for how the processor may be used in conjunction with other processors") public List getMultiProcessorUseCases() { return multiProcessorUseCases; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionManifest.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionManifest.java index 70dffed575..a4c924d256 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionManifest.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionManifest.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -26,7 +25,6 @@ import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.List; -@ApiModel @XmlRootElement(name = "extensionManifest") @XmlAccessorType(XmlAccessType.FIELD) public class ExtensionManifest { @@ -54,7 +52,7 @@ public class ExtensionManifest { this.extensions = extensions; } - @ApiModelProperty(value = "The group id of this NAR") + @Schema(description = "The group id of this NAR") public String getGroupId() { return groupId; } @@ -63,7 +61,7 @@ public class ExtensionManifest { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of this NAR") + @Schema(description = "The artifact id of this NAR") public String getArtifactId() { return artifactId; } @@ -72,7 +70,7 @@ public class ExtensionManifest { this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of this NAR") + @Schema(description = "The version of this NAR") public String getVersion() { return version; } @@ -81,7 +79,7 @@ public class ExtensionManifest { this.version = version; } - @ApiModelProperty(value = "The info for the parent NAR of this NAR") + @Schema(description = "The info for the parent NAR of this NAR") public ParentNar getParentNar() { return parentNar; } @@ -90,7 +88,7 @@ public class ExtensionManifest { this.parentNar = parentNar; } - @ApiModelProperty(value = "The version of nifi-api this NAR was built against") + @Schema(description = "The version of nifi-api this NAR was built against") public String getSystemApiVersion() { return systemApiVersion; } @@ -99,7 +97,7 @@ public class ExtensionManifest { this.systemApiVersion = systemApiVersion; } - @ApiModelProperty(value = "The build info for the NAR") + @Schema(description = "The build info for the NAR") public BuildInfo getBuildInfo() { return buildInfo; } @@ -108,7 +106,7 @@ public class ExtensionManifest { this.buildInfo = buildInfo; } - @ApiModelProperty(value = "The list of extensions contained in this NAR") + @Schema(description = "The list of extensions contained in this NAR") public List getExtensions() { return extensions; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/InputRequirement.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/InputRequirement.java index 51cd7d3c25..15e038c286 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/InputRequirement.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/InputRequirement.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - -@ApiModel public enum InputRequirement { /** diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/MultiProcessorUseCase.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/MultiProcessorUseCase.java index 2fdd2b2c6a..dfdec5bb1f 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/MultiProcessorUseCase.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/MultiProcessorUseCase.java @@ -17,15 +17,12 @@ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class MultiProcessorUseCase { private String description; diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ParentNar.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ParentNar.java index a86c44e7f6..8ffcd7eb16 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ParentNar.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ParentNar.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class ParentNar { @@ -30,7 +28,7 @@ public class ParentNar { private String artifactId; private String version; - @ApiModelProperty(value = "The group id of the parent NAR") + @Schema(description = "The group id of the parent NAR") public String getGroupId() { return groupId; } @@ -39,7 +37,7 @@ public class ParentNar { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of the parent NAR") + @Schema(description = "The artifact id of the parent NAR") public String getArtifactId() { return artifactId; } @@ -48,7 +46,7 @@ public class ParentNar { this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of the parent NAR") + @Schema(description = "The version of the parent NAR") public String getVersion() { return version; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProcessorConfiguration.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProcessorConfiguration.java index 0f9b118b3e..5125a8e139 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProcessorConfiguration.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProcessorConfiguration.java @@ -17,9 +17,6 @@ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - -@ApiModel public class ProcessorConfiguration { private String processorClassName; private String configuration; diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Property.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Property.java index 6f97a4f629..acd5739c96 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Property.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Property.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -25,7 +24,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Property { @@ -54,7 +52,7 @@ public class Property { private ResourceDefinition resourceDefinition; - @ApiModelProperty(value = "The name of the property") + @Schema(description = "The name of the property") public String getName() { return name; } @@ -63,7 +61,7 @@ public class Property { this.name = name; } - @ApiModelProperty(value = "The display name") + @Schema(description = "The display name") public String getDisplayName() { return displayName; } @@ -72,7 +70,7 @@ public class Property { this.displayName = displayName; } - @ApiModelProperty(value = "The description") + @Schema(description = "The description") public String getDescription() { return description; } @@ -81,7 +79,7 @@ public class Property { this.description = description; } - @ApiModelProperty(value = "The default value") + @Schema(description = "The default value") public String getDefaultValue() { return defaultValue; } @@ -90,7 +88,7 @@ public class Property { this.defaultValue = defaultValue; } - @ApiModelProperty(value = "The controller service required by this property, or null if none is required") + @Schema(description = "The controller service required by this property, or null if none is required") public ControllerServiceDefinition getControllerServiceDefinition() { return controllerServiceDefinition; } @@ -99,7 +97,7 @@ public class Property { this.controllerServiceDefinition = controllerServiceDefinition; } - @ApiModelProperty(value = "The allowable values for this property") + @Schema(description = "The allowable values for this property") public List getAllowableValues() { return allowableValues; } @@ -108,7 +106,7 @@ public class Property { this.allowableValues = allowableValues; } - @ApiModelProperty(value = "Whether or not the property is required") + @Schema(description = "Whether or not the property is required") public boolean isRequired() { return required; } @@ -117,7 +115,7 @@ public class Property { this.required = required; } - @ApiModelProperty(value = "Whether or not the property is sensitive") + @Schema(description = "Whether or not the property is sensitive") public boolean isSensitive() { return sensitive; } @@ -126,7 +124,7 @@ public class Property { this.sensitive = sensitive; } - @ApiModelProperty(value = "Whether or not expression language is supported") + @Schema(description = "Whether or not expression language is supported") public boolean isExpressionLanguageSupported() { return expressionLanguageSupported; } @@ -135,7 +133,7 @@ public class Property { this.expressionLanguageSupported = expressionLanguageSupported; } - @ApiModelProperty(value = "The scope of expression language support") + @Schema(description = "The scope of expression language support") public ExpressionLanguageScope getExpressionLanguageScope() { return expressionLanguageScope; } @@ -144,7 +142,7 @@ public class Property { this.expressionLanguageScope = expressionLanguageScope; } - @ApiModelProperty(value = "Whether or not the processor dynamically modifies the classpath") + @Schema(description = "Whether or not the processor dynamically modifies the classpath") public boolean isDynamicallyModifiesClasspath() { return dynamicallyModifiesClasspath; } @@ -153,7 +151,7 @@ public class Property { this.dynamicallyModifiesClasspath = dynamicallyModifiesClasspath; } - @ApiModelProperty(value = "Whether or not the processor is dynamic") + @Schema(description = "Whether or not the processor is dynamic") public boolean isDynamic() { return dynamic; } @@ -162,7 +160,7 @@ public class Property { this.dynamic = dynamic; } - @ApiModelProperty(value = "The properties that this property depends on") + @Schema(description = "The properties that this property depends on") public List getDependencies() { return dependencies; } @@ -171,7 +169,7 @@ public class Property { this.dependencies = dependencies; } - @ApiModelProperty(value = "The optional resource definition") + @Schema(description = "The optional resource definition") public ResourceDefinition getResourceDefinition() { return resourceDefinition; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProvidedServiceAPI.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProvidedServiceAPI.java index 06a98105fd..a92216cecb 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProvidedServiceAPI.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ProvidedServiceAPI.java @@ -16,15 +16,13 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.NotBlank; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import java.util.Objects; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class ProvidedServiceAPI { @@ -37,7 +35,7 @@ public class ProvidedServiceAPI { @NotBlank private String version; - @ApiModelProperty(value = "The class name of the service API being provided") + @Schema(description = "The class name of the service API being provided") public String getClassName() { return className; } @@ -46,7 +44,7 @@ public class ProvidedServiceAPI { this.className = className; } - @ApiModelProperty(value = "The group id of the service API being provided") + @Schema(description = "The group id of the service API being provided") public String getGroupId() { return groupId; } @@ -55,7 +53,7 @@ public class ProvidedServiceAPI { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of the service API being provided") + @Schema(description = "The artifact id of the service API being provided") public String getArtifactId() { return artifactId; } @@ -64,7 +62,7 @@ public class ProvidedServiceAPI { this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of the service API being provided") + @Schema(description = "The version of the service API being provided") public String getVersion() { return version; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Relationship.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Relationship.java index 576a6c8c76..80f45ccc0f 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Relationship.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Relationship.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Relationship { @@ -30,7 +28,7 @@ public class Relationship { private String description; private boolean autoTerminated; - @ApiModelProperty(value = "The name of the relationship") + @Schema(description = "The name of the relationship") public String getName() { return name; } @@ -39,7 +37,7 @@ public class Relationship { this.name = name; } - @ApiModelProperty(value = "The description of the relationship") + @Schema(description = "The description of the relationship") public String getDescription() { return description; } @@ -48,7 +46,7 @@ public class Relationship { this.description = description; } - @ApiModelProperty(value = "Whether or not the relationship is auto-terminated by default") + @Schema(description = "Whether or not the relationship is auto-terminated by default") public boolean isAutoTerminated() { return autoTerminated; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceDefinition.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceDefinition.java index 3755e0c934..6525f7b844 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceDefinition.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceDefinition.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -25,7 +24,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class ResourceDefinition { @@ -35,7 +33,7 @@ public class ResourceDefinition { @XmlElement(name = "resourceType") private List resourceTypes; - @ApiModelProperty(value = "The cardinality of the resource definition") + @Schema(description = "The cardinality of the resource definition") public Cardinality getCardinality() { return cardinality; } @@ -44,7 +42,7 @@ public class ResourceDefinition { this.cardinality = cardinality; } - @ApiModelProperty(value = "The types of resources") + @Schema(description = "The types of resources") public List getResourceTypes() { return resourceTypes; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceType.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceType.java index 2f217f9ef9..f481839d01 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceType.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ResourceType.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - -@ApiModel public enum ResourceType { /** diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restricted.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restricted.java index 861b0ab501..0162806f54 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restricted.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restricted.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.Valid; import jakarta.xml.bind.annotation.XmlAccessType; @@ -26,7 +25,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Restricted { @@ -37,7 +35,7 @@ public class Restricted { @XmlElement(name = "restriction") private List restrictions; - @ApiModelProperty(value = "The general restriction for the extension, or null if only specific restrictions exist") + @Schema(description = "The general restriction for the extension, or null if only specific restrictions exist") public String getGeneralRestrictionExplanation() { return generalRestrictionExplanation; } @@ -46,7 +44,7 @@ public class Restricted { this.generalRestrictionExplanation = generalRestrictionExplanation; } - @ApiModelProperty(value = "The specific restrictions") + @Schema(description = "The specific restrictions") public List getRestrictions() { return restrictions; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restriction.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restriction.java index 92bd0e2bed..241a498150 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restriction.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Restriction.java @@ -16,15 +16,13 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.NotBlank; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import java.util.Objects; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Restriction { @@ -33,7 +31,7 @@ public class Restriction { @NotBlank private String explanation; - @ApiModelProperty(value = "The permission required for this restriction") + @Schema(description = "The permission required for this restriction") public String getRequiredPermission() { return requiredPermission; } @@ -42,7 +40,7 @@ public class Restriction { this.requiredPermission = requiredPermission; } - @ApiModelProperty(value = "The explanation of this restriction") + @Schema(description = "The explanation of this restriction") public String getExplanation() { return explanation; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Scope.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Scope.java index 7ee414ded4..e4db465a3e 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Scope.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Scope.java @@ -16,12 +16,9 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - /** * Possible scopes for storing state. */ -@ApiModel public enum Scope { CLUSTER, diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Stateful.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Stateful.java index 9b576b43ea..ae718952a9 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Stateful.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Stateful.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -25,7 +24,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Stateful { @@ -35,7 +33,7 @@ public class Stateful { @XmlElement(name = "scope") private List scopes; - @ApiModelProperty(value = "The description for how the extension stores state") + @Schema(description = "The description for how the extension stores state") public String getDescription() { return description; } @@ -44,7 +42,7 @@ public class Stateful { this.description = description; } - @ApiModelProperty(value = "The scopes used to store state") + @Schema(description = "The scopes used to store state") public List getScopes() { return scopes; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/SystemResourceConsideration.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/SystemResourceConsideration.java index b4528fc162..b1fe60c0d2 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/SystemResourceConsideration.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/SystemResourceConsideration.java @@ -16,20 +16,18 @@ */ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class SystemResourceConsideration { private String resource; private String description; - @ApiModelProperty(value = "The resource to consider") + @Schema(description = "The resource to consider") public String getResource() { return resource; } @@ -38,7 +36,7 @@ public class SystemResourceConsideration { this.resource = resource; } - @ApiModelProperty(value = "The description of how the resource is affected") + @Schema(description = "The description of how the resource is affected") public String getDescription() { return description; } diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/UseCase.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/UseCase.java index fc8fa09348..b62e03a712 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/UseCase.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/UseCase.java @@ -17,15 +17,12 @@ package org.apache.nifi.extension.manifest; -import io.swagger.annotations.ApiModel; - import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -@ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class UseCase { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/pom.xml index 3cf9833369..83d8854bb1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/pom.xml @@ -23,7 +23,7 @@ nifi-client-dto - io.swagger + io.swagger.core.v3 swagger-annotations diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AboutDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AboutDTO.java index b75ba46dd8..e45d1cd38c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AboutDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AboutDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import org.apache.nifi.web.api.dto.util.TimezoneAdapter; @@ -48,8 +48,7 @@ public class AboutDTO { * * @return The title */ - @ApiModelProperty( - value = "The title to be used on the page and in the about dialog." + @Schema(description = "The title to be used on the page and in the about dialog." ) public String getTitle() { return title; @@ -64,8 +63,7 @@ public class AboutDTO { * * @return The version. */ - @ApiModelProperty( - value = "The version of this NiFi." + @Schema(description = "The version of this NiFi." ) public String getVersion() { return version; @@ -78,8 +76,7 @@ public class AboutDTO { /** * @return URI for this NiFi controller */ - @ApiModelProperty( - value = "The URI for the NiFi." + @Schema(description = "The URI for the NiFi." ) public String getUri() { return uri; @@ -92,8 +89,7 @@ public class AboutDTO { /** * @return the URL for the content viewer if configured */ - @ApiModelProperty( - value = "The URL for the content viewer if configured." + @Schema(description = "The URL for the content viewer if configured." ) public String getContentViewerUrl() { return contentViewerUrl; @@ -107,10 +103,9 @@ public class AboutDTO { * @return the timezone of the NiFi instance */ @XmlJavaTypeAdapter(TimezoneAdapter.class) - @ApiModelProperty( - value = "The timezone of the NiFi instance.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, - dataType = "string" + @Schema(description = "The timezone of the NiFi instance.", + accessMode = Schema.AccessMode.READ_ONLY, + type = "string" ) public Date getTimezone() { return timezone; @@ -120,8 +115,7 @@ public class AboutDTO { this.timezone = timezone; } - @ApiModelProperty( - value = "Build tag" + @Schema(description = "Build tag" ) public String getBuildTag() { return buildTag; @@ -131,8 +125,7 @@ public class AboutDTO { this.buildTag = buildTag; } - @ApiModelProperty( - value = "Build revision or commit hash" + @Schema(description = "Build revision or commit hash" ) public String getBuildRevision() { return buildRevision; @@ -142,8 +135,7 @@ public class AboutDTO { this.buildRevision = buildRevision; } - @ApiModelProperty( - value = "Build branch" + @Schema(description = "Build branch" ) public String getBuildBranch() { return buildBranch; @@ -154,9 +146,8 @@ public class AboutDTO { } @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "Build timestamp", - dataType = "string" + @Schema(description = "Build timestamp", + type = "string" ) public Date getBuildTimestamp() { return buildTimestamp; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessConfigurationDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessConfigurationDTO.java index bebd34c3b7..79cd87a64d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessConfigurationDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessConfigurationDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,9 +31,8 @@ public class AccessConfigurationDTO { /** * @return Indicates whether or not this NiFi supports user login. */ - @ApiModelProperty( - value = "Indicates whether or not this NiFi supports user login.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Indicates whether or not this NiFi supports user login.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsLogin() { return supportsLogin; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java index f2145d8b72..367d5fe51b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.TenantEntity; import jakarta.xml.bind.annotation.XmlType; @@ -34,7 +34,7 @@ public class AccessPolicyDTO extends AccessPolicySummaryDTO { /** * @return The set of user IDs associated with this access policy. */ - @ApiModelProperty(value = "The set of user IDs associated with this access policy.") + @Schema(description = "The set of user IDs associated with this access policy.") public Set getUsers() { return users; } @@ -46,7 +46,7 @@ public class AccessPolicyDTO extends AccessPolicySummaryDTO { /** * @return The set of user group IDs associated with this access policy. */ - @ApiModelProperty(value = "The set of user group IDs associated with this access policy.") + @Schema(description = "The set of user group IDs associated with this access policy.") public Set getUserGroups() { return userGroups; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java index 091b8656a6..07da700c06 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ComponentReferenceEntity; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public class AccessPolicySummaryDTO extends ComponentDTO { /** * @return The action associated with this access policy. */ - @ApiModelProperty( - value = "The action associated with this access policy.", + @Schema(description = "The action associated with this access policy.", allowableValues = "read, write" ) public String getAction() { @@ -50,7 +49,7 @@ public class AccessPolicySummaryDTO extends ComponentDTO { /** * @return The resource for this access policy. */ - @ApiModelProperty(value="The resource for this access policy.") + @Schema(description = "The resource for this access policy.") public String getResource() { return resource; } @@ -62,7 +61,7 @@ public class AccessPolicySummaryDTO extends ComponentDTO { /** * @return Component this policy references if applicable. */ - @ApiModelProperty(value="Component this policy references if applicable.") + @Schema(description = "Component this policy references if applicable.") public ComponentReferenceEntity getComponentReference() { return componentReference; } @@ -74,7 +73,7 @@ public class AccessPolicySummaryDTO extends ComponentDTO { /** * @return whether this policy is configurable */ - @ApiModelProperty(value = "Whether this policy is configurable.") + @Schema(description = "Whether this policy is configurable.") public Boolean getConfigurable() { return configurable; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessStatusDTO.java index 404e5bd735..92410c504a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; @@ -40,9 +40,8 @@ public class AccessStatusDTO { /** * @return the user identity */ - @ApiModelProperty( - value = "The user identity.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The user identity.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getIdentity() { return identity; @@ -55,9 +54,8 @@ public class AccessStatusDTO { /** * @return the user access status */ - @ApiModelProperty( - value = "The user access status.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The user access status.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getStatus() { return status; @@ -70,9 +68,8 @@ public class AccessStatusDTO { /** * @return additional details about the user access status */ - @ApiModelProperty( - value = "Additional details about the user access status.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Additional details about the user access status.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getMessage() { return message; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessTokenExpirationDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessTokenExpirationDTO.java index db7682f397..c95c484d57 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessTokenExpirationDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessTokenExpirationDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.InstantAdapter; import jakarta.xml.bind.annotation.XmlRootElement; @@ -29,10 +29,9 @@ public class AccessTokenExpirationDTO { private Instant expiration; @XmlJavaTypeAdapter(InstantAdapter.class) - @ApiModelProperty( - value = "Token Expiration", - dataType = "string", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Token Expiration", + type = "string", + accessMode = Schema.AccessMode.READ_ONLY ) public Instant getExpiration() { return expiration; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AffectedComponentDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AffectedComponentDTO.java index 8289202176..44f3024f88 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AffectedComponentDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AffectedComponentDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -41,7 +41,7 @@ public class AffectedComponentDTO { private Collection validationErrors; - @ApiModelProperty("The UUID of the Process Group that this component is in") + @Schema(description = "The UUID of the Process Group that this component is in") public String getProcessGroupId() { return processGroupId; } @@ -50,7 +50,7 @@ public class AffectedComponentDTO { this.processGroupId = processGroupId; } - @ApiModelProperty("The UUID of this component") + @Schema(description = "The UUID of this component") public String getId() { return id; } @@ -59,7 +59,7 @@ public class AffectedComponentDTO { this.id = id; } - @ApiModelProperty(value = "The type of this component", + @Schema(description = "The type of this component", allowableValues = COMPONENT_TYPE_PROCESSOR + "," + COMPONENT_TYPE_CONTROLLER_SERVICE + ", " + COMPONENT_TYPE_INPUT_PORT + ", " + COMPONENT_TYPE_OUTPUT_PORT + ", " + COMPONENT_TYPE_REMOTE_INPUT_PORT + ", " + COMPONENT_TYPE_REMOTE_OUTPUT_PORT + ", " + COMPONENT_TYPE_STATELESS_GROUP) @@ -71,7 +71,7 @@ public class AffectedComponentDTO { this.referenceType = referenceType; } - @ApiModelProperty("The name of this component.") + @Schema(description = "The name of this component.") public String getName() { return name; } @@ -83,8 +83,7 @@ public class AffectedComponentDTO { /** * @return active thread count for the referencing component */ - @ApiModelProperty( - value = "The number of active threads for the referencing component." + @Schema(description = "The number of active threads for the referencing component." ) public Integer getActiveThreadCount() { return activeThreadCount; @@ -97,8 +96,7 @@ public class AffectedComponentDTO { /** * @return Any validation error associated with this component */ - @ApiModelProperty( - value = "The validation errors for the component." + @Schema(description = "The validation errors for the component." ) public Collection getValidationErrors() { return validationErrors; @@ -108,7 +106,7 @@ public class AffectedComponentDTO { this.validationErrors = validationErrors; } - @ApiModelProperty("The scheduled state of a processor or reporting task referencing a controller service. If this component is another controller " + @Schema(description = "The scheduled state of a processor or reporting task referencing a controller service. If this component is another controller " + "service, this field represents the controller service state.") public String getState() { return state; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AllowableValueDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AllowableValueDTO.java index 606e9f9be1..2d15bffb7e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AllowableValueDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AllowableValueDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class AllowableValueDTO { /** * @return the human-readable value that is allowed for this PropertyDescriptor */ - @ApiModelProperty( - value = "A human readable value that is allowed for the property descriptor." + @Schema(description = "A human readable value that is allowed for the property descriptor." ) public String getDisplayName() { return displayName; @@ -47,8 +46,7 @@ public class AllowableValueDTO { /** * @return the value for this allowable value */ - @ApiModelProperty( - value = "A value that is allowed for the property descriptor." + @Schema(description = "A value that is allowed for the property descriptor." ) public String getValue() { return value; @@ -61,8 +59,7 @@ public class AllowableValueDTO { /** * @return a description of this Allowable Value, or null if no description is given */ - @ApiModelProperty( - value = "A description for this allowable value." + @Schema(description = "A description for this allowable value." ) public String getDescription() { return description; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AnalyzeFlowRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AnalyzeFlowRequestDTO.java index 7157fba199..188c1a1da2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AnalyzeFlowRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AnalyzeFlowRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,7 +35,7 @@ public class AnalyzeFlowRequestDTO extends AsynchronousRequestDTO { private List updateSteps; - @ApiModelProperty(value = "The ID of the request", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The ID of the request", accessMode = Schema.AccessMode.READ_ONLY) public String getRequestId() { return requestId; } @@ -44,7 +44,7 @@ public abstract class AsynchronousRequestDTO { this.requestId = requestId; } - @ApiModelProperty(value = "The URI for the request", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The URI for the request", accessMode = Schema.AccessMode.READ_ONLY) public String getUri() { return uri; } @@ -54,7 +54,7 @@ public abstract class AsynchronousRequestDTO { } @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty(value = "The timestamp of when the request was submitted", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The timestamp of when the request was submitted", accessMode = Schema.AccessMode.READ_ONLY) public Date getSubmissionTime() { return submissionTime; } @@ -64,7 +64,7 @@ public abstract class AsynchronousRequestDTO { } @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty(value = "The timestamp of when the request was last updated", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The timestamp of when the request was last updated", accessMode = Schema.AccessMode.READ_ONLY) public Date getLastUpdated() { return lastUpdated; } @@ -73,7 +73,7 @@ public abstract class AsynchronousRequestDTO { this.lastUpdated = lastUpdated; } - @ApiModelProperty(value = "Whether or not the request is completed", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Whether or not the request is completed", accessMode = Schema.AccessMode.READ_ONLY) public boolean isComplete() { return complete; } @@ -82,7 +82,7 @@ public abstract class AsynchronousRequestDTO { this.complete = complete; } - @ApiModelProperty(value = "The reason for the request failing, or null if the request has not failed", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The reason for the request failing, or null if the request has not failed", accessMode = Schema.AccessMode.READ_ONLY) public String getFailureReason() { return failureReason; } @@ -91,7 +91,7 @@ public abstract class AsynchronousRequestDTO { this.failureReason = failureReason; } - @ApiModelProperty(value = "A value between 0 and 100 (inclusive) indicating how close the request is to completion", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "A value between 0 and 100 (inclusive) indicating how close the request is to completion", accessMode = Schema.AccessMode.READ_ONLY) public int getPercentCompleted() { return percentCompleted; } @@ -100,7 +100,7 @@ public abstract class AsynchronousRequestDTO { this.percentCompleted = percentCompleted; } - @ApiModelProperty(value = "A description of the current state of the request", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "A description of the current state of the request", accessMode = Schema.AccessMode.READ_ONLY) public String getState() { return state; } @@ -109,7 +109,7 @@ public abstract class AsynchronousRequestDTO { this.state = state; } - @ApiModelProperty(value = "The steps that are required in order to complete the request, along with the status of each", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The steps that are required in order to complete the request, along with the status of each", accessMode = Schema.AccessMode.READ_ONLY) public List getUpdateSteps() { return updateSteps; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BannerDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BannerDTO.java index 1b2d797a25..ae1008806f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BannerDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BannerDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public class BannerDTO { * * @return The footer text */ - @ApiModelProperty( - value = "The footer text." + @Schema(description = "The footer text." ) public String getFooterText() { return footerText; @@ -51,8 +50,7 @@ public class BannerDTO { * * @return The header text */ - @ApiModelProperty( - value = "The header text." + @Schema(description = "The header text." ) public String getHeaderText() { return headerText; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BatchSettingsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BatchSettingsDTO.java index f5cafe443d..6b004cac8a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BatchSettingsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BatchSettingsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class BatchSettingsDTO { /** * @return preferred number of flow files to include in a transaction */ - @ApiModelProperty( - value = "Preferred number of flow files to include in a transaction." + @Schema(description = "Preferred number of flow files to include in a transaction." ) public Integer getCount() { return count; @@ -47,8 +46,7 @@ public class BatchSettingsDTO { /** * @return preferred number of bytes to include in a transaction */ - @ApiModelProperty( - value = "Preferred number of bytes to include in a transaction." + @Schema(description = "Preferred number of bytes to include in a transaction." ) public String getSize() { return size; @@ -61,8 +59,7 @@ public class BatchSettingsDTO { /** * @return preferred amount of time that a transaction should span */ - @ApiModelProperty( - value = "Preferred amount of time that a transaction should span." + @Schema(description = "Preferred amount of time that a transaction should span." ) public String getDuration() { return duration; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java index dcd74d8a0a..79bd3da676 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import org.apache.nifi.web.api.entity.BulletinEntity; @@ -37,8 +37,7 @@ public class BulletinBoardDTO { /** * @return bulletins to populate in the bulletin board */ - @ApiModelProperty( - value = "The bulletins in the bulletin board, that matches the supplied request." + @Schema(description = "The bulletins in the bulletin board, that matches the supplied request." ) public List getBulletins() { return bulletins; @@ -52,9 +51,8 @@ public class BulletinBoardDTO { * @return when this bulletin board was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The timestamp when this report was generated.", - dataType = "string" + @Schema(description = "The timestamp when this report was generated.", + type = "string" ) public Date getGenerated() { return generated; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java index 64c3e6417b..6f5cc39547 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -43,8 +43,7 @@ public class BulletinDTO { /** * @return id of this message */ - @ApiModelProperty( - value = "The id of the bulletin." + @Schema(description = "The id of the bulletin." ) public Long getId() { return id; @@ -57,8 +56,7 @@ public class BulletinDTO { /** * @return When clustered, the address of the node from which this bulletin originated */ - @ApiModelProperty( - value = "If clustered, the address of the node from which the bulletin originated." + @Schema(description = "If clustered, the address of the node from which the bulletin originated." ) public String getNodeAddress() { return nodeAddress; @@ -71,8 +69,7 @@ public class BulletinDTO { /** * @return group id of the source component */ - @ApiModelProperty( - value = "The group id of the source component." + @Schema(description = "The group id of the source component." ) public String getGroupId() { return groupId; @@ -85,8 +82,7 @@ public class BulletinDTO { /** * @return category of this message */ - @ApiModelProperty( - value = "The category of this bulletin." + @Schema(description = "The category of this bulletin." ) public String getCategory() { return category; @@ -99,8 +95,7 @@ public class BulletinDTO { /** * @return actual message */ - @ApiModelProperty( - value = "The bulletin message." + @Schema(description = "The bulletin message." ) public String getMessage() { return message; @@ -113,8 +108,7 @@ public class BulletinDTO { /** * @return id of the source of this message */ - @ApiModelProperty( - value = "The id of the source component." + @Schema(description = "The id of the source component." ) public String getSourceId() { return sourceId; @@ -127,8 +121,7 @@ public class BulletinDTO { /** * @return name of the source of this message */ - @ApiModelProperty( - value = "The name of the source component." + @Schema(description = "The name of the source component." ) public String getSourceName() { return sourceName; @@ -141,8 +134,7 @@ public class BulletinDTO { /** * @return level of this bulletin */ - @ApiModelProperty( - value = "The level of the bulletin." + @Schema(description = "The level of the bulletin." ) public String getLevel() { return level; @@ -156,9 +148,8 @@ public class BulletinDTO { * @return When this bulletin was generated as a formatted string */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "When this bulletin was generated.", - dataType = "string" + @Schema(description = "When this bulletin was generated.", + type = "string" ) public Date getTimestamp() { return timestamp; @@ -168,8 +159,7 @@ public class BulletinDTO { this.timestamp = timestamp; } - @ApiModelProperty( - value = "The type of the source component" + @Schema(description = "The type of the source component" ) public String getSourceType() { return sourceType; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java index 97ca4bb165..8bdd512225 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -36,8 +36,7 @@ public class BulletinQueryDTO { /** * @return Include bulletins after this id */ - @ApiModelProperty( - value = "Will include bulletins that occurred after this id. The ids are a one-up number that are used to ensure bulletins that " + @Schema(description = "Will include bulletins that occurred after this id. The ids are a one-up number that are used to ensure bulletins that " + "occur at the same time will not be missed." ) public Long getAfter() { @@ -51,8 +50,7 @@ public class BulletinQueryDTO { /** * @return Include bulletin within this group. Supports a regular expression */ - @ApiModelProperty( - value = "Will include bulletins that occurred within this group. Supports a regular expression." + @Schema(description = "Will include bulletins that occurred within this group. Supports a regular expression." ) public String getGroupId() { return groupId; @@ -65,8 +63,7 @@ public class BulletinQueryDTO { /** * @return Include bulletins that match this message. Supports a regular expression */ - @ApiModelProperty( - value = "Will include bulletins that match this message. Supports a regular expression." + @Schema(description = "Will include bulletins that match this message. Supports a regular expression." ) public String getMessage() { return message; @@ -79,8 +76,7 @@ public class BulletinQueryDTO { /** * @return Include bulletins that match this name. Supports a regular expression */ - @ApiModelProperty( - value = "Will include bulletins that match this name. Supports a regular expression." + @Schema(description = "Will include bulletins that match this name. Supports a regular expression." ) public String getName() { return name; @@ -93,8 +89,7 @@ public class BulletinQueryDTO { /** * @return Include bulletins that match this id. Supports a source id */ - @ApiModelProperty( - value = "Will include bulletins from components that match this id. Supports a regular expression." + @Schema(description = "Will include bulletins from components that match this id. Supports a regular expression." ) public String getSourceId() { return sourceId; @@ -107,8 +102,7 @@ public class BulletinQueryDTO { /** * @return The maximum number of bulletins to return */ - @ApiModelProperty( - value = "The maximum number of bulletins to return." + @Schema(description = "The maximum number of bulletins to return." ) public Integer getLimit() { return limit; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BundleDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BundleDTO.java index 6d7bd1637c..903ef4e7d0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BundleDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BundleDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Objects; @@ -45,8 +45,7 @@ public class BundleDTO { * * @return bundle group */ - @ApiModelProperty( - value = "The group of the bundle." + @Schema(description = "The group of the bundle." ) public String getGroup() { return group; @@ -61,8 +60,7 @@ public class BundleDTO { * * @return bundle artifact */ - @ApiModelProperty( - value = "The artifact of the bundle." + @Schema(description = "The artifact of the bundle." ) public String getArtifact() { return artifact; @@ -77,8 +75,7 @@ public class BundleDTO { * * @return bundle version */ - @ApiModelProperty( - value = "The version of the bundle." + @Schema(description = "The version of the bundle." ) public String getVersion() { return version; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java index d8b6ec9866..03bb30c3b5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -36,8 +36,7 @@ public class ClusterDTO { /** * @return collection of the node DTOs */ - @ApiModelProperty( - value = "The collection of nodes that are part of the cluster." + @Schema(description = "The collection of nodes that are part of the cluster." ) public Collection getNodes() { return nodes; @@ -51,9 +50,8 @@ public class ClusterDTO { * @return the date/time that this report was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The timestamp the report was generated.", - dataType = "string" + @Schema(description = "The timestamp the report was generated.", + type = "string" ) public Date getGenerated() { return generated; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterSummaryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterSummaryDTO.java index bc96302682..39ff54717b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterSummaryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterSummaryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -36,8 +36,7 @@ public class ClusterSummaryDTO { /** * @return whether this NiFi instance is clustered */ - @ApiModelProperty( - value = "Whether this NiFi instance is clustered." + @Schema(description = "Whether this NiFi instance is clustered." ) public Boolean getClustered() { return isClustered; @@ -50,8 +49,7 @@ public class ClusterSummaryDTO { /** * @return whether this NiFi instance is connected to a cluster */ - @ApiModelProperty( - value = "Whether this NiFi instance is connected to a cluster." + @Schema(description = "Whether this NiFi instance is connected to a cluster." ) public Boolean getConnectedToCluster() { return isConnectedToCluster; @@ -61,7 +59,7 @@ public class ClusterSummaryDTO { isConnectedToCluster = connectedToCluster; } - @ApiModelProperty("The number of nodes that are currently connected to the cluster") + @Schema(description = "The number of nodes that are currently connected to the cluster") public Integer getConnectedNodeCount() { return connectedNodeCount; } @@ -70,7 +68,7 @@ public class ClusterSummaryDTO { this.connectedNodeCount = connectedNodeCount; } - @ApiModelProperty("The number of nodes in the cluster, regardless of whether or not they are connected") + @Schema(description = "The number of nodes in the cluster, regardless of whether or not they are connected") public Integer getTotalNodeCount() { return totalNodeCount; } @@ -83,7 +81,7 @@ public class ClusterSummaryDTO { * @return Used in clustering, will report the number of nodes connected vs * the number of nodes in the cluster */ - @ApiModelProperty("When clustered, reports the number of nodes connected vs the number of nodes in the cluster.") + @Schema(description = "When clustered, reports the number of nodes connected vs the number of nodes in the cluster.") public String getConnectedNodes() { return connectedNodes; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java index 6cbb927b7c..4dd1a6ab7b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -37,8 +37,7 @@ public class ComponentDTO { * * @return The id */ - @ApiModelProperty( - value = "The id of the component." + @Schema(description = "The id of the component." ) public String getId() { return this.id; @@ -48,7 +47,7 @@ public class ComponentDTO { this.id = id; } - @ApiModelProperty("The ID of the corresponding component that is under version control") + @Schema(description = "The ID of the corresponding component that is under version control") public String getVersionedComponentId() { return versionedComponentId; } @@ -60,8 +59,7 @@ public class ComponentDTO { /** * @return id for the parent group of this component if applicable, null otherwise */ - @ApiModelProperty( - value = "The id of parent process group of this component if applicable." + @Schema(description = "The id of parent process group of this component if applicable." ) public String getParentGroupId() { return parentGroupId; @@ -76,8 +74,7 @@ public class ComponentDTO { * * @return The position */ - @ApiModelProperty( - value = "The position of this component in the UI if applicable." + @Schema(description = "The position of this component in the UI if applicable." ) public PositionDTO getPosition() { return position; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDifferenceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDifferenceDTO.java index 566a8de454..5ac6c30a46 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDifferenceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDifferenceDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -31,7 +31,7 @@ public class ComponentDifferenceDTO { private String processGroupId; private List differences; - @ApiModelProperty("The type of component") + @Schema(description = "The type of component") public String getComponentType() { return componentType; } @@ -40,7 +40,7 @@ public class ComponentDifferenceDTO { this.componentType = componentType; } - @ApiModelProperty("The ID of the component") + @Schema(description = "The ID of the component") public String getComponentId() { return componentId; } @@ -49,7 +49,7 @@ public class ComponentDifferenceDTO { this.componentId = componentId; } - @ApiModelProperty("The name of the component") + @Schema(description = "The name of the component") public String getComponentName() { return componentName; } @@ -58,7 +58,7 @@ public class ComponentDifferenceDTO { this.componentName = componentName; } - @ApiModelProperty("The ID of the Process Group that the component belongs to") + @Schema(description = "The ID of the Process Group that the component belongs to") public String getProcessGroupId() { return processGroupId; } @@ -67,7 +67,7 @@ public class ComponentDifferenceDTO { this.processGroupId = processGroupId; } - @ApiModelProperty("The differences in the component between the two flows") + @Schema(description = "The differences in the component between the two flows") public List getDifferences() { return differences; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java index 796da3380e..240c70dcb1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Map; @@ -33,8 +33,7 @@ public class ComponentHistoryDTO { /** * @return component id */ - @ApiModelProperty( - value = "The component id." + @Schema(description = "The component id." ) public String getComponentId() { return componentId; @@ -47,8 +46,7 @@ public class ComponentHistoryDTO { /** * @return history for this components properties */ - @ApiModelProperty( - value = "The history for the properties of the component." + @Schema(description = "The history for the properties of the component." ) public Map getPropertyHistory() { return propertyHistory; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentReferenceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentReferenceDTO.java index 0580adc988..0dccab0474 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentReferenceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentReferenceDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public class ComponentReferenceDTO extends ComponentDTO { * * @return The id */ - @ApiModelProperty( - value = "The id of the component." + @Schema(description = "The id of the component." ) public String getId() { return this.id; @@ -49,8 +48,7 @@ public class ComponentReferenceDTO extends ComponentDTO { /** * @return id for the parent group of this component if applicable, null otherwise */ - @ApiModelProperty( - value = "The id of parent process group of this component if applicable." + @Schema(description = "The id of parent process group of this component if applicable." ) public String getParentGroupId() { return parentGroupId; @@ -63,8 +61,7 @@ public class ComponentReferenceDTO extends ComponentDTO { /** * @return id for the parent group of this component if applicable, null otherwise */ - @ApiModelProperty( - value = "The name of the component." + @Schema(description = "The name of the component." ) public String getName() { return name; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentRestrictionPermissionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentRestrictionPermissionDTO.java index ff59e17fb8..b50737487c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentRestrictionPermissionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentRestrictionPermissionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Objects; @@ -33,8 +33,7 @@ public class ComponentRestrictionPermissionDTO { /** * @return The required permission necessary for this restriction. */ - @ApiModelProperty( - value = "The required permission necessary for this restriction." + @Schema(description = "The required permission necessary for this restriction." ) public RequiredPermissionDTO getRequiredPermission() { return requiredPermission; @@ -47,8 +46,7 @@ public class ComponentRestrictionPermissionDTO { /** * @return The permissions for this component restriction. */ - @ApiModelProperty( - value = "The permissions for this component restriction. Note: the read permission are not used and will always be false." + @Schema(description = "The permissions for this component restriction. Note: the read permission are not used and will always be false." ) public PermissionsDTO getPermissions() { return permissions; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentStateDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentStateDTO.java index 5ee5848427..37ba9d13f2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentStateDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentStateDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,8 +34,7 @@ public class ComponentStateDTO { /** * @return The component identifier */ - @ApiModelProperty( - value = "The component identifier." + @Schema(description = "The component identifier." ) public String getComponentId() { return componentId; @@ -48,8 +47,7 @@ public class ComponentStateDTO { /** * @return Description of the state this component persists. */ - @ApiModelProperty( - value = "Description of the state this component persists." + @Schema(description = "Description of the state this component persists." ) public String getStateDescription() { return stateDescription; @@ -62,8 +60,7 @@ public class ComponentStateDTO { /** * @return The cluster state for this component, or null if this NiFi is a standalone instance */ - @ApiModelProperty( - value = "The cluster state for this component, or null if this NiFi is a standalone instance." + @Schema(description = "The cluster state for this component, or null if this NiFi is a standalone instance." ) public StateMapDTO getClusterState() { return clusterState; @@ -76,8 +73,7 @@ public class ComponentStateDTO { /** * @return The local state for this component */ - @ApiModelProperty( - value = "The local state for this component." + @Schema(description = "The local state for this component." ) public StateMapDTO getLocalState() { return localState; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentValidationResultDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentValidationResultDTO.java index 2a3f6c4dd9..040b09f9d4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentValidationResultDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentValidationResultDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -27,7 +27,7 @@ public class ComponentValidationResultDTO extends AffectedComponentDTO { private Boolean resultsValid; private Collection resultantValidationErrors; - @ApiModelProperty("Whether or not the component is currently valid") + @Schema(description = "Whether or not the component is currently valid") public Boolean getCurrentlyValid() { return currentlyValid; } @@ -36,7 +36,7 @@ public class ComponentValidationResultDTO extends AffectedComponentDTO { this.currentlyValid = currentlyValid; } - @ApiModelProperty("Whether or not the component will be valid if the Parameter Context is changed") + @Schema(description = "Whether or not the component will be valid if the Parameter Context is changed") public Boolean getResultsValid() { return resultsValid; } @@ -45,7 +45,7 @@ public class ComponentValidationResultDTO extends AffectedComponentDTO { this.resultsValid = resultsValid; } - @ApiModelProperty("The validation errors that will apply to the component if the Parameter Context is changed") + @Schema(description = "The validation errors that will apply to the component if the Parameter Context is changed") public Collection getResultantValidationErrors() { return resultantValidationErrors; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigVerificationResultDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigVerificationResultDTO.java index b44b40ea02..6ae28b2722 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigVerificationResultDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigVerificationResultDTO.java @@ -17,14 +17,14 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class ConfigVerificationResultDTO { private String outcome; private String verificationStepName; private String explanation; - @ApiModelProperty(value = "The outcome of the verification", allowableValues = "SUCCESSFUL, FAILED, SKIPPED") + @Schema(description = "The outcome of the verification", allowableValues = "SUCCESSFUL, FAILED, SKIPPED") public String getOutcome() { return outcome; } @@ -33,7 +33,7 @@ public class ConfigVerificationResultDTO { this.outcome = outcome; } - @ApiModelProperty("The name of the verification step") + @Schema(description = "The name of the verification step") public String getVerificationStepName() { return verificationStepName; } @@ -42,7 +42,7 @@ public class ConfigVerificationResultDTO { this.verificationStepName = verificationStepName; } - @ApiModelProperty("An explanation of why the step was or was not successful") + @Schema(description = "An explanation of why the step was or was not successful") public String getExplanation() { return explanation; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigurationAnalysisDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigurationAnalysisDTO.java index 58464696bf..d1ea4f68cd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigurationAnalysisDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConfigurationAnalysisDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Map; @@ -29,7 +29,7 @@ public class ConfigurationAnalysisDTO { private Map referencedAttributes; private boolean supportsVerification; - @ApiModelProperty("The ID of the component") + @Schema(description = "The ID of the component") public String getComponentId() { return componentId; } @@ -38,7 +38,7 @@ public class ConfigurationAnalysisDTO { this.componentId = componentId; } - @ApiModelProperty("The configured properties for the component") + @Schema(description = "The configured properties for the component") public Map getProperties() { return properties; } @@ -47,7 +47,7 @@ public class ConfigurationAnalysisDTO { this.properties = properties; } - @ApiModelProperty("The attributes that are referenced by the properties, mapped to recently used values") + @Schema(description = "The attributes that are referenced by the properties, mapped to recently used values") public Map getReferencedAttributes() { return referencedAttributes; } @@ -56,7 +56,7 @@ public class ConfigurationAnalysisDTO { this.referencedAttributes = referencedAttributes; } - @ApiModelProperty("Whether or not the component supports verification") + @Schema(description = "Whether or not the component supports verification") public boolean isSupportsVerification() { return supportsVerification; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java index ddbd9f0c5c..fb58c2a344 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -39,9 +39,8 @@ public class ConnectableDTO { /** * @return id of this connectable component */ - @ApiModelProperty( - value = "The id of the connectable component.", - required = true + @Schema(description = "The id of the connectable component.", + requiredMode = Schema.RequiredMode.REQUIRED ) public String getId() { return id; @@ -51,7 +50,7 @@ public class ConnectableDTO { this.id = id; } - @ApiModelProperty("The ID of the corresponding component that is under version control") + @Schema(description = "The ID of the corresponding component that is under version control") public String getVersionedComponentId() { return versionedComponentId; } @@ -64,9 +63,8 @@ public class ConnectableDTO { /** * @return type of this connectable component */ - @ApiModelProperty( - value = "The type of component the connectable is.", - required = true, + @Schema(description = "The type of component the connectable is.", + requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = "PROCESSOR, REMOTE_INPUT_PORT, REMOTE_OUTPUT_PORT, INPUT_PORT, OUTPUT_PORT, FUNNEL" ) public String getType() { @@ -80,9 +78,8 @@ public class ConnectableDTO { /** * @return id of the group that this connectable component resides in */ - @ApiModelProperty( - value = "The id of the group that the connectable component resides in", - required = true + @Schema(description = "The id of the group that the connectable component resides in", + requiredMode = Schema.RequiredMode.REQUIRED ) public String getGroupId() { return groupId; @@ -95,8 +92,7 @@ public class ConnectableDTO { /** * @return name of this connectable component */ - @ApiModelProperty( - value = "The name of the connectable component" + @Schema(description = "The name of the connectable component" ) public String getName() { return name; @@ -109,8 +105,7 @@ public class ConnectableDTO { /** * @return Used to reflect the current state of this Connectable */ - @ApiModelProperty( - value = "Reflects the current state of the connectable component." + @Schema(description = "Reflects the current state of the connectable component." ) public Boolean isRunning() { return running; @@ -123,8 +118,7 @@ public class ConnectableDTO { /** * @return If this represents a remote port it is used to indicate whether the target exists */ - @ApiModelProperty( - value = "If the connectable component represents a remote port, indicates if the target exists." + @Schema(description = "If the connectable component represents a remote port, indicates if the target exists." ) public Boolean getExists() { return exists; @@ -137,8 +131,7 @@ public class ConnectableDTO { /** * @return If this represents a remote port it is used to indicate whether is it configured to transmit */ - @ApiModelProperty( - value = "If the connectable component represents a remote port, indicates if the target is configured to transmit." + @Schema(description = "If the connectable component represents a remote port, indicates if the target is configured to transmit." ) public Boolean getTransmitting() { return transmitting; @@ -151,8 +144,7 @@ public class ConnectableDTO { /** * @return The comments from this Connectable */ - @ApiModelProperty( - value = "The comments for the connectable component." + @Schema(description = "The comments for the connectable component." ) public String getComments() { return comments; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java index f98c149c6d..22aea63a1c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -55,8 +55,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The source of this connection */ - @ApiModelProperty( - value = "The source of the connection." + @Schema(description = "The source of the connection." ) public ConnectableDTO getSource() { return source; @@ -71,8 +70,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The destination of this connection */ - @ApiModelProperty( - value = "The destination of the connection." + @Schema(description = "The destination of the connection." ) public ConnectableDTO getDestination() { return destination; @@ -85,8 +83,7 @@ public class ConnectionDTO extends ComponentDTO { /** * @return name of the connection */ - @ApiModelProperty( - value = "The name of the connection." + @Schema(description = "The name of the connection." ) public String getName() { return name; @@ -99,8 +96,7 @@ public class ConnectionDTO extends ComponentDTO { /** * @return position of the bend points on this connection */ - @ApiModelProperty( - value = "The bend points on the connection." + @Schema(description = "The bend points on the connection." ) public List getBends() { return bends; @@ -113,8 +109,7 @@ public class ConnectionDTO extends ComponentDTO { /** * @return The index of control point that the connection label should be placed over */ - @ApiModelProperty( - value = "The index of the bend point where to place the connection label." + @Schema(description = "The index of the bend point where to place the connection label." ) public Integer getLabelIndex() { return labelIndex; @@ -127,8 +122,7 @@ public class ConnectionDTO extends ComponentDTO { /** * @return z index for this connection */ - @ApiModelProperty( - value = "The z index of the connection." + @Schema(description = "The z index of the connection." ) public Long getzIndex() { return zIndex; @@ -143,8 +137,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The relationships */ - @ApiModelProperty( - value = "The selected relationship that comprise the connection." + @Schema(description = "The selected relationship that comprise the connection." ) public Set getSelectedRelationships() { return selectedRelationships; @@ -157,9 +150,8 @@ public class ConnectionDTO extends ComponentDTO { /** * @return relationships that the source of the connection currently supports. This property is read only */ - @ApiModelProperty( - value = "The relationships that the source of the connection currently supports.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The relationships that the source of the connection currently supports.", + accessMode = Schema.AccessMode.READ_ONLY ) public Set getAvailableRelationships() { return availableRelationships; @@ -175,8 +167,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The back pressure object threshold */ - @ApiModelProperty( - value = "The object count threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing files " + @Schema(description = "The object count threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing files " + "over the limit are affected but it does help feeder processors to stop pushing too much into this work queue." ) public Long getBackPressureObjectThreshold() { @@ -193,8 +184,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The back pressure data size threshold */ - @ApiModelProperty( - value = "The object data size threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing " + @Schema(description = "The object data size threshold for determining when back pressure is applied. Updating this value is a passive change in the sense that it won't impact whether existing " + "files over the limit are affected but it does help feeder processors to stop pushing too much into this work queue." ) public String getBackPressureDataSizeThreshold() { @@ -211,8 +201,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The flow file expiration in minutes */ - @ApiModelProperty( - value = "The amount of time a flow file may be in the flow before it will be automatically aged out of the flow. Once a flow file reaches this age it will be terminated from " + @Schema(description = "The amount of time a flow file may be in the flow before it will be automatically aged out of the flow. Once a flow file reaches this age it will be terminated from " + "the flow the next time a processor attempts to start work on it." ) public String getFlowFileExpiration() { @@ -228,8 +217,7 @@ public class ConnectionDTO extends ComponentDTO { * * @return The prioritizer list */ - @ApiModelProperty( - value = "The comparators used to prioritize the queue." + @Schema(description = "The comparators used to prioritize the queue." ) public List getPrioritizers() { return prioritizers; @@ -239,7 +227,7 @@ public class ConnectionDTO extends ComponentDTO { this.prioritizers = prioritizers; } - @ApiModelProperty(value = "How to load balance the data in this Connection across the nodes in the cluster.", + @Schema(description = "How to load balance the data in this Connection across the nodes in the cluster.", allowableValues = "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, SINGLE_NODE") public String getLoadBalanceStrategy() { return loadBalanceStrategy; @@ -249,7 +237,7 @@ public class ConnectionDTO extends ComponentDTO { this.loadBalanceStrategy = loadBalanceStrategy; } - @ApiModelProperty(value = "The FlowFile Attribute to use for determining which node a FlowFile will go to if the Load Balancing Strategy is set to PARTITION_BY_ATTRIBUTE") + @Schema(description = "The FlowFile Attribute to use for determining which node a FlowFile will go to if the Load Balancing Strategy is set to PARTITION_BY_ATTRIBUTE") public String getLoadBalancePartitionAttribute() { return loadBalancePartitionAttribute; } @@ -258,7 +246,7 @@ public class ConnectionDTO extends ComponentDTO { this.loadBalancePartitionAttribute = partitionAttribute; } - @ApiModelProperty(value = "Whether or not data should be compressed when being transferred between nodes in the cluster.", + @Schema(description = "Whether or not data should be compressed when being transferred between nodes in the cluster.", allowableValues = "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, COMPRESS_ATTRIBUTES_AND_CONTENT") public String getLoadBalanceCompression() { return loadBalanceCompression; @@ -268,10 +256,10 @@ public class ConnectionDTO extends ComponentDTO { this.loadBalanceCompression = compression; } - @ApiModelProperty(value = "The current status of the Connection's Load Balancing Activities. Status can indicate that Load Balancing is not configured for the connection, that Load Balancing " + + @Schema(description = "The current status of the Connection's Load Balancing Activities. Status can indicate that Load Balancing is not configured for the connection, that Load Balancing " + "is configured but inactive (not currently transferring data to another node), or that Load Balancing is configured and actively transferring data to another node.", allowableValues = LOAD_BALANCE_NOT_CONFIGURED + ", " + LOAD_BALANCE_INACTIVE + ", " + LOAD_BALANCE_ACTIVE, - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + accessMode = Schema.AccessMode.READ_ONLY) public String getLoadBalanceStatus() { return loadBalanceStatus; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java index 8c416d0b3f..9cae14631b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,8 +31,7 @@ public class ControllerConfigurationDTO { /** * @return maximum number of timer driven threads this NiFi has available */ - @ApiModelProperty( - value = "The maximum number of timer driven threads the NiFi has available." + @Schema(description = "The maximum number of timer driven threads the NiFi has available." ) public Integer getMaxTimerDrivenThreadCount() { return maxTimerDrivenThreadCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java index 8e2f08bdb1..42e5f6b2db 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Set; @@ -51,8 +51,7 @@ public class ControllerDTO { /** * @return id of this NiFi controller */ - @ApiModelProperty( - value = "The id of the NiFi." + @Schema(description = "The id of the NiFi." ) public String getId() { return id; @@ -67,8 +66,7 @@ public class ControllerDTO { * * @return The name of this controller */ - @ApiModelProperty( - value = "The name of the NiFi." + @Schema(description = "The name of the NiFi." ) public String getName() { return name; @@ -81,8 +79,7 @@ public class ControllerDTO { /** * @return comments of this NiFi controller */ - @ApiModelProperty( - value = "The comments for the NiFi." + @Schema(description = "The comments for the NiFi." ) public String getComments() { return comments; @@ -95,8 +92,7 @@ public class ControllerDTO { /** * @return input ports available to send data to this NiFi controller */ - @ApiModelProperty( - value = "The input ports available to send data to for the NiFi." + @Schema(description = "The input ports available to send data to for the NiFi." ) public Set getInputPorts() { return inputPorts; @@ -109,8 +105,7 @@ public class ControllerDTO { /** * @return output ports available to received data from this NiFi controller */ - @ApiModelProperty( - value = "The output ports available to received data from the NiFi." + @Schema(description = "The output ports available to received data from the NiFi." ) public Set getOutputPorts() { return outputPorts; @@ -123,8 +118,7 @@ public class ControllerDTO { /** * @return Instance ID of the cluster, if this node is connected to a Cluster Manager, or of this individual instance of in standalone mode */ - @ApiModelProperty( - value = "If clustered, the id of the Cluster Manager, otherwise the id of the NiFi." + @Schema(description = "If clustered, the id of the Cluster Manager, otherwise the id of the NiFi." ) public String getInstanceId() { return instanceId; @@ -139,8 +133,7 @@ public class ControllerDTO { * * @return a integer between 1 and 65535, or null, if not configured for remote transfer */ - @ApiModelProperty( - value = "The Socket Port on which this instance is listening for Remote Transfers of Flow Files. If this instance is not configured to receive Flow Files from remote " + @Schema(description = "The Socket Port on which this instance is listening for Remote Transfers of Flow Files. If this instance is not configured to receive Flow Files from remote " + "instances, this will be null." ) public Integer getRemoteSiteListeningPort() { @@ -156,8 +149,7 @@ public class ControllerDTO { * * @return a integer between 1 and 65535, or null, if not configured for remote transfer */ - @ApiModelProperty( - value = "The HTTP(S) Port on which this instance is listening for Remote Transfers of Flow Files. If this instance is not configured to receive Flow Files from remote " + @Schema(description = "The HTTP(S) Port on which this instance is listening for Remote Transfers of Flow Files. If this instance is not configured to receive Flow Files from remote " + "instances, this will be null." ) public Integer getRemoteSiteHttpListeningPort() { @@ -171,8 +163,7 @@ public class ControllerDTO { /** * @return Indicates whether or not Site-to-Site communications with this instance is secure (2-way authentication) */ - @ApiModelProperty( - value = "Indicates whether or not Site-to-Site communications with this instance is secure (2-way authentication)." + @Schema(description = "Indicates whether or not Site-to-Site communications with this instance is secure (2-way authentication)." ) public Boolean isSiteToSiteSecure() { return siteToSiteSecure; @@ -185,8 +176,7 @@ public class ControllerDTO { /** * @return number of running components in this process group */ - @ApiModelProperty( - value = "The number of running components in the NiFi." + @Schema(description = "The number of running components in the NiFi." ) public Integer getRunningCount() { return runningCount; @@ -199,8 +189,7 @@ public class ControllerDTO { /** * @return number of stopped components in this process group */ - @ApiModelProperty( - value = "The number of stopped components in the NiFi." + @Schema(description = "The number of stopped components in the NiFi." ) public Integer getStoppedCount() { return stoppedCount; @@ -213,8 +202,7 @@ public class ControllerDTO { /** * @return number of active remote ports contained in this process group */ - @ApiModelProperty( - value = "The number of active remote ports contained in the NiFi." + @Schema(description = "The number of active remote ports contained in the NiFi." ) public Integer getActiveRemotePortCount() { return activeRemotePortCount; @@ -227,8 +215,7 @@ public class ControllerDTO { /** * @return number of inactive remote ports contained in this process group */ - @ApiModelProperty( - value = "The number of inactive remote ports contained in the NiFi." + @Schema(description = "The number of inactive remote ports contained in the NiFi." ) public Integer getInactiveRemotePortCount() { return inactiveRemotePortCount; @@ -241,8 +228,7 @@ public class ControllerDTO { /** * @return number of input ports contained in this process group */ - @ApiModelProperty( - value = "The number of input ports contained in the NiFi." + @Schema(description = "The number of input ports contained in the NiFi." ) public Integer getInputPortCount() { return inputPortCount; @@ -255,8 +241,7 @@ public class ControllerDTO { /** * @return number of invalid components in this process group */ - @ApiModelProperty( - value = "The number of invalid components in the NiFi." + @Schema(description = "The number of invalid components in the NiFi." ) public Integer getInvalidCount() { return invalidCount; @@ -269,8 +254,7 @@ public class ControllerDTO { /** * @return number of disabled components in this process group */ - @ApiModelProperty( - value = "The number of disabled components in the NiFi." + @Schema(description = "The number of disabled components in the NiFi." ) public Integer getDisabledCount() { return disabledCount; @@ -283,8 +267,7 @@ public class ControllerDTO { /** * @return number of output ports in this process group */ - @ApiModelProperty( - value = "The number of output ports in the NiFi." + @Schema(description = "The number of output ports in the NiFi." ) public Integer getOutputPortCount() { return outputPortCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceApiDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceApiDTO.java index 7fba1b5ac0..7eb60bf4ad 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceApiDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceApiDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Objects; @@ -33,8 +33,7 @@ public class ControllerServiceApiDTO { /** * @return The type is the fully-qualified name of the service interface */ - @ApiModelProperty( - value = "The fully qualified name of the service interface." + @Schema(description = "The fully qualified name of the service interface." ) public String getType() { return type; @@ -49,8 +48,7 @@ public class ControllerServiceApiDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this service interface." + @Schema(description = "The details of the artifact that bundled this service interface." ) public BundleDTO getBundle() { return bundle; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java index 1ed47e0551..33f0372260 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentEntity; import jakarta.xml.bind.annotation.XmlType; @@ -63,8 +63,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return controller service name */ - @ApiModelProperty( - value = "The name of the controller service." + @Schema(description = "The name of the controller service." ) public String getName() { return name; @@ -77,8 +76,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return the controller service type */ - @ApiModelProperty( - value = "The type of the controller service." + @Schema(description = "The type of the controller service." ) public String getType() { return type; @@ -93,8 +91,7 @@ public class ControllerServiceDTO extends ComponentDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this processor type." + @Schema(description = "The details of the artifact that bundled this processor type." ) public BundleDTO getBundle() { return bundle; @@ -109,8 +106,7 @@ public class ControllerServiceDTO extends ComponentDTO { * * @return The listing of implemented APIs */ - @ApiModelProperty( - value = "Lists the APIs this Controller Service implements." + @Schema(description = "Lists the APIs this Controller Service implements." ) public List getControllerServiceApis() { return controllerServiceApis; @@ -123,8 +119,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return the comment for the Controller Service */ - @ApiModelProperty( - value = "The comments for the controller service." + @Schema(description = "The comments for the controller service." ) public String getComments() { return comments; @@ -137,8 +132,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return the level at which this controller service will report bulletins */ - @ApiModelProperty( - value = "The level at which the controller service will report bulletins." + @Schema(description = "The level at which the controller service will report bulletins." ) public String getBulletinLevel() { return bulletinLevel; @@ -151,8 +145,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return whether this controller service persists state */ - @ApiModelProperty( - value = "Whether the controller service persists state." + @Schema(description = "Whether the controller service persists state." ) public Boolean getPersistsState() { return persistsState; @@ -165,8 +158,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return whether this controller service requires elevated privileges */ - @ApiModelProperty( - value = "Whether the controller service requires elevated privileges." + @Schema(description = "Whether the controller service requires elevated privileges." ) public Boolean getRestricted() { return restricted; @@ -179,8 +171,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return Whether the controller service has been deprecated. */ - @ApiModelProperty( - value = "Whether the ontroller service has been deprecated." + @Schema(description = "Whether the ontroller service has been deprecated." ) public Boolean getDeprecated() { return deprecated; @@ -193,8 +184,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return whether the underlying extension is missing */ - @ApiModelProperty( - value = "Whether the underlying extension is missing." + @Schema(description = "Whether the underlying extension is missing." ) public Boolean getExtensionMissing() { return isExtensionMissing; @@ -207,8 +197,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return whether this controller service has multiple versions available */ - @ApiModelProperty( - value = "Whether the controller service has multiple versions available." + @Schema(description = "Whether the controller service has multiple versions available." ) public Boolean getMultipleVersionsAvailable() { return multipleVersionsAvailable; @@ -221,8 +210,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return whether this controller service supports sensitive dynamic properties */ - @ApiModelProperty( - value = "Whether the controller service supports sensitive dynamic properties." + @Schema(description = "Whether the controller service supports sensitive dynamic properties." ) public Boolean getSupportsSensitiveDynamicProperties() { return supportsSensitiveDynamicProperties; @@ -235,8 +223,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return The state of this controller service. Possible values are ENABLED, ENABLING, DISABLED, DISABLING */ - @ApiModelProperty( - value = "The state of the controller service.", + @Schema(description = "The state of the controller service.", allowableValues = "ENABLED, ENABLING, DISABLED, DISABLING" ) public String getState() { @@ -250,8 +237,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return controller service properties */ - @ApiModelProperty( - value = "The properties of the controller service." + @Schema(description = "The properties of the controller service." ) public Map getProperties() { return properties; @@ -264,8 +250,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return descriptors for the controller service properties */ - @ApiModelProperty( - value = "The descriptors for the controller service properties." + @Schema(description = "The descriptors for the controller service properties." ) public Map getDescriptors() { return descriptors; @@ -278,8 +263,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return Set of sensitive dynamic property names */ - @ApiModelProperty( - value = "Set of sensitive dynamic property names" + @Schema(description = "Set of sensitive dynamic property names" ) public Set getSensitiveDynamicPropertyNames() { return sensitiveDynamicPropertyNames; @@ -292,8 +276,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return the URL for this controller services custom configuration UI if applicable. Null otherwise */ - @ApiModelProperty( - value = "The URL for the controller services custom configuration UI if applicable." + @Schema(description = "The URL for the controller services custom configuration UI if applicable." ) public String getCustomUiUrl() { return customUiUrl; @@ -306,8 +289,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return annotation data for this controller service */ - @ApiModelProperty( - value = "The annotation for the controller service. This is how the custom UI relays configuration to the controller service." + @Schema(description = "The annotation for the controller service. This is how the custom UI relays configuration to the controller service." ) public String getAnnotationData() { return annotationData; @@ -320,8 +302,7 @@ public class ControllerServiceDTO extends ComponentDTO { /** * @return all components referencing this controller service */ - @ApiModelProperty( - value = "All components referencing this controller service." + @Schema(description = "All components referencing this controller service." ) public Set getReferencingComponents() { return referencingComponents; @@ -336,8 +317,10 @@ public class ControllerServiceDTO extends ComponentDTO { * * @return The validation errors */ - @ApiModelProperty( - value = "The validation errors from the controller service. These validation errors represent the problems with the controller service that must be resolved before it can be enabled." + @Schema(description = """ + The validation errors from the controller service. + These validation errors represent the problems with the controller service that must be resolved before it can be enabled. + """ ) public Collection getValidationErrors() { return validationErrors; @@ -347,8 +330,8 @@ public class ControllerServiceDTO extends ComponentDTO { this.validationErrors = validationErrors; } - @ApiModelProperty(value = "Indicates whether the ControllerService is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the ControllerService is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "Indicates whether the ControllerService is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the ControllerService is valid)", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java index ca37a4dbfd..3cfd407fd2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentEntity; import jakarta.xml.bind.annotation.XmlType; @@ -50,8 +50,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return Group id for this component referencing a controller service. If this component is another service, this field is blank */ - @ApiModelProperty( - value = "The group id for the component referencing a controller service. If this component is another controller service or a reporting " + @Schema(description = "The group id for the component referencing a controller service. If this component is another controller service or a reporting " + "task, this field is blank." ) public String getGroupId() { @@ -65,8 +64,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return id for this component referencing a controller service */ - @ApiModelProperty( - value = "The id of the component referencing a controller service." + @Schema(description = "The id of the component referencing a controller service." ) public String getId() { return id; @@ -79,8 +77,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return name for this component referencing a controller service */ - @ApiModelProperty( - value = "The name of the component referencing a controller service." + @Schema(description = "The name of the component referencing a controller service." ) public String getName() { return name; @@ -93,8 +90,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return type for this component referencing a controller service */ - @ApiModelProperty( - value = "The type of the component referencing a controller service in simple Java class name format without package name." + @Schema(description = "The type of the component referencing a controller service in simple Java class name format without package name." ) public String getType() { return type; @@ -107,8 +103,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return scheduled state of the processor referencing a controller service. If this component is another service, this field represents the controller service state */ - @ApiModelProperty( - value = "The scheduled state of a processor or reporting task referencing a controller service. If this component is another controller " + @Schema(description = "The scheduled state of a processor or reporting task referencing a controller service. If this component is another controller " + "service, this field represents the controller service state." ) public String getState() { @@ -122,8 +117,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return type of reference this is (Processor, ControllerService, ParameterProvider, or ReportingTask) */ - @ApiModelProperty( - value = "The type of reference this is.", + @Schema(description = "The type of reference this is.", allowableValues = "Processor, ControllerService, ReportingTask, FlowRegistryClient" ) public String getReferenceType() { @@ -137,8 +131,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return component properties */ - @ApiModelProperty( - value = "The properties for the component." + @Schema(description = "The properties for the component." ) public Map getProperties() { return properties; @@ -151,8 +144,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return descriptors for the components properties */ - @ApiModelProperty( - value = "The descriptors for the component properties." + @Schema(description = "The descriptors for the component properties." ) public Map getDescriptors() { return descriptors; @@ -165,8 +157,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return Any validation error associated with this component */ - @ApiModelProperty( - value = "The validation errors for the component." + @Schema(description = "The validation errors for the component." ) public Collection getValidationErrors() { return validationErrors; @@ -179,8 +170,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return active thread count for the referencing component */ - @ApiModelProperty( - value = "The number of active threads for the referencing component." + @Schema(description = "The number of active threads for the referencing component." ) public Integer getActiveThreadCount() { return activeThreadCount; @@ -193,8 +183,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return If this referencing component represents a ControllerService, these are the components that reference it */ - @ApiModelProperty( - value = "If the referencing component represents a controller service, these are the components that reference it." + @Schema(description = "If the referencing component represents a controller service, these are the components that reference it." ) public Set getReferencingComponents() { return referencingComponents; @@ -207,8 +196,7 @@ public class ControllerServiceReferencingComponentDTO { /** * @return If this referencing component represents a ControllerService, this indicates whether it has already been represented in this hierarchy */ - @ApiModelProperty( - value = "If the referencing component represents a controller service, this indicates whether it has already been represented in this hierarchy." + @Schema(description = "If the referencing component represents a controller service, this indicates whether it has already been represented in this hierarchy." ) public Boolean getReferenceCycle() { return referenceCycle; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java index 5a596d1df4..75228f60f5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public class CounterDTO implements Cloneable { /** * @return context of the counter */ - @ApiModelProperty( - value = "The context of the counter." + @Schema(description = "The context of the counter." ) public String getContext() { return context; @@ -49,8 +48,7 @@ public class CounterDTO implements Cloneable { /** * @return id of the counter */ - @ApiModelProperty( - value = "The id of the counter." + @Schema(description = "The id of the counter." ) public String getId() { return id; @@ -63,8 +61,7 @@ public class CounterDTO implements Cloneable { /** * @return name of the counter */ - @ApiModelProperty( - value = "The name of the counter." + @Schema(description = "The name of the counter." ) public String getName() { return name; @@ -77,8 +74,7 @@ public class CounterDTO implements Cloneable { /** * @return value for the counter */ - @ApiModelProperty( - value = "The value of the counter." + @Schema(description = "The value of the counter." ) public String getValue() { return value; @@ -88,8 +84,7 @@ public class CounterDTO implements Cloneable { this.value = value; } - @ApiModelProperty( - value = "The value count." + @Schema(description = "The value count." ) public Long getValueCount() { return valueCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java index ad1048d54b..097d713247 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -27,7 +27,7 @@ public class CountersDTO { private CountersSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty("A Counters snapshot that represents the aggregate values of all nodes in the cluster. If the NiFi instance is " + @Schema(description = "A Counters snapshot that represents the aggregate values of all nodes in the cluster. If the NiFi instance is " + "a standalone instance, rather than a cluster, this represents the stats of the single instance.") public CountersSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; @@ -37,7 +37,7 @@ public class CountersDTO { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A Counters snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + @Schema(description = "A Counters snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + "a cluster, this may be null.") public List getNodeSnapshots() { return nodeSnapshots; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersSnapshotDTO.java index 2a80528a74..f6be698005 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -35,7 +35,7 @@ public class CountersSnapshotDTO implements Cloneable { private Date generated; private Collection counters; - @ApiModelProperty("All counters in the NiFi.") + @Schema(description = "All counters in the NiFi.") public Collection getCounters() { return counters; } @@ -45,9 +45,8 @@ public class CountersSnapshotDTO implements Cloneable { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The timestamp when the report was generated.", - dataType = "string" + @Schema(description = "The timestamp when the report was generated.", + type = "string" ) public Date getGenerated() { return generated; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DifferenceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DifferenceDTO.java index 2781876264..0b1dd2a087 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DifferenceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DifferenceDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -26,7 +26,7 @@ public class DifferenceDTO { private String differenceType; private String difference; - @ApiModelProperty("The type of difference") + @Schema(description = "The type of difference") public String getDifferenceType() { return differenceType; } @@ -35,7 +35,7 @@ public class DifferenceDTO { this.differenceType = differenceType; } - @ApiModelProperty("Description of the difference") + @Schema(description = "Description of the difference") public String getDifference() { return difference; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java index 3a7888d2e3..cdce31202b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,8 +34,7 @@ public class DimensionsDTO { /** * @return height of the label in pixels when at a 1:1 scale */ - @ApiModelProperty( - value = "The height of the label in pixels when at a 1:1 scale." + @Schema(description = "The height of the label in pixels when at a 1:1 scale." ) public Double getHeight() { return height; @@ -48,8 +47,7 @@ public class DimensionsDTO { /** * @return width of the label in pixels when at a 1:1 scale */ - @ApiModelProperty( - value = "The width of the label in pixels when at a 1:1 scale." + @Schema(description = "The width of the label in pixels when at a 1:1 scale." ) public Double getWidth() { return width; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java index 2adbb758fd..6f5574c417 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -42,8 +42,7 @@ public class DocumentedTypeDTO { /** * @return An optional description of the corresponding type */ - @ApiModelProperty( - value = "The description of the type." + @Schema(description = "The description of the type." ) public String getDescription() { return description; @@ -56,8 +55,7 @@ public class DocumentedTypeDTO { /** * @return Whether this type is restricted */ - @ApiModelProperty( - value = "Whether this type is restricted." + @Schema(description = "Whether this type is restricted." ) public boolean isRestricted() { return restricted; @@ -70,8 +68,7 @@ public class DocumentedTypeDTO { /** * @return An optional collection of explicit restrictions */ - @ApiModelProperty( - value = "An optional collection of explicit restrictions. If specified, these explicit restrictions will be enfored." + @Schema(description = "An optional collection of explicit restrictions. If specified, these explicit restrictions will be enfored." ) public Set getExplicitRestrictions() { return explicitRestrictions; @@ -84,8 +81,7 @@ public class DocumentedTypeDTO { /** * @return An optional description of why the usage of this component is restricted */ - @ApiModelProperty( - value = "The optional description of why the usage of this component is restricted." + @Schema(description = "The optional description of why the usage of this component is restricted." ) public String getUsageRestriction() { return usageRestriction; @@ -98,8 +94,7 @@ public class DocumentedTypeDTO { /** * @return An optional description of why the usage of this component is deprecated */ - @ApiModelProperty( - value = "The description of why the usage of this component is restricted." + @Schema(description = "The description of why the usage of this component is restricted." ) public String getDeprecationReason() { return deprecationReason; @@ -113,8 +108,7 @@ public class DocumentedTypeDTO { /** * @return The type is the fully-qualified name of a Java class */ - @ApiModelProperty( - value = "The fully qualified name of the type." + @Schema(description = "The fully qualified name of the type." ) public String getType() { return type; @@ -129,8 +123,7 @@ public class DocumentedTypeDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this type." + @Schema(description = "The details of the artifact that bundled this type." ) public BundleDTO getBundle() { return bundle; @@ -145,8 +138,7 @@ public class DocumentedTypeDTO { * * @return The listing of implemented APIs */ - @ApiModelProperty( - value = "If this type represents a ControllerService, this lists the APIs it implements." + @Schema(description = "If this type represents a ControllerService, this lists the APIs it implements." ) public List getControllerServiceApis() { return controllerServiceApis; @@ -159,8 +151,7 @@ public class DocumentedTypeDTO { /** * @return The tags associated with this type */ - @ApiModelProperty( - value = "The tags associated with this type." + @Schema(description = "The tags associated with this type." ) public Set getTags() { return tags; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DropRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DropRequestDTO.java index 3f10430d19..3f77b941a5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DropRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DropRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -56,8 +56,7 @@ public class DropRequestDTO { * * @return The id */ - @ApiModelProperty( - value = "The id for this drop request." + @Schema(description = "The id for this drop request." ) public String getId() { return this.id; @@ -72,8 +71,7 @@ public class DropRequestDTO { * * @return The uri */ - @ApiModelProperty( - value = "The URI for future requests to this drop request." + @Schema(description = "The URI for future requests to this drop request." ) public String getUri() { return uri; @@ -87,9 +85,8 @@ public class DropRequestDTO { * @return time the query was submitted */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp when the query was submitted.", - dataType = "string" + @Schema(description = "The timestamp when the query was submitted.", + type = "string" ) public Date getSubmissionTime() { return submissionTime; @@ -102,8 +99,7 @@ public class DropRequestDTO { /** * @return percent completed */ - @ApiModelProperty( - value = "The current percent complete." + @Schema(description = "The current percent complete." ) public Integer getPercentCompleted() { return percentCompleted; @@ -116,8 +112,7 @@ public class DropRequestDTO { /** * @return whether the query has finished */ - @ApiModelProperty( - value = "Whether the query has finished." + @Schema(description = "Whether the query has finished." ) public Boolean isFinished() { return finished; @@ -130,8 +125,7 @@ public class DropRequestDTO { /** * @return the reason, if any, that this drop request failed */ - @ApiModelProperty( - value = "The reason, if any, that this drop request failed." + @Schema(description = "The reason, if any, that this drop request failed." ) public String getFailureReason() { return failureReason; @@ -145,9 +139,8 @@ public class DropRequestDTO { * @return the time this request was last updated */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The last time this drop request was updated.", - dataType = "string" + @Schema(description = "The last time this drop request was updated.", + type = "string" ) public Date getLastUpdated() { return lastUpdated; @@ -160,8 +153,7 @@ public class DropRequestDTO { /** * @return the number of flow files currently queued. */ - @ApiModelProperty( - value = "The number of flow files currently queued." + @Schema(description = "The number of flow files currently queued." ) public Integer getCurrentCount() { return currentCount; @@ -174,8 +166,7 @@ public class DropRequestDTO { /** * @return the size of the flow files currently queued in bytes. */ - @ApiModelProperty( - value = "The size of flow files currently queued in bytes." + @Schema(description = "The size of flow files currently queued in bytes." ) public Long getCurrentSize() { return currentSize; @@ -188,8 +179,7 @@ public class DropRequestDTO { /** * @return the count and size of the currently queued flow files. */ - @ApiModelProperty( - value = "The count and size of flow files currently queued." + @Schema(description = "The count and size of flow files currently queued." ) public String getCurrent() { return current; @@ -202,8 +192,7 @@ public class DropRequestDTO { /** * @return the number of flow files to be dropped as a result of this request. */ - @ApiModelProperty( - value = "The number of flow files to be dropped as a result of this request." + @Schema(description = "The number of flow files to be dropped as a result of this request." ) public Integer getOriginalCount() { return originalCount; @@ -216,8 +205,7 @@ public class DropRequestDTO { /** * @return the size of the flow files to be dropped as a result of this request in bytes. */ - @ApiModelProperty( - value = "The size of flow files to be dropped as a result of this request in bytes." + @Schema(description = "The size of flow files to be dropped as a result of this request in bytes." ) public Long getOriginalSize() { return originalSize; @@ -230,8 +218,7 @@ public class DropRequestDTO { /** * @return the count and size of flow files to be dropped as a result of this request. */ - @ApiModelProperty( - value = "The count and size of flow files to be dropped as a result of this request." + @Schema(description = "The count and size of flow files to be dropped as a result of this request." ) public String getOriginal() { return original; @@ -244,8 +231,7 @@ public class DropRequestDTO { /** * @return the number of flow files that have been dropped thus far. */ - @ApiModelProperty( - value = "The number of flow files that have been dropped thus far." + @Schema(description = "The number of flow files that have been dropped thus far." ) public Integer getDroppedCount() { return droppedCount; @@ -258,8 +244,7 @@ public class DropRequestDTO { /** * @return the size of the flow files that have been dropped thus far in bytes. */ - @ApiModelProperty( - value = "The size of flow files that have been dropped thus far in bytes." + @Schema(description = "The size of flow files that have been dropped thus far in bytes." ) public Long getDroppedSize() { return droppedSize; @@ -272,8 +257,7 @@ public class DropRequestDTO { /** * @return the count and size of the flow files that have been dropped thus far. */ - @ApiModelProperty( - value = "The count and size of flow files that have been dropped thus far." + @Schema(description = "The count and size of flow files that have been dropped thus far." ) public String getDropped() { return dropped; @@ -286,8 +270,7 @@ public class DropRequestDTO { /** * @return the current state of the drop request. */ - @ApiModelProperty( - value = "The current state of the drop request." + @Schema(description = "The current state of the drop request." ) public String getState() { return state; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ExplicitRestrictionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ExplicitRestrictionDTO.java index b8798b9ed7..1ecbe46cc1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ExplicitRestrictionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ExplicitRestrictionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,8 +32,7 @@ public class ExplicitRestrictionDTO { /** * @return The required permission necessary for this restriction. */ - @ApiModelProperty( - value = "The required permission necessary for this restriction." + @Schema(description = "The required permission necessary for this restriction." ) public RequiredPermissionDTO getRequiredPermission() { return requiredPermission; @@ -46,8 +45,7 @@ public class ExplicitRestrictionDTO { /** * @return The description of why the usage of this component is restricted for this required permission. */ - @ApiModelProperty( - value = "The description of why the usage of this component is restricted for this required permission." + @Schema(description = "The description of why the usage of this component is restricted for this required permission." ) public String getExplanation() { return explanation; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowAnalysisRuleDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowAnalysisRuleDTO.java index 41fcd8e0d5..33e2058214 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowAnalysisRuleDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowAnalysisRuleDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -53,8 +53,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return user-defined name of the flow analysis rule */ - @ApiModelProperty( - value = "The name of the flow analysis rule." + @Schema(description = "The name of the flow analysis rule." ) public String getName() { return name; @@ -67,8 +66,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return user-defined comments for the flow analysis rule */ - @ApiModelProperty( - value = "The comments of the flow analysis rule." + @Schema(description = "The comments of the flow analysis rule." ) public String getComments() { return comments; @@ -81,8 +79,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return type of flow analysis rule */ - @ApiModelProperty( - value = "The fully qualified type of the flow analysis rule." + @Schema(description = "The fully qualified type of the flow analysis rule." ) public String getType() { return type; @@ -97,8 +94,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this flow analysis rule type." + @Schema(description = "The details of the artifact that bundled this flow analysis rule type." ) public BundleDTO getBundle() { return bundle; @@ -110,8 +106,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return whether this flow analysis rule persists state */ - @ApiModelProperty( - value = "Whether the flow analysis rule persists state." + @Schema(description = "Whether the flow analysis rule persists state." ) public Boolean getPersistsState() { return persistsState; @@ -124,8 +119,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return whether this flow analysis rule requires elevated privileges */ - @ApiModelProperty( - value = "Whether the flow analysis rule requires elevated privileges." + @Schema(description = "Whether the flow analysis rule requires elevated privileges." ) public Boolean getRestricted() { return restricted; @@ -138,8 +132,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return Whether the flow analysis rule has been deprecated. */ - @ApiModelProperty( - value = "Whether the flow analysis rule has been deprecated." + @Schema(description = "Whether the flow analysis rule has been deprecated." ) public Boolean getDeprecated() { return deprecated; @@ -152,8 +145,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return whether the underlying extension is missing */ - @ApiModelProperty( - value = "Whether the underlying extension is missing." + @Schema(description = "Whether the underlying extension is missing." ) public Boolean getExtensionMissing() { return isExtensionMissing; @@ -166,8 +158,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return whether this flow analysis rule has multiple versions available */ - @ApiModelProperty( - value = "Whether the flow analysis rule has multiple versions available." + @Schema(description = "Whether the flow analysis rule has multiple versions available." ) public Boolean getMultipleVersionsAvailable() { return multipleVersionsAvailable; @@ -180,8 +171,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return whether this flow analysis rule supports sensitive dynamic properties */ - @ApiModelProperty( - value = "Whether the flow analysis rule supports sensitive dynamic properties." + @Schema(description = "Whether the flow analysis rule supports sensitive dynamic properties." ) public Boolean getSupportsSensitiveDynamicProperties() { return supportsSensitiveDynamicProperties; @@ -194,8 +184,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return current scheduling state of the flow analysis rule */ - @ApiModelProperty( - value = "The state of the flow analysis rule.", + @Schema(description = "The state of the flow analysis rule.", allowableValues = "ENABLED, DISABLED" ) public String getState() { @@ -209,8 +198,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return Enforcement Policy */ - @ApiModelProperty( - value = "Enforcement Policy." + @Schema(description = "Enforcement Policy." ) public String getEnforcementPolicy() { return enforcementPolicy; @@ -223,8 +211,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return flow analysis rule's properties */ - @ApiModelProperty( - value = "The properties of the flow analysis rule." + @Schema(description = "The properties of the flow analysis rule." ) public Map getProperties() { return properties; @@ -237,8 +224,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return Map of property name to descriptor */ - @ApiModelProperty( - value = "The descriptors for the flow analysis rules properties." + @Schema(description = "The descriptors for the flow analysis rules properties." ) public Map getDescriptors() { return descriptors; @@ -251,8 +237,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { /** * @return Set of sensitive dynamic property names */ - @ApiModelProperty( - value = "Set of sensitive dynamic property names" + @Schema(description = "Set of sensitive dynamic property names" ) public Set getSensitiveDynamicPropertyNames() { return sensitiveDynamicPropertyNames; @@ -267,8 +252,7 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { * * @return The validation errors */ - @ApiModelProperty( - value = "Gets the validation errors from the flow analysis rule. These validation errors represent the problems with the flow analysis rule that must be resolved before " + @Schema(description = "Gets the validation errors from the flow analysis rule. These validation errors represent the problems with the flow analysis rule that must be resolved before " + "it can be scheduled to run." ) public Collection getValidationErrors() { @@ -279,8 +263,8 @@ public class FlowAnalysisRuleDTO extends ComponentDTO { this.validationErrors = validationErrors; } - @ApiModelProperty(value = "Indicates whether the Flow Analysis Rule is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Flow Analysis Rule is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "Indicates whether the Flow Analysis Rule is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Flow Analysis Rule is valid)", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowConfigurationDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowConfigurationDTO.java index 4ec7212476..0dd5ef28bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowConfigurationDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowConfigurationDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -43,9 +43,8 @@ public class FlowConfigurationDTO { /** * @return interval in seconds between the automatic NiFi refresh requests. This value is read only */ - @ApiModelProperty( - value = "The interval in seconds between the automatic NiFi refresh requests.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The interval in seconds between the automatic NiFi refresh requests.", + accessMode = Schema.AccessMode.READ_ONLY ) public Long getAutoRefreshIntervalSeconds() { return autoRefreshIntervalSeconds; @@ -59,9 +58,8 @@ public class FlowConfigurationDTO { * @return whether this NiFi supports a managed authorizer. Managed authorizers can visualize users, groups, * and policies in the UI. This value is read only */ - @ApiModelProperty( - value = "Whether this NiFi supports a managed authorizer. Managed authorizers can visualize users, groups, and policies in the UI.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Whether this NiFi supports a managed authorizer. Managed authorizers can visualize users, groups, and policies in the UI.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsManagedAuthorizer() { return supportsManagedAuthorizer; @@ -74,9 +72,8 @@ public class FlowConfigurationDTO { /** * @return whether this NiFi supports configurable users and groups. This value is read only */ - @ApiModelProperty( - value = "Whether this NiFi supports configurable users and groups.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Whether this NiFi supports configurable users and groups.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsConfigurableUsersAndGroups() { return supportsConfigurableUsersAndGroups; @@ -89,9 +86,8 @@ public class FlowConfigurationDTO { /** * @return whether this NiFi supports a configurable authorizer. This value is read only */ - @ApiModelProperty( - value = "Whether this NiFi supports a configurable authorizer.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Whether this NiFi supports a configurable authorizer.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsConfigurableAuthorizer() { return supportsConfigurableAuthorizer; @@ -105,9 +101,8 @@ public class FlowConfigurationDTO { * @return current time on the server */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The current time on the system.", - dataType = "string" + @Schema(description = "The current time on the system.", + type = "string" ) public Date getCurrentTime() { return currentTime; @@ -120,8 +115,7 @@ public class FlowConfigurationDTO { /** * @return time offset of the server */ - @ApiModelProperty( - value = "The time offset of the system." + @Schema(description = "The time offset of the system." ) public Integer getTimeOffset() { return timeOffset; @@ -134,8 +128,7 @@ public class FlowConfigurationDTO { /** * @return the default back pressure object threshold */ - @ApiModelProperty( - value = "The default back pressure object threshold." + @Schema(description = "The default back pressure object threshold." ) public Long getDefaultBackPressureObjectThreshold() { return defaultBackPressureObjectThreshold; @@ -148,8 +141,7 @@ public class FlowConfigurationDTO { /** * @return the default back pressure data size threshold */ - @ApiModelProperty( - value = "The default back pressure data size threshold." + @Schema(description = "The default back pressure data size threshold." ) public String getDefaultBackPressureDataSizeThreshold() { return defaultBackPressureDataSizeThreshold; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileDTO.java index b04adf1d97..030161c621 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Map; @@ -36,8 +36,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the FlowFile attributes */ - @ApiModelProperty( - value = "The FlowFile attributes." + @Schema(description = "The FlowFile attributes." ) public Map getAttributes() { return attributes; @@ -50,8 +49,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the Section in which the Content Claim lives, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The section in which the content claim lives." + @Schema(description = "The section in which the content claim lives." ) public String getContentClaimSection() { return contentClaimSection; @@ -64,8 +62,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the Container in which the Content Claim lives, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The container in which the content claim lives." + @Schema(description = "The container in which the content claim lives." ) public String getContentClaimContainer() { return contentClaimContainer; @@ -78,8 +75,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the Identifier of the Content Claim, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The identifier of the content claim." + @Schema(description = "The identifier of the content claim." ) public String getContentClaimIdentifier() { return contentClaimIdentifier; @@ -92,8 +88,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the offset into the the Content Claim where the FlowFile's content begins, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The offset into the content claim where the flowfile's content begins." + @Schema(description = "The offset into the content claim where the flowfile's content begins." ) public Long getContentClaimOffset() { return contentClaimOffset; @@ -106,8 +101,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the formatted file size of the content claim */ - @ApiModelProperty( - value = "The file size of the content claim formatted." + @Schema(description = "The file size of the content claim formatted." ) public String getContentClaimFileSize() { return contentClaimFileSize; @@ -120,8 +114,7 @@ public class FlowFileDTO extends FlowFileSummaryDTO { /** * @return the number of bytes of the content claim */ - @ApiModelProperty( - value = "The file size of the content claim in bytes." + @Schema(description = "The file size of the content claim in bytes." ) public Long getContentClaimFileSizeBytes() { return contentClaimFileSizeBytes; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java index 359e43b960..478949121e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -40,8 +40,7 @@ public class FlowFileSummaryDTO { /** * @return the FlowFile uri */ - @ApiModelProperty( - value = "The URI that can be used to access this FlowFile." + @Schema(description = "The URI that can be used to access this FlowFile." ) public String getUri() { return uri; @@ -54,8 +53,7 @@ public class FlowFileSummaryDTO { /** * @return the FlowFile uuid */ - @ApiModelProperty( - value = "The FlowFile UUID." + @Schema(description = "The FlowFile UUID." ) public String getUuid() { return uuid; @@ -68,8 +66,7 @@ public class FlowFileSummaryDTO { /** * @return the FlowFile filename */ - @ApiModelProperty( - value = "The FlowFile filename." + @Schema(description = "The FlowFile filename." ) public String getFilename() { return filename; @@ -82,8 +79,7 @@ public class FlowFileSummaryDTO { /** * @return the FlowFile's position in the queue. */ - @ApiModelProperty( - value = "The FlowFile's position in the queue." + @Schema(description = "The FlowFile's position in the queue." ) public Integer getPosition() { return position; @@ -96,8 +92,7 @@ public class FlowFileSummaryDTO { /** * @return the FlowFile file size */ - @ApiModelProperty( - value = "The FlowFile file size." + @Schema(description = "The FlowFile file size." ) public Long getSize() { return size; @@ -110,8 +105,7 @@ public class FlowFileSummaryDTO { /** * @return how long this FlowFile has been enqueued */ - @ApiModelProperty( - value = "How long this FlowFile has been enqueued." + @Schema(description = "How long this FlowFile has been enqueued." ) public Long getQueuedDuration() { return queuedDuration; @@ -124,8 +118,7 @@ public class FlowFileSummaryDTO { /** * @return duration since the FlowFile's greatest ancestor entered the flow */ - @ApiModelProperty( - value = "Duration since the FlowFile's greatest ancestor entered the flow." + @Schema(description = "Duration since the FlowFile's greatest ancestor entered the flow." ) public Long getLineageDuration() { return lineageDuration; @@ -138,8 +131,7 @@ public class FlowFileSummaryDTO { /** * @return when the FlowFile will no longer be penalized */ - @ApiModelProperty( - value = "How long in milliseconds until the FlowFile penalty expires." + @Schema(description = "How long in milliseconds until the FlowFile penalty expires." ) public Long getPenaltyExpiresIn() { return penaltyExpiresIn; @@ -152,8 +144,7 @@ public class FlowFileSummaryDTO { /** * @return if the FlowFile is penalized */ - @ApiModelProperty( - value = "If the FlowFile is penalized." + @Schema(description = "If the FlowFile is penalized." ) public Boolean getPenalized() { return isPenalized; @@ -166,8 +157,7 @@ public class FlowFileSummaryDTO { /** * @return The id of the node where this FlowFile resides. */ - @ApiModelProperty( - value = "The id of the node where this FlowFile resides." + @Schema(description = "The id of the node where this FlowFile resides." ) public String getClusterNodeId() { return clusterNodeId; @@ -180,8 +170,7 @@ public class FlowFileSummaryDTO { /** * @return label for the node where this FlowFile resides */ - @ApiModelProperty( - value = "The label for the node where this FlowFile resides." + @Schema(description = "The label for the node where this FlowFile resides." ) public String getClusterNodeAddress() { return clusterNodeAddress; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryBucketDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryBucketDTO.java index bc9685896a..1a5553f5c3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryBucketDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryBucketDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,7 +31,7 @@ public class FlowRegistryBucketDTO { private String description; private Long created; - @ApiModelProperty("The bucket identifier") + @Schema(description = "The bucket identifier") public String getId() { return id; } @@ -40,7 +40,7 @@ public class FlowRegistryBucketDTO { this.id = id; } - @ApiModelProperty("The bucket name") + @Schema(description = "The bucket name") public String getName() { return name; } @@ -49,7 +49,7 @@ public class FlowRegistryBucketDTO { this.name = name; } - @ApiModelProperty("The bucket description") + @Schema(description = "The bucket description") public String getDescription() { return description; } @@ -58,7 +58,7 @@ public class FlowRegistryBucketDTO { this.description = description; } - @ApiModelProperty("The created timestamp of this bucket") + @Schema(description = "The created timestamp of this bucket") public Long getCreated() { return created; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryClientDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryClientDTO.java index a2867ff6ce..f26b3821b4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryClientDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowRegistryClientDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -53,7 +53,7 @@ public class FlowRegistryClientDTO { private String validationStatus; private String annotationData; - @ApiModelProperty("The registry identifier") + @Schema(description = "The registry identifier") public String getId() { return id; } @@ -62,7 +62,7 @@ public class FlowRegistryClientDTO { this.id = id; } - @ApiModelProperty("The registry name") + @Schema(description = "The registry name") public String getName() { return name; } @@ -71,7 +71,7 @@ public class FlowRegistryClientDTO { this.name = name; } - @ApiModelProperty("The registry description") + @Schema(description = "The registry description") public String getDescription() { return description; } @@ -80,7 +80,7 @@ public class FlowRegistryClientDTO { this.description = description; } - @ApiModelProperty(value = "The type of the registry client.") + @Schema(description = "The type of the registry client.") public String getType() { return type; } @@ -89,7 +89,7 @@ public class FlowRegistryClientDTO { this.type = type; } - @ApiModelProperty(value = "The details of the artifact that bundled this registry client type.") + @Schema(description = "The details of the artifact that bundled this registry client type.") public BundleDTO getBundle() { return bundle; } @@ -98,7 +98,7 @@ public class FlowRegistryClientDTO { this.bundle = bundle; } - @ApiModelProperty(value = "The properties of the registry client.") + @Schema(description = "The properties of the registry client.") public Map getProperties() { return properties; } @@ -107,7 +107,7 @@ public class FlowRegistryClientDTO { this.properties = properties; } - @ApiModelProperty(value = "The descriptors for the registry client properties.") + @Schema(description = "The descriptors for the registry client properties.") public Map getDescriptors() { return descriptors; } @@ -116,7 +116,7 @@ public class FlowRegistryClientDTO { this.descriptors = descriptors; } - @ApiModelProperty(value = "Set of sensitive dynamic property names") + @Schema(description = "Set of sensitive dynamic property names") public Set getSensitiveDynamicPropertyNames() { return sensitiveDynamicPropertyNames; } @@ -125,8 +125,7 @@ public class FlowRegistryClientDTO { this.sensitiveDynamicPropertyNames = sensitiveDynamicPropertyNames; } - @ApiModelProperty( - value = "Whether the registry client supports sensitive dynamic properties." + @Schema(description = "Whether the registry client supports sensitive dynamic properties." ) public Boolean getSupportsSensitiveDynamicProperties() { return supportsSensitiveDynamicProperties; @@ -136,8 +135,7 @@ public class FlowRegistryClientDTO { this.supportsSensitiveDynamicProperties = supportsSensitiveDynamicProperties; } - @ApiModelProperty( - value = "Whether the registry client requires elevated privileges." + @Schema(description = "Whether the registry client requires elevated privileges." ) public Boolean getRestricted() { return restricted; @@ -147,8 +145,7 @@ public class FlowRegistryClientDTO { this.restricted = restricted; } - @ApiModelProperty( - value = "Whether the registry client has been deprecated." + @Schema(description = "Whether the registry client has been deprecated." ) public Boolean getDeprecated() { return deprecated; @@ -161,8 +158,7 @@ public class FlowRegistryClientDTO { /** * @return whether the underlying extension is missing */ - @ApiModelProperty( - value = "Whether the underlying extension is missing." + @Schema(description = "Whether the underlying extension is missing." ) public Boolean getExtensionMissing() { return isExtensionMissing; @@ -175,8 +171,7 @@ public class FlowRegistryClientDTO { /** * @return whether this flow registry client has multiple versions available */ - @ApiModelProperty( - value = "Whether the flow registry client has multiple versions available." + @Schema(description = "Whether the flow registry client has multiple versions available." ) public Boolean getMultipleVersionsAvailable() { return setMultipleVersionsAvailable; @@ -186,8 +181,7 @@ public class FlowRegistryClientDTO { this.setMultipleVersionsAvailable = setMultipleVersionsAvailable; } - @ApiModelProperty( - value = "The annotation data for the registry client. This is how the custom UI relays configuration to the registry client." + @Schema(description = "The annotation data for the registry client. This is how the custom UI relays configuration to the registry client." ) public String getAnnotationData() { return annotationData; @@ -197,8 +191,7 @@ public class FlowRegistryClientDTO { this.annotationData = annotationData; } - @ApiModelProperty( - value = "Gets the validation errors from the registry client. These validation errors represent the problems with the registry client that must be resolved before " + @Schema(description = "Gets the validation errors from the registry client. These validation errors represent the problems with the registry client that must be resolved before " + "it can be used for interacting with the flow registry." ) public Collection getValidationErrors() { @@ -209,8 +202,8 @@ public class FlowRegistryClientDTO { this.validationErrors = validationErrors; } - @ApiModelProperty(value = "Indicates whether the Registry Client is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Registry Client is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "Indicates whether the Registry Client is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Registry Client is valid)", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java index 931e27cfcd..21b03bd4b3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.nio.charset.StandardCharsets; @@ -60,8 +60,7 @@ public class FlowSnippetDTO { /** * @return connections in this flow snippet */ - @ApiModelProperty( - value = "The connections in this flow snippet." + @Schema(description = "The connections in this flow snippet." ) public Set getConnections() { return connections; @@ -75,8 +74,7 @@ public class FlowSnippetDTO { /** * @return input ports in this flow snippet */ - @ApiModelProperty( - value = "The input ports in this flow snippet." + @Schema(description = "The input ports in this flow snippet." ) public Set getInputPorts() { return inputPorts; @@ -90,8 +88,7 @@ public class FlowSnippetDTO { /** * @return labels in this flow snippet */ - @ApiModelProperty( - value = "The labels in this flow snippet." + @Schema(description = "The labels in this flow snippet." ) public Set getLabels() { return labels; @@ -105,8 +102,7 @@ public class FlowSnippetDTO { /** * @return funnels in this flow snippet */ - @ApiModelProperty( - value = "The funnels in this flow snippet." + @Schema(description = "The funnels in this flow snippet." ) public Set getFunnels() { return funnels; @@ -120,8 +116,7 @@ public class FlowSnippetDTO { /** * @return output ports in this flow snippet */ - @ApiModelProperty( - value = "The output ports in this flow snippet." + @Schema(description = "The output ports in this flow snippet." ) public Set getOutputPorts() { return outputPorts; @@ -135,8 +130,7 @@ public class FlowSnippetDTO { /** * @return process groups in this flow snippet */ - @ApiModelProperty( - value = "The process groups in this flow snippet." + @Schema(description = "The process groups in this flow snippet." ) public Set getProcessGroups() { return processGroups; @@ -150,8 +144,7 @@ public class FlowSnippetDTO { /** * @return processors in this flow group */ - @ApiModelProperty( - value = "The processors in this flow snippet." + @Schema(description = "The processors in this flow snippet." ) public Set getProcessors() { return processors; @@ -165,8 +158,7 @@ public class FlowSnippetDTO { /** * @return remote process groups in this flow snippet */ - @ApiModelProperty( - value = "The remote process groups in this flow snippet." + @Schema(description = "The remote process groups in this flow snippet." ) public Set getRemoteProcessGroups() { return remoteProcessGroups; @@ -180,8 +172,7 @@ public class FlowSnippetDTO { /** * @return the Controller Services in this flow snippet */ - @ApiModelProperty( - value = "The controller services in this flow snippet." + @Schema(description = "The controller services in this flow snippet." ) public Set getControllerServices() { return controllerServices; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowUpdateRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowUpdateRequestDTO.java index 19366619f8..a5490bc919 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowUpdateRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowUpdateRequestDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -33,7 +33,7 @@ public abstract class FlowUpdateRequestDTO { protected int percentCompleted; protected String state; - @ApiModelProperty("The unique ID of the Process Group being updated") + @Schema(description = "The unique ID of the Process Group being updated") public String getProcessGroupId() { return processGroupId; } @@ -42,7 +42,7 @@ public abstract class FlowUpdateRequestDTO { this.processGroupId = processGroupId; } - @ApiModelProperty(value = "The unique ID of this request.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The unique ID of this request.", accessMode = Schema.AccessMode.READ_ONLY) public String getRequestId() { return requestId; } @@ -51,7 +51,7 @@ public abstract class FlowUpdateRequestDTO { this.requestId = requestId; } - @ApiModelProperty(value = "The URI for future requests to this drop request.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The URI for future requests to this drop request.", accessMode = Schema.AccessMode.READ_ONLY) public String getUri() { return uri; } @@ -61,7 +61,7 @@ public abstract class FlowUpdateRequestDTO { } @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty(value = "The last time this request was updated.", dataType = "string", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The last time this request was updated.", type = "string", accessMode = Schema.AccessMode.READ_ONLY) public Date getLastUpdated() { return lastUpdated; } @@ -70,7 +70,7 @@ public abstract class FlowUpdateRequestDTO { this.lastUpdated = lastUpdated; } - @ApiModelProperty(value = "Whether or not this request has completed", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Whether or not this request has completed", accessMode = Schema.AccessMode.READ_ONLY) public boolean isComplete() { return complete; } @@ -79,7 +79,7 @@ public abstract class FlowUpdateRequestDTO { this.complete = complete; } - @ApiModelProperty(value = "An explanation of why this request failed, or null if this request has not failed", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "An explanation of why this request failed, or null if this request has not failed", accessMode = Schema.AccessMode.READ_ONLY) public String getFailureReason() { return failureReason; } @@ -88,7 +88,7 @@ public abstract class FlowUpdateRequestDTO { this.failureReason = reason; } - @ApiModelProperty(value = "The state of the request", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The state of the request", accessMode = Schema.AccessMode.READ_ONLY) public String getState() { return state; } @@ -97,7 +97,7 @@ public abstract class FlowUpdateRequestDTO { this.state = state; } - @ApiModelProperty(value = "The percentage complete for the request, between 0 and 100", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The percentage complete for the request, between 0 and 100", accessMode = Schema.AccessMode.READ_ONLY) public int getPercentCompleted() { return percentCompleted; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/JmxMetricsResultDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/JmxMetricsResultDTO.java index 7d9f74c5a9..9df53960ce 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/JmxMetricsResultDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/JmxMetricsResultDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,17 +32,17 @@ public class JmxMetricsResultDTO { this.attributeValue = attributeValue; } - @ApiModelProperty("The bean name of the metrics bean.") + @Schema(description = "The bean name of the metrics bean.") public String getBeanName() { return beanName; } - @ApiModelProperty("The attribute name of the metrics bean's attribute.") + @Schema(description = "The attribute name of the metrics bean's attribute.") public String getAttributeName() { return attributeName; } - @ApiModelProperty("The attribute value of the the metrics bean's attribute") + @Schema(description = "The attribute value of the the metrics bean's attribute") public Object getAttributeValue() { return attributeValue; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java index 3f16630139..319524751e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Map; @@ -43,8 +43,7 @@ public class LabelDTO extends ComponentDTO { /** * @return z index for this label */ - @ApiModelProperty( - value = "The z index of the label." + @Schema(description = "The z index of the label." ) public Long getzIndex() { return zIndex; @@ -59,8 +58,7 @@ public class LabelDTO extends ComponentDTO { * * @return The label text */ - @ApiModelProperty( - value = "The text that appears in the label." + @Schema(description = "The text that appears in the label." ) public String getLabel() { return label; @@ -73,8 +71,7 @@ public class LabelDTO extends ComponentDTO { /** * @return style for this label */ - @ApiModelProperty( - value = "The styles for this label (font-size : 12px, background-color : #eee, etc)." + @Schema(description = "The styles for this label (font-size : 12px, background-color : #eee, etc)." ) public Map getStyle() { return style; @@ -87,8 +84,7 @@ public class LabelDTO extends ComponentDTO { /** * @return height of the label in pixels when at a 1:1 scale */ - @ApiModelProperty( - value = "The height of the label in pixels when at a 1:1 scale." + @Schema(description = "The height of the label in pixels when at a 1:1 scale." ) public Double getHeight() { return height; @@ -101,8 +97,7 @@ public class LabelDTO extends ComponentDTO { /** * @return width of the label in pixels when at a 1:1 scale */ - @ApiModelProperty( - value = "The width of the label in pixels when at a 1:1 scale." + @Schema(description = "The width of the label in pixels when at a 1:1 scale." ) public Double getWidth() { return width; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java index dd89a0b589..0654a28aa9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import org.apache.nifi.web.api.dto.util.TimestampAdapter; @@ -50,8 +50,7 @@ public class ListingRequestDTO { /** * @return the id for this listing request. */ - @ApiModelProperty( - value = "The id for this listing request." + @Schema(description = "The id for this listing request." ) public String getId() { return id; @@ -64,8 +63,7 @@ public class ListingRequestDTO { /** * @return the URI for this listing request. */ - @ApiModelProperty( - value = "The URI for future requests to this listing request." + @Schema(description = "The URI for future requests to this listing request." ) public String getUri() { return uri; @@ -79,9 +77,8 @@ public class ListingRequestDTO { * @return time the query was submitted */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp when the query was submitted.", - dataType = "string" + @Schema(description = "The timestamp when the query was submitted.", + type = "string" ) public Date getSubmissionTime() { return submissionTime; @@ -95,9 +92,8 @@ public class ListingRequestDTO { * @return the time this request was last updated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The last time this listing request was updated.", - dataType = "string" + @Schema(description = "The last time this listing request was updated.", + type = "string" ) public Date getLastUpdated() { return lastUpdated; @@ -110,8 +106,7 @@ public class ListingRequestDTO { /** * @return percent completed */ - @ApiModelProperty( - value = "The current percent complete." + @Schema(description = "The current percent complete." ) public Integer getPercentCompleted() { return percentCompleted; @@ -124,8 +119,7 @@ public class ListingRequestDTO { /** * @return whether the query has finished */ - @ApiModelProperty( - value = "Whether the query has finished." + @Schema(description = "Whether the query has finished." ) public Boolean getFinished() { return finished; @@ -138,8 +132,7 @@ public class ListingRequestDTO { /** * @return the reason, if any, that this listing request failed */ - @ApiModelProperty( - value = "The reason, if any, that this listing request failed." + @Schema(description = "The reason, if any, that this listing request failed." ) public String getFailureReason() { return failureReason; @@ -152,8 +145,7 @@ public class ListingRequestDTO { /** * @return the current state of the listing request. */ - @ApiModelProperty( - value = "The current state of the listing request." + @Schema(description = "The current state of the listing request." ) public String getState() { return state; @@ -166,8 +158,7 @@ public class ListingRequestDTO { /** * @return the FlowFile summaries. */ - @ApiModelProperty( - value = "The FlowFile summaries. The summaries will be populated once the request has completed." + @Schema(description = "The FlowFile summaries. The summaries will be populated once the request has completed." ) public List getFlowFileSummaries() { return flowFileSummaries; @@ -180,7 +171,7 @@ public class ListingRequestDTO { /** * @return the maximum number of FlowFileSummary objects to return */ - @ApiModelProperty(value = "The maximum number of FlowFileSummary objects to return") + @Schema(description = "The maximum number of FlowFileSummary objects to return") public Integer getMaxResults() { return maxResults; } @@ -192,7 +183,7 @@ public class ListingRequestDTO { /** * @return the size for the queue */ - @ApiModelProperty(value = "The size of the queue") + @Schema(description = "The size of the queue") public QueueSizeDTO getQueueSize() { return queueSize; } @@ -204,7 +195,7 @@ public class ListingRequestDTO { /** * @return whether the source is running */ - @ApiModelProperty(value = "Whether the source of the connection is running") + @Schema(description = "Whether the source of the connection is running") public Boolean getSourceRunning() { return isSourceRunning; } @@ -216,7 +207,7 @@ public class ListingRequestDTO { /** * @return whether the destination is running */ - @ApiModelProperty(value = "Whether the destination of the connection is running") + @Schema(description = "Whether the destination of the connection is running") public Boolean getDestinationRunning() { return isDestinationRunning; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeCountersSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeCountersSnapshotDTO.java index 611803a38f..2596933532 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeCountersSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeCountersSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class NodeCountersSnapshotDTO implements Cloneable { private CountersSnapshotDTO snapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeCountersSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeCountersSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeCountersSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The counters from the node.") + @Schema(description = "The counters from the node.") public CountersSnapshotDTO getSnapshot() { return snapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java index e62b4913f7..f5f3725b7d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -47,10 +47,9 @@ public class NodeDTO { * @return node's last heartbeat timestamp */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "the time of the nodes's last heartbeat.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, - dataType = "string" + @Schema(description = "the time of the nodes's last heartbeat.", + accessMode = Schema.AccessMode.READ_ONLY, + type = "string" ) public Date getHeartbeat() { return heartbeat; @@ -64,10 +63,9 @@ public class NodeDTO { * @return time of the node's last connection request */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The time of the node's last connection request.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, - dataType = "string" + @Schema(description = "The time of the node's last connection request.", + accessMode = Schema.AccessMode.READ_ONLY, + type = "string" ) public Date getConnectionRequested() { return connectionRequested; @@ -82,9 +80,8 @@ public class NodeDTO { * * @return The active thread count */ - @ApiModelProperty( - value = "The active threads for the NiFi on the node.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The active threads for the NiFi on the node.", + accessMode = Schema.AccessMode.READ_ONLY ) public Integer getActiveThreadCount() { return activeThreadCount; @@ -97,9 +94,8 @@ public class NodeDTO { /** * @return queue for the controller */ - @ApiModelProperty( - value = "The queue the NiFi on the node.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The queue the NiFi on the node.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getQueued() { return queued; @@ -112,9 +108,8 @@ public class NodeDTO { /** * @return node's host/IP address */ - @ApiModelProperty( - value = "The node's host/ip address.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The node's host/ip address.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getAddress() { return address; @@ -127,9 +122,8 @@ public class NodeDTO { /** * @return node ID */ - @ApiModelProperty( - value = "The id of the node.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The id of the node.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getNodeId() { return nodeId; @@ -142,9 +136,8 @@ public class NodeDTO { /** * @return port the node is listening for API requests */ - @ApiModelProperty( - value = "The port the node is listening for API requests.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The port the node is listening for API requests.", + accessMode = Schema.AccessMode.READ_ONLY ) public Integer getApiPort() { return apiPort; @@ -157,8 +150,7 @@ public class NodeDTO { /** * @return node's status */ - @ApiModelProperty( - value = "The node's status." + @Schema(description = "The node's status." ) public String getStatus() { return status; @@ -171,9 +163,8 @@ public class NodeDTO { /** * @return node's events */ - @ApiModelProperty( - value = "The node's events.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The node's events.", + accessMode = Schema.AccessMode.READ_ONLY ) public List getEvents() { return events; @@ -186,9 +177,8 @@ public class NodeDTO { /** * @return the roles of the node */ - @ApiModelProperty( - value = "The roles of this node.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The roles of this node.", + accessMode = Schema.AccessMode.READ_ONLY ) public Set getRoles() { return roles; @@ -202,10 +192,9 @@ public class NodeDTO { * @return time at which this Node was last restarted */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The time at which this Node was last refreshed.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, - dataType = "string" + @Schema(description = "The time at which this Node was last refreshed.", + accessMode = Schema.AccessMode.READ_ONLY, + type = "string" ) public Date getNodeStartTime() { return nodeStartTime; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java index 60540cdc1d..5fc493a4f7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -36,8 +36,7 @@ public class NodeEventDTO { /** * @return category of the node event */ - @ApiModelProperty( - value = "The category of the node event." + @Schema(description = "The category of the node event." ) public String getCategory() { return category; @@ -50,8 +49,7 @@ public class NodeEventDTO { /** * @return message of the node event */ - @ApiModelProperty( - value = "The message in the node event." + @Schema(description = "The message in the node event." ) public String getMessage() { return message; @@ -65,9 +63,8 @@ public class NodeEventDTO { * @return timestamp of the node event */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The timestamp of the node event.", - dataType = "string" + @Schema(description = "The timestamp of the node event.", + type = "string" ) public Date getTimestamp() { return timestamp; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsSnapshotDTO.java index 0d0d209387..a6b3b8803d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class NodeSystemDiagnosticsSnapshotDTO implements Cloneable { private SystemDiagnosticsSnapshotDTO snapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeSystemDiagnosticsSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeSystemDiagnosticsSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeSystemDiagnosticsSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The System Diagnostics snapshot from the node.") + @Schema(description = "The System Diagnostics snapshot from the node.") public SystemDiagnosticsSnapshotDTO getSnapshot() { return snapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextDTO.java index c0e846551b..8d98ddcdf7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity; import org.apache.nifi.web.api.entity.ParameterEntity; import org.apache.nifi.web.api.entity.ParameterProviderConfigurationEntity; @@ -40,7 +40,7 @@ public class ParameterContextDTO { this.identifier = id; } - @ApiModelProperty(value = "The ID the Parameter Context.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The ID the Parameter Context.", accessMode = Schema.AccessMode.READ_ONLY) public String getId() { return identifier; } @@ -49,7 +49,7 @@ public class ParameterContextDTO { this.name = name; } - @ApiModelProperty("The Name of the Parameter Context.") + @Schema(description = "The Name of the Parameter Context.") public String getName() { return name; } @@ -58,7 +58,7 @@ public class ParameterContextDTO { this.description = description; } - @ApiModelProperty("The Description of the Parameter Context.") + @Schema(description = "The Description of the Parameter Context.") public String getDescription() { return description; } @@ -67,7 +67,7 @@ public class ParameterContextDTO { this.parameters = parameters; } - @ApiModelProperty("The Parameters for the Parameter Context") + @Schema(description = "The Parameters for the Parameter Context") public Set getParameters() { return parameters; } @@ -76,7 +76,7 @@ public class ParameterContextDTO { this.boundProcessGroups = boundProcessGroups; } - @ApiModelProperty("A list of references of Parameter Contexts from which this one inherits parameters") + @Schema(description = "A list of references of Parameter Contexts from which this one inherits parameters") public List getInheritedParameterContexts() { return inheritedParameterContexts; } @@ -85,12 +85,12 @@ public class ParameterContextDTO { this.inheritedParameterContexts = inheritedParameterContexts; } - @ApiModelProperty(value = "The Process Groups that are bound to this Parameter Context", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Process Groups that are bound to this Parameter Context", accessMode = Schema.AccessMode.READ_ONLY) public Set getBoundProcessGroups() { return boundProcessGroups; } - @ApiModelProperty(value = "Optional configuration for a Parameter Provider") + @Schema(description = "Optional configuration for a Parameter Provider") public ParameterProviderConfigurationEntity getParameterProviderConfiguration() { return parameterProviderConfiguration; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextReferenceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextReferenceDTO.java index 37ab227418..add9695493 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextReferenceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextReferenceDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,12 +29,12 @@ public class ParameterContextReferenceDTO { this.id = id; } - @ApiModelProperty("The ID of the Parameter Context") + @Schema(description = "The ID of the Parameter Context") public String getId() { return id; } - @ApiModelProperty("The name of the Parameter Context") + @Schema(description = "The name of the Parameter Context") public String getName() { return name; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextUpdateRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextUpdateRequestDTO.java index 5038debf5d..7688298b15 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextUpdateRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextUpdateRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AffectedComponentEntity; import jakarta.xml.bind.annotation.XmlType; @@ -27,8 +27,8 @@ public class ParameterContextUpdateRequestDTO extends AsynchronousRequestDTO referencingComponents; - @ApiModelProperty(value = "The Parameter Context that is being operated on. This may not be populated until the request has successfully completed.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Parameter Context that is being operated on. This may not be populated until the request has successfully completed.", + accessMode = Schema.AccessMode.READ_ONLY) public ParameterContextDTO getParameterContext() { return parameterContext; } @@ -37,7 +37,7 @@ public class ParameterContextUpdateRequestDTO extends AsynchronousRequestDTO getReferencingComponents() { return referencingComponents; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextValidationRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextValidationRequestDTO.java index ac48b9e1d9..a1112f847e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextValidationRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterContextValidationRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ComponentValidationResultsEntity; import jakarta.xml.bind.annotation.XmlType; @@ -26,8 +26,8 @@ public class ParameterContextValidationRequestDTO extends AsynchronousRequestDTO private ParameterContextDTO parameterContext; private ComponentValidationResultsEntity componentValidationResults; - @ApiModelProperty(value = "The Validation Results that were calculated for each component. This value may not be set until the request completes.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Validation Results that were calculated for each component. This value may not be set until the request completes.", + accessMode = Schema.AccessMode.READ_ONLY) public ComponentValidationResultsEntity getComponentValidationResults() { return componentValidationResults; } @@ -36,7 +36,7 @@ public class ParameterContextValidationRequestDTO extends AsynchronousRequestDTO this.componentValidationResults = componentValidationResults; } - @ApiModelProperty("The Parameter Context that is being operated on.") + @Schema(description = "The Parameter Context that is being operated on.") public ParameterContextDTO getParameterContext() { return parameterContext; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterDTO.java index 96277e5007..c50857da9a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AffectedComponentEntity; import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity; @@ -35,7 +35,7 @@ public class ParameterDTO { private ParameterContextReferenceEntity parameterContext; private Boolean inherited; - @ApiModelProperty("The name of the Parameter") + @Schema(description = "The name of the Parameter") public String getName() { return name; } @@ -44,7 +44,7 @@ public class ParameterDTO { this.name = name; } - @ApiModelProperty(value = "Whether or not the Parameter is inherited from another context", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Whether or not the Parameter is inherited from another context", accessMode = Schema.AccessMode.READ_ONLY) public Boolean getInherited() { return inherited; } @@ -53,7 +53,7 @@ public class ParameterDTO { this.inherited = inherited; } - @ApiModelProperty("The description of the Parameter") + @Schema(description = "The description of the Parameter") public String getDescription() { return description; } @@ -62,7 +62,7 @@ public class ParameterDTO { this.description = description; } - @ApiModelProperty("Whether or not the Parameter is sensitive") + @Schema(description = "Whether or not the Parameter is sensitive") public Boolean getSensitive() { return sensitive; } @@ -71,7 +71,7 @@ public class ParameterDTO { this.sensitive = sensitive; } - @ApiModelProperty("Whether or not the Parameter is provided by a ParameterProvider") + @Schema(description = "Whether or not the Parameter is provided by a ParameterProvider") public Boolean getProvided() { return provided; } @@ -80,7 +80,7 @@ public class ParameterDTO { this.provided = provided; } - @ApiModelProperty("The value of the Parameter") + @Schema(description = "The value of the Parameter") public String getValue() { return value; } @@ -89,8 +89,13 @@ public class ParameterDTO { this.value = value; } - @ApiModelProperty("Whether or not the value of the Parameter was removed. When a request is made to change a parameter, the value may be null. The absence of the value may be used either to " + - "indicate that the value is not to be changed, or that the value is to be set to null (i.e., removed). This denotes which of the two scenarios is being encountered.") + @Schema(description = """ + Whether or not the value of the Parameter was removed. + When a request is made to change a parameter, the value may be null. + The absence of the value may be used either to indicate that the value is not to be changed, or that the value is to be set to null (i.e., removed). + This denotes which of the two scenarios is being encountered. + """ + ) public Boolean getValueRemoved() { return valueRemoved; } @@ -99,7 +104,7 @@ public class ParameterDTO { this.valueRemoved = valueRemoved; } - @ApiModelProperty("The set of all components in the flow that are referencing this Parameter") + @Schema(description = "The set of all components in the flow that are referencing this Parameter") public Set getReferencingComponents() { return referencingComponents; } @@ -108,7 +113,7 @@ public class ParameterDTO { this.parameterContext = parameterContext; } - @ApiModelProperty("A reference to the Parameter Context that contains this one") + @Schema(description = "A reference to the Parameter Context that contains this one") public ParameterContextReferenceEntity getParameterContext() { return parameterContext; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderApplyParametersRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderApplyParametersRequestDTO.java index 1eca8dbe59..058422cda1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderApplyParametersRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderApplyParametersRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AffectedComponentEntity; import org.apache.nifi.web.api.entity.ParameterContextUpdateEntity; @@ -30,8 +30,8 @@ public class ParameterProviderApplyParametersRequestDTO extends AsynchronousRequ private List parameterContextUpdates; private Set referencingComponents; - @ApiModelProperty(value = "The Parameter Contexts updated by this Parameter Provider. This may not be populated until the request has successfully completed.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Parameter Contexts updated by this Parameter Provider. This may not be populated until the request has successfully completed.", + accessMode = Schema.AccessMode.READ_ONLY) public List getParameterContextUpdates() { return parameterContextUpdates; } @@ -40,8 +40,8 @@ public class ParameterProviderApplyParametersRequestDTO extends AsynchronousRequ this.parameterContextUpdates = parameterContextUpdates; } - @ApiModelProperty(value = "The Parameter Provider that is being operated on. This may not be populated until the request has successfully completed.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Parameter Provider that is being operated on. This may not be populated until the request has successfully completed.", + accessMode = Schema.AccessMode.READ_ONLY) public ParameterProviderDTO getParameterProvider() { return parameterProvider; } @@ -50,7 +50,7 @@ public class ParameterProviderApplyParametersRequestDTO extends AsynchronousRequ this.parameterProvider = parameterProvider; } - @ApiModelProperty(value = "The components that are referenced by the update.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The components that are referenced by the update.", accessMode = Schema.AccessMode.READ_ONLY) public Set getReferencingComponents() { return referencingComponents; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderConfigurationDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderConfigurationDTO.java index d0b32737d6..9e3506c5cf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderConfigurationDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderConfigurationDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -27,7 +27,7 @@ public class ParameterProviderConfigurationDTO { private String parameterGroupName; private Boolean isSynchronized; - @ApiModelProperty("The ID of the Parameter Provider") + @Schema(description = "The ID of the Parameter Provider") public String getParameterProviderId() { return parameterProviderId; } @@ -36,7 +36,7 @@ public class ParameterProviderConfigurationDTO { this.parameterProviderId = parameterProviderId; } - @ApiModelProperty("The name of the Parameter Provider") + @Schema(description = "The name of the Parameter Provider") public String getParameterProviderName() { return parameterProviderName; } @@ -45,7 +45,7 @@ public class ParameterProviderConfigurationDTO { this.parameterProviderName = parameterProviderName; } - @ApiModelProperty("The Parameter Group name that maps to the Parameter Context") + @Schema(description = "The Parameter Group name that maps to the Parameter Context") public String getParameterGroupName() { return parameterGroupName; } @@ -54,7 +54,7 @@ public class ParameterProviderConfigurationDTO { this.parameterGroupName = parameterGroupName; } - @ApiModelProperty("True if the Parameter Context should receive the parameters from the mapped Parameter Group") + @Schema(description = "True if the Parameter Context should receive the parameters from the mapped Parameter Group") public Boolean getSynchronized() { return isSynchronized; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderDTO.java index 73aadb7497..635bf925d4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AffectedComponentEntity; import org.apache.nifi.web.api.entity.ParameterProviderReferencingComponentEntity; import org.apache.nifi.web.api.entity.ParameterGroupConfigurationEntity; @@ -61,8 +61,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return user-defined name of the parameter provider */ - @ApiModelProperty( - value = "The name of the parameter provider." + @Schema(description = "The name of the parameter provider." ) public String getName() { return name; @@ -72,7 +71,7 @@ public class ParameterProviderDTO extends ComponentDTO { this.name = name; } - @ApiModelProperty("The set of all components in the flow that are referencing Parameters provided by this provider") + @Schema(description = "The set of all components in the flow that are referencing Parameters provided by this provider") public Set getAffectedComponents() { return affectedComponents; } @@ -85,7 +84,7 @@ public class ParameterProviderDTO extends ComponentDTO { this.referencingParameterContexts = referencingParameterContexts; } - @ApiModelProperty("The status of all provided parameters for this parameter provider") + @Schema(description = "The status of all provided parameters for this parameter provider") public Set getParameterStatus() { return parameterStatus; } @@ -94,13 +93,12 @@ public class ParameterProviderDTO extends ComponentDTO { this.parameterStatus = parameterStatus; } - @ApiModelProperty(value = "The Parameter Contexts that reference this Parameter Provider", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Parameter Contexts that reference this Parameter Provider", accessMode = Schema.AccessMode.READ_ONLY) public Set getReferencingParameterContexts() { return referencingParameterContexts; } - @ApiModelProperty( - value = "Configuration for any fetched parameter groups." + @Schema(description = "Configuration for any fetched parameter groups." ) public Collection getParameterGroupConfigurations() { return parameterGroupConfigurations; @@ -113,8 +111,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return user-defined comments for the parameter provider */ - @ApiModelProperty( - value = "The comments of the parameter provider." + @Schema(description = "The comments of the parameter provider." ) public String getComments() { return comments; @@ -127,8 +124,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return type of parameter provider */ - @ApiModelProperty( - value = "The fully qualified type of the parameter provider." + @Schema(description = "The fully qualified type of the parameter provider." ) public String getType() { return type; @@ -143,8 +139,7 @@ public class ParameterProviderDTO extends ComponentDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this parameter provider type." + @Schema(description = "The details of the artifact that bundled this parameter provider type." ) public BundleDTO getBundle() { return bundle; @@ -157,8 +152,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return whether this parameter provider persists state */ - @ApiModelProperty( - value = "Whether the parameter provider persists state." + @Schema(description = "Whether the parameter provider persists state." ) public Boolean getPersistsState() { return persistsState; @@ -171,8 +165,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return whether this parameter provider requires elevated privileges */ - @ApiModelProperty( - value = "Whether the parameter provider requires elevated privileges." + @Schema(description = "Whether the parameter provider requires elevated privileges." ) public Boolean getRestricted() { return restricted; @@ -185,8 +178,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return Whether the parameter provider has been deprecated. */ - @ApiModelProperty( - value = "Whether the parameter provider has been deprecated." + @Schema(description = "Whether the parameter provider has been deprecated." ) public Boolean getDeprecated() { return deprecated; @@ -199,8 +191,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return whether the underlying extension is missing */ - @ApiModelProperty( - value = "Whether the underlying extension is missing." + @Schema(description = "Whether the underlying extension is missing." ) public Boolean getExtensionMissing() { return isExtensionMissing; @@ -213,8 +204,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return whether this parameter provider has multiple versions available */ - @ApiModelProperty( - value = "Whether the parameter provider has multiple versions available." + @Schema(description = "Whether the parameter provider has multiple versions available." ) public Boolean getMultipleVersionsAvailable() { return multipleVersionsAvailable; @@ -227,8 +217,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return parameter provider's properties */ - @ApiModelProperty( - value = "The properties of the parameter provider." + @Schema(description = "The properties of the parameter provider." ) public Map getProperties() { return properties; @@ -241,8 +230,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return Map of property name to descriptor */ - @ApiModelProperty( - value = "The descriptors for the parameter providers properties." + @Schema(description = "The descriptors for the parameter providers properties." ) public Map getDescriptors() { return descriptors; @@ -255,8 +243,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return the URL for this parameter provider custom configuration UI if applicable. Null otherwise */ - @ApiModelProperty( - value = "The URL for the custom configuration UI for the parameter provider." + @Schema(description = "The URL for the custom configuration UI for the parameter provider." ) public String getCustomUiUrl() { return customUiUrl; @@ -269,8 +256,7 @@ public class ParameterProviderDTO extends ComponentDTO { /** * @return currently configured annotation data for the parameter provider */ - @ApiModelProperty( - value = "The annotation data for the parameter provider. This is how the custom UI relays configuration to the parameter provider." + @Schema(description = "The annotation data for the parameter provider. This is how the custom UI relays configuration to the parameter provider." ) public String getAnnotationData() { return annotationData; @@ -285,8 +271,7 @@ public class ParameterProviderDTO extends ComponentDTO { * * @return The validation errors */ - @ApiModelProperty( - value = "Gets the validation errors from the parameter provider. These validation errors represent the problems with the parameter provider that must be resolved before " + @Schema(description = "Gets the validation errors from the parameter provider. These validation errors represent the problems with the parameter provider that must be resolved before " + "it can be scheduled to run." ) public Collection getValidationErrors() { @@ -297,8 +282,8 @@ public class ParameterProviderDTO extends ComponentDTO { this.validationErrors = validationErrors; } - @ApiModelProperty(value = "Indicates whether the Parameter Provider is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Parameter Provider is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "Indicates whether the Parameter Provider is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Parameter Provider is valid)", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderReferencingComponentDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderReferencingComponentDTO.java index 6eacc71dd6..025b8be246 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderReferencingComponentDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterProviderReferencingComponentDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,8 +32,7 @@ public class ParameterProviderReferencingComponentDTO { /** * @return id for this component referencing a parameter provider */ - @ApiModelProperty( - value = "The id of the component referencing a parameter provider." + @Schema(description = "The id of the component referencing a parameter provider." ) public String getId() { return id; @@ -46,8 +45,7 @@ public class ParameterProviderReferencingComponentDTO { /** * @return name for this component referencing a parameter provider */ - @ApiModelProperty( - value = "The name of the component referencing a parameter provider." + @Schema(description = "The name of the component referencing a parameter provider." ) public String getName() { return name; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterStatusDTO.java index eb373e9a1b..c88e29209f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ParameterEntity; import jakarta.xml.bind.annotation.XmlType; @@ -26,7 +26,7 @@ public class ParameterStatusDTO { private ParameterEntity parameter; private ParameterStatus status; - @ApiModelProperty("The name of the Parameter") + @Schema(description = "The name of the Parameter") public ParameterEntity getParameter() { return parameter; } @@ -35,7 +35,7 @@ public class ParameterStatusDTO { this.parameter = parameter; } - @ApiModelProperty("Indicates the status of the parameter, compared to the existing parameter context") + @Schema(description = "Indicates the status of the parameter, compared to the existing parameter context") public ParameterStatus getStatus() { return status; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java index 70a1a91293..32f283912c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,9 +32,8 @@ public class PermissionsDTO implements ReadablePermission, WritablePermission { /** * @return Indicates whether the user can read a given resource. */ - @ApiModelProperty( - value = "Indicates whether the user can read a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Indicates whether the user can read a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) @Override public Boolean getCanRead() { @@ -49,9 +48,8 @@ public class PermissionsDTO implements ReadablePermission, WritablePermission { /** * @return Indicates whether the user can write a given resource. */ - @ApiModelProperty( - value = "Indicates whether the user can write a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Indicates whether the user can write a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) @Override public Boolean getCanWrite() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java index c8ac9b328f..8e2364aa95 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -41,8 +41,7 @@ public class PortDTO extends ComponentDTO { /** * @return name of this port */ - @ApiModelProperty( - value = "The name of the port." + @Schema(description = "The name of the port." ) public String getName() { return name; @@ -55,8 +54,7 @@ public class PortDTO extends ComponentDTO { /** * @return The state of this port. Possible states are 'RUNNING', 'STOPPED', and 'DISABLED' */ - @ApiModelProperty( - value = "The state of the port.", + @Schema(description = "The state of the port.", allowableValues = "RUNNING, STOPPED, DISABLED" ) public String getState() { @@ -72,8 +70,7 @@ public class PortDTO extends ComponentDTO { * * @return The type of port */ - @ApiModelProperty( - value = "The type of port.", + @Schema(description = "The type of port.", allowableValues = "INPUT_PORT, OUTPUT_PORT" ) public String getType() { @@ -87,8 +84,7 @@ public class PortDTO extends ComponentDTO { /** * @return number of tasks that should be concurrently scheduled for this port */ - @ApiModelProperty( - value = "The number of tasks that should be concurrently scheduled for the port." + @Schema(description = "The number of tasks that should be concurrently scheduled for the port." ) public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; @@ -101,8 +97,7 @@ public class PortDTO extends ComponentDTO { /** * @return comments for this port */ - @ApiModelProperty( - value = "The comments for the port." + @Schema(description = "The comments for the port." ) public String getComments() { return comments; @@ -115,8 +110,7 @@ public class PortDTO extends ComponentDTO { /** * @return whether this port has incoming or outgoing connections to a remote NiFi. This is only applicable when the port is allowed to be accessed remotely. */ - @ApiModelProperty( - value = "Whether the port has incoming or output connections to a remote NiFi. This is only applicable when the port is allowed to be accessed remotely." + @Schema(description = "Whether the port has incoming or output connections to a remote NiFi. This is only applicable when the port is allowed to be accessed remotely." ) public Boolean isTransmitting() { return transmitting; @@ -131,8 +125,7 @@ public class PortDTO extends ComponentDTO { * * @return The validation errors */ - @ApiModelProperty( - value = "Gets the validation errors from this port. These validation errors represent the problems with the port that must be resolved before it can be started." + @Schema(description = "Gets the validation errors from this port. These validation errors represent the problems with the port that must be resolved before it can be started." ) public Collection getValidationErrors() { return validationErrors; @@ -146,8 +139,7 @@ public class PortDTO extends ComponentDTO { /** * @return whether this port can be accessed remotely via Site-to-Site protocol. */ - @ApiModelProperty( - value = "Whether this port can be accessed remotely via Site-to-Site protocol." + @Schema(description = "Whether this port can be accessed remotely via Site-to-Site protocol." ) public Boolean getAllowRemoteAccess() { return allowRemoteAccess; @@ -157,7 +149,7 @@ public class PortDTO extends ComponentDTO { this.allowRemoteAccess = allowRemoteAccess; } - @ApiModelProperty(value = "Specifies how the Port functions", + @Schema(description = "Specifies how the Port functions", allowableValues = "STANDARD, FAILURE" ) public String getPortFunction() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java index 53bcc4fc14..35844d1e65 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -41,8 +41,7 @@ public class PositionDTO { /** * @return the x coordinate */ - @ApiModelProperty( - value = "The x coordinate." + @Schema(description = "The x coordinate." ) public Double getX() { return x; @@ -55,8 +54,7 @@ public class PositionDTO { /** * @return the y coordinate */ - @ApiModelProperty( - value = "The y coordinate." + @Schema(description = "The y coordinate." ) public Double getY() { return y; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java index d7706177f7..6669bc56d7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -36,8 +36,7 @@ public class PreviousValueDTO { /** * @return previous value */ - @ApiModelProperty( - value = "The previous value." + @Schema(description = "The previous value." ) public String getPreviousValue() { return previousValue; @@ -51,9 +50,8 @@ public class PreviousValueDTO { * @return when it was modified */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The timestamp when the value was modified.", - dataType = "string" + @Schema(description = "The timestamp when the value was modified.", + type = "string" ) public Date getTimestamp() { return timestamp; @@ -66,8 +64,7 @@ public class PreviousValueDTO { /** * @return user who changed the previous value */ - @ApiModelProperty( - value = "The user who changed the previous value." + @Schema(description = "The user who changed the previous value." ) public String getUserIdentity() { return userIdentity; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java index 41ba6cad4d..b2b22d0f70 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.NumberUtil; import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity; @@ -74,8 +74,7 @@ public class ProcessGroupDTO extends ComponentDTO { * * @return The name of this Process Group */ - @ApiModelProperty( - value = "The name of the process group." + @Schema(description = "The name of the process group." ) public String getName() { return name; @@ -88,8 +87,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return comments for this process group */ - @ApiModelProperty( - value = "The comments for the process group." + @Schema(description = "The comments for the process group." ) public String getComments() { return comments; @@ -102,8 +100,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return contents of this process group. */ - @ApiModelProperty( - value = "The contents of this process group." + @Schema(description = "The contents of this process group." ) public FlowSnippetDTO getContents() { return contents; @@ -116,9 +113,8 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of input ports contained in this process group */ - @ApiModelProperty( - value = "The number of input ports in the process group.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The number of input ports in the process group.", + accessMode = Schema.AccessMode.READ_ONLY ) public Integer getInputPortCount() { return NumberUtil.sumNullableIntegers(localInputPortCount, publicInputPortCount); @@ -134,8 +130,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of local input ports contained in this process group */ - @ApiModelProperty( - value = "The number of local input ports in the process group." + @Schema(description = "The number of local input ports in the process group." ) public Integer getLocalInputPortCount() { return localInputPortCount; @@ -148,8 +143,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of public input ports contained in this process group */ - @ApiModelProperty( - value = "The number of public input ports in the process group." + @Schema(description = "The number of public input ports in the process group." ) public Integer getPublicInputPortCount() { return publicInputPortCount; @@ -162,8 +156,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of invalid components in this process group */ - @ApiModelProperty( - value = "The number of invalid components in the process group." + @Schema(description = "The number of invalid components in the process group." ) public Integer getInvalidCount() { return invalidCount; @@ -176,9 +169,8 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of output ports in this process group */ - @ApiModelProperty( - value = "The number of output ports in the process group.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The number of output ports in the process group.", + accessMode = Schema.AccessMode.READ_ONLY ) public Integer getOutputPortCount() { return NumberUtil.sumNullableIntegers(localOutputPortCount, publicOutputPortCount); @@ -191,8 +183,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of local output ports in this process group */ - @ApiModelProperty( - value = "The number of local output ports in the process group." + @Schema(description = "The number of local output ports in the process group." ) public Integer getLocalOutputPortCount() { return localOutputPortCount; @@ -205,8 +196,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of public output ports in this process group */ - @ApiModelProperty( - value = "The number of public output ports in the process group." + @Schema(description = "The number of public output ports in the process group." ) public Integer getPublicOutputPortCount() { return publicOutputPortCount; @@ -219,8 +209,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of running component in this process group */ - @ApiModelProperty( - value = "The number of running components in this process group." + @Schema(description = "The number of running components in this process group." ) public Integer getRunningCount() { return runningCount; @@ -233,8 +222,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of stopped components in this process group */ - @ApiModelProperty( - value = "The number of stopped components in the process group." + @Schema(description = "The number of stopped components in the process group." ) public Integer getStoppedCount() { return stoppedCount; @@ -247,8 +235,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of disabled components in this process group */ - @ApiModelProperty( - value = "The number of disabled components in the process group." + @Schema(description = "The number of disabled components in the process group." ) public Integer getDisabledCount() { return disabledCount; @@ -261,8 +248,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of active remote ports in this process group */ - @ApiModelProperty( - value = "The number of active remote ports in the process group." + @Schema(description = "The number of active remote ports in the process group." ) public Integer getActiveRemotePortCount() { return activeRemotePortCount; @@ -275,8 +261,7 @@ public class ProcessGroupDTO extends ComponentDTO { /** * @return number of inactive remote ports in this process group */ - @ApiModelProperty( - value = "The number of inactive remote ports in the process group." + @Schema(description = "The number of inactive remote ports in the process group." ) public Integer getInactiveRemotePortCount() { return inactiveRemotePortCount; @@ -286,7 +271,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.inactiveRemotePortCount = inactiveRemotePortCount; } - @ApiModelProperty("The number of up to date versioned process groups in the process group.") + @Schema(description = "The number of up to date versioned process groups in the process group.") public Integer getUpToDateCount() { return upToDateCount; } @@ -295,7 +280,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.upToDateCount = upToDateCount; } - @ApiModelProperty("The number of locally modified versioned process groups in the process group.") + @Schema(description = "The number of locally modified versioned process groups in the process group.") public Integer getLocallyModifiedCount() { return locallyModifiedCount; } @@ -304,7 +289,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.locallyModifiedCount = locallyModifiedCount; } - @ApiModelProperty("The number of stale versioned process groups in the process group.") + @Schema(description = "The number of stale versioned process groups in the process group.") public Integer getStaleCount() { return staleCount; } @@ -313,7 +298,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.staleCount = staleCount; } - @ApiModelProperty("The number of locally modified and stale versioned process groups in the process group.") + @Schema(description = "The number of locally modified and stale versioned process groups in the process group.") public Integer getLocallyModifiedAndStaleCount() { return locallyModifiedAndStaleCount; } @@ -322,7 +307,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.locallyModifiedAndStaleCount = locallyModifiedAndStaleCount; } - @ApiModelProperty("The number of versioned process groups in the process group that are unable to sync to a registry.") + @Schema(description = "The number of versioned process groups in the process group that are unable to sync to a registry.") public Integer getSyncFailureCount() { return syncFailureCount; } @@ -331,7 +316,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.syncFailureCount = syncFailureCount; } - @ApiModelProperty("The Version Control information that indicates which Flow Registry, and where in the Flow Registry, " + @Schema(description = "The Version Control information that indicates which Flow Registry, and where in the Flow Registry, " + "this Process Group is tracking to; or null if this Process Group is not under version control") public VersionControlInformationDTO getVersionControlInformation() { return versionControlInformation; @@ -341,7 +326,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.versionControlInformation = versionControlInformation; } - @ApiModelProperty("The Parameter Context that this Process Group is bound to.") + @Schema(description = "The Parameter Context that this Process Group is bound to.") public ParameterContextReferenceEntity getParameterContext() { return parameterContext; } @@ -350,7 +335,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.parameterContext = parameterContext; } - @ApiModelProperty(value = "The FlowFile Concurrency for this Process Group.", allowableValues = "UNBOUNDED, SINGLE_FLOWFILE_PER_NODE, SINGLE_BATCH_PER_NODE") + @Schema(description = "The FlowFile Concurrency for this Process Group.", allowableValues = "UNBOUNDED, SINGLE_FLOWFILE_PER_NODE, SINGLE_BATCH_PER_NODE") public String getFlowfileConcurrency() { return flowfileConcurrency; } @@ -359,7 +344,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.flowfileConcurrency = flowfileConcurrency; } - @ApiModelProperty(value = "The Outbound Policy that is used for determining how FlowFiles should be transferred out of the Process Group.", + @Schema(description = "The Outbound Policy that is used for determining how FlowFiles should be transferred out of the Process Group.", allowableValues = "STREAM_WHEN_AVAILABLE, BATCH_OUTPUT") public String getFlowfileOutboundPolicy() { return flowfileOutboundPolicy; @@ -369,7 +354,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.flowfileOutboundPolicy = flowfileOutboundPolicy; } - @ApiModelProperty(value = "The default FlowFile Expiration for this Process Group.") + @Schema(description = "The default FlowFile Expiration for this Process Group.") public String getDefaultFlowFileExpiration() { return defaultFlowFileExpiration; } @@ -378,7 +363,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.defaultFlowFileExpiration = defaultFlowFileExpiration; } - @ApiModelProperty(value = "Default value used in this Process Group for the maximum number of objects that can be queued before back pressure is applied.") + @Schema(description = "Default value used in this Process Group for the maximum number of objects that can be queued before back pressure is applied.") public Long getDefaultBackPressureObjectThreshold() { return defaultBackPressureObjectThreshold; } @@ -387,7 +372,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.defaultBackPressureObjectThreshold = defaultBackPressureObjectThreshold; } - @ApiModelProperty(value = "Default value used in this Process Group for the maximum data size of objects that can be queued before back pressure is applied.") + @Schema(description = "Default value used in this Process Group for the maximum data size of objects that can be queued before back pressure is applied.") public String getDefaultBackPressureDataSizeThreshold() { return defaultBackPressureDataSizeThreshold; } @@ -396,7 +381,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.defaultBackPressureDataSizeThreshold = defaultBackPressureDataSizeThreshold; } - @ApiModelProperty(value = "The log file suffix for this Process Group for dedicated logging.") + @Schema(description = "The log file suffix for this Process Group for dedicated logging.") public String getLogFileSuffix() { return logFileSuffix; } @@ -405,7 +390,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.logFileSuffix = logFileSuffix; } - @ApiModelProperty(value = "The Execution Engine that should be used to run the flow represented by this Process Group.", + @Schema(description = "The Execution Engine that should be used to run the flow represented by this Process Group.", allowableValues = "STATELESS, STANDARD, INHERITED") public String getExecutionEngine() { return executionEngine; @@ -415,7 +400,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.executionEngine = executionEngine; } - @ApiModelProperty(value = "If the Process Group is configured to run in using the Stateless Engine, represents the current state. Otherwise, will be STOPPED.", + @Schema(description = "If the Process Group is configured to run in using the Stateless Engine, represents the current state. Otherwise, will be STOPPED.", allowableValues = "STOPPED, RUNNING") public String getStatelessGroupScheduledState() { return statelessGroupScheduledState; @@ -425,7 +410,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.statelessGroupScheduledState = state; } - @ApiModelProperty("The maximum number of concurrent tasks to use when running the flow using the Stateless Engine") + @Schema(description = "The maximum number of concurrent tasks to use when running the flow using the Stateless Engine") public Integer getMaxConcurrentTasks() { return maxConcurrentTasks; } @@ -434,7 +419,7 @@ public class ProcessGroupDTO extends ComponentDTO { this.maxConcurrentTasks = maxConcurrentTasks; } - @ApiModelProperty("The maximum amount of time that the flow can be run using the Stateless Engine before the flow times out") + @Schema(description = "The maximum amount of time that the flow can be run using the Stateless Engine before the flow times out") public String getStatelessFlowTimeout() { return statelessFlowTimeout; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupNameDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupNameDTO.java index c12b968105..bc2cd867fd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupNameDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupNameDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class ProcessGroupNameDTO { this.id = id; } - @ApiModelProperty("The ID of the Process Group") + @Schema(description = "The ID of the Process Group") public String getId() { return id; } @@ -38,7 +38,7 @@ public class ProcessGroupNameDTO { this.name = name; } - @ApiModelProperty("The name of the Process Group, or the ID of the Process Group if the user does not have the READ policy for the Process Group") + @Schema(description = "The name of the Process Group, or the ID of the Process Group if the user does not have the READ policy for the Process Group") public String getName() { return name; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java index 8be3c0f824..5f8bd5a7bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Map; @@ -67,8 +67,7 @@ public class ProcessorConfigDTO { * * @return The scheduling period */ - @ApiModelProperty( - value = "The frequency with which to schedule the processor. The format of the value will depend on th value of schedulingStrategy." + @Schema(description = "The frequency with which to schedule the processor. The format of the value will depend on th value of schedulingStrategy." ) public String getSchedulingPeriod() { return schedulingPeriod; @@ -83,8 +82,7 @@ public class ProcessorConfigDTO { * * @return scheduling strategy */ - @ApiModelProperty( - value = "Indicates how the processor should be scheduled to run." + @Schema(description = "Indicates how the processor should be scheduled to run." ) public String getSchedulingStrategy() { return schedulingStrategy; @@ -99,8 +97,7 @@ public class ProcessorConfigDTO { * * @return execution node */ - @ApiModelProperty( - value = "Indicates the node where the process will execute." + @Schema(description = "Indicates the node where the process will execute." ) public String getExecutionNode() { return executionNode; @@ -113,8 +110,7 @@ public class ProcessorConfigDTO { /** * @return the amount of time that is used when this processor penalizes a flowfile */ - @ApiModelProperty( - value = "The amount of time that is used when the process penalizes a flowfile." + @Schema(description = "The amount of time that is used when the process penalizes a flowfile." ) public String getPenaltyDuration() { return penaltyDuration; @@ -127,8 +123,7 @@ public class ProcessorConfigDTO { /** * @return amount of time must elapse before this processor is scheduled again when yielding */ - @ApiModelProperty( - value = "The amount of time that must elapse before this processor is scheduled again after yielding." + @Schema(description = "The amount of time that must elapse before this processor is scheduled again after yielding." ) public String getYieldDuration() { return yieldDuration; @@ -141,8 +136,7 @@ public class ProcessorConfigDTO { /** * @return the level at this this processor will report bulletins */ - @ApiModelProperty( - value = "The level at which the processor will report bulletins." + @Schema(description = "The level at which the processor will report bulletins." ) public String getBulletinLevel() { return bulletinLevel; @@ -157,8 +151,7 @@ public class ProcessorConfigDTO { * * @return the concurrently schedulable task count */ - @ApiModelProperty( - value = "The number of tasks that should be concurrently schedule for the processor. If the processor doesn't allow parallol processing then any positive input will be ignored." + @Schema(description = "The number of tasks that should be concurrently schedule for the processor. If the processor doesn't allow parallol processing then any positive input will be ignored." ) public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; @@ -171,8 +164,7 @@ public class ProcessorConfigDTO { /** * @return whether or not this Processor is Loss Tolerant */ - @ApiModelProperty( - value = "Whether the processor is loss tolerant." + @Schema(description = "Whether the processor is loss tolerant." ) public Boolean isLossTolerant() { return lossTolerant; @@ -185,8 +177,7 @@ public class ProcessorConfigDTO { /** * @return the comments */ - @ApiModelProperty( - value = "The comments for the processor." + @Schema(description = "The comments for the processor." ) public String getComments() { return comments; @@ -202,8 +193,7 @@ public class ProcessorConfigDTO { * * @return The optional properties */ - @ApiModelProperty( - value = "The properties for the processor. Properties whose value is not set will only contain the property name." + @Schema(description = "The properties for the processor. Properties whose value is not set will only contain the property name." ) public Map getProperties() { return properties; @@ -216,8 +206,7 @@ public class ProcessorConfigDTO { /** * @return descriptors for this processor's properties */ - @ApiModelProperty( - value = "Descriptors for the processor's properties." + @Schema(description = "Descriptors for the processor's properties." ) public Map getDescriptors() { return descriptors; @@ -230,8 +219,7 @@ public class ProcessorConfigDTO { /** * @return Set of sensitive dynamic property names */ - @ApiModelProperty( - value = "Set of sensitive dynamic property names" + @Schema(description = "Set of sensitive dynamic property names" ) public Set getSensitiveDynamicPropertyNames() { return sensitiveDynamicPropertyNames; @@ -246,8 +234,7 @@ public class ProcessorConfigDTO { * * @return The annotation data */ - @ApiModelProperty( - value = "The annotation data for the processor used to relay configuration between a custom UI and the procesosr." + @Schema(description = "The annotation data for the processor used to relay configuration between a custom UI and the procesosr." ) public String getAnnotationData() { return annotationData; @@ -260,8 +247,7 @@ public class ProcessorConfigDTO { /** * @return the URL for this processors custom configuration UI if applicable. Null otherwise. */ - @ApiModelProperty( - value = "The URL for the processor's custom configuration UI if applicable." + @Schema(description = "The URL for the processor's custom configuration UI if applicable." ) public String getCustomUiUrl() { return customUiUrl; @@ -274,8 +260,7 @@ public class ProcessorConfigDTO { /** * @return the names of all processor relationships that cause a flow file to be terminated if the relationship is not connected to anything */ - @ApiModelProperty( - value = "The names of all relationships that cause a flow file to be terminated if the relationship is not connected elsewhere. This property differs " + @Schema(description = "The names of all relationships that cause a flow file to be terminated if the relationship is not connected elsewhere. This property differs " + "from the 'isAutoTerminate' property of the RelationshipDTO in that the RelationshipDTO is meant to depict the current configuration, whereas this " + "property can be set in a DTO when updating a Processor in order to change which Relationships should be auto-terminated." ) @@ -290,8 +275,7 @@ public class ProcessorConfigDTO { /** * @return maps default values for concurrent tasks for each applicable scheduling strategy. */ - @ApiModelProperty( - value = "Maps default values for concurrent tasks for each applicable scheduling strategy." + @Schema(description = "Maps default values for concurrent tasks for each applicable scheduling strategy." ) public Map getDefaultConcurrentTasks() { return defaultConcurrentTasks; @@ -304,8 +288,7 @@ public class ProcessorConfigDTO { /** * @return run duration in milliseconds */ - @ApiModelProperty( - value = "The run duration for the processor in milliseconds." + @Schema(description = "The run duration for the processor in milliseconds." ) public Long getRunDurationMillis() { return runDurationMillis; @@ -318,8 +301,7 @@ public class ProcessorConfigDTO { /** * @return Maps default values for scheduling period for each applicable scheduling strategy */ - @ApiModelProperty( - value = "Maps default values for scheduling period for each applicable scheduling strategy." + @Schema(description = "Maps default values for scheduling period for each applicable scheduling strategy." ) public Map getDefaultSchedulingPeriod() { return defaultSchedulingPeriod; @@ -329,8 +311,7 @@ public class ProcessorConfigDTO { this.defaultSchedulingPeriod = defaultSchedulingPeriod; } - @ApiModelProperty( - value = "Overall number of retries." + @Schema(description = "Overall number of retries." ) public Integer getRetryCount() { return retryCount; @@ -340,8 +321,7 @@ public class ProcessorConfigDTO { this.retryCount = retryCount; } - @ApiModelProperty( - value = "All the relationships should be retried." + @Schema(description = "All the relationships should be retried." ) public Set getRetriedRelationships() { return retriedRelationships; @@ -351,8 +331,7 @@ public class ProcessorConfigDTO { this.retriedRelationships = retriedRelationships; } - @ApiModelProperty(accessMode = ApiModelProperty.AccessMode.READ_ONLY, - value = "Determines whether the FlowFile should be penalized or the processor should be yielded between retries.", + @Schema(description = "Determines whether the FlowFile should be penalized or the processor should be yielded between retries.", allowableValues = "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ) public String getBackoffMechanism() { @@ -363,8 +342,7 @@ public class ProcessorConfigDTO { this.backoffMechanism = backoffMechanism; } - @ApiModelProperty( - value = "Maximum amount of time to be waited during a retry period." + @Schema(description = "Maximum amount of time to be waited during a retry period." ) public String getMaxBackoffPeriod() { return maxBackoffPeriod; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java index b15b7d80f7..1e9ce740b0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -64,8 +64,7 @@ public class ProcessorDTO extends ComponentDTO { * * @return This processors name */ - @ApiModelProperty( - value = "The name of the processor." + @Schema(description = "The name of the processor." ) public String getName() { return name; @@ -80,8 +79,7 @@ public class ProcessorDTO extends ComponentDTO { * * @return This processors type */ - @ApiModelProperty( - value = "The type of the processor." + @Schema(description = "The type of the processor." ) public String getType() { return type; @@ -96,8 +94,7 @@ public class ProcessorDTO extends ComponentDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this processor type." + @Schema(description = "The details of the artifact that bundled this processor type." ) public BundleDTO getBundle() { return bundle; @@ -110,8 +107,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return The state of this processor. Possible states are 'RUNNING', 'STOPPED', and 'DISABLED' */ - @ApiModelProperty( - value = "The state of the processor", + @Schema(description = "The state of the processor", allowableValues = "RUNNING, STOPPED, DISABLED" ) public String getState() { @@ -125,8 +121,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return The styles for this processor. (Currently only supports color) */ - @ApiModelProperty( - value = "Styles for the processor (background-color : #eee)." + @Schema(description = "Styles for the processor (background-color : #eee)." ) public Map getStyle() { return style; @@ -139,8 +134,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether this processor supports parallel processing */ - @ApiModelProperty( - value = "Whether the processor supports parallel processing." + @Schema(description = "Whether the processor supports parallel processing." ) public Boolean getSupportsParallelProcessing() { return supportsParallelProcessing; @@ -153,8 +147,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether this processor supports sensitive dynamic properties */ - @ApiModelProperty( - value = "Whether the processor supports sensitive dynamic properties." + @Schema(description = "Whether the processor supports sensitive dynamic properties." ) public Boolean getSupportsSensitiveDynamicProperties() { return supportsSensitiveDynamicProperties; @@ -167,8 +160,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether this processor persists state */ - @ApiModelProperty( - value = "Whether the processor persists state." + @Schema(description = "Whether the processor persists state." ) public Boolean getPersistsState() { return persistsState; @@ -181,8 +173,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether this processor has multiple versions available */ - @ApiModelProperty( - value = "Whether the processor has multiple versions available." + @Schema(description = "Whether the processor has multiple versions available." ) public Boolean getMultipleVersionsAvailable() { return multipleVersionsAvailable; @@ -195,8 +186,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether the underlying extension is missing */ - @ApiModelProperty( - value = "Whether the underlying extension is missing." + @Schema(description = "Whether the underlying extension is missing." ) public Boolean getExtensionMissing() { return isExtensionMissing; @@ -209,8 +199,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether this processor requires elevated privileges */ - @ApiModelProperty( - value = "Whether the processor requires elevated privileges." + @Schema(description = "Whether the processor requires elevated privileges." ) public Boolean getRestricted() { return restricted; @@ -223,8 +212,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return Whether the processor has been deprecated. */ - @ApiModelProperty( - value = "Whether the processor has been deprecated." + @Schema(description = "Whether the processor has been deprecated." ) public Boolean getDeprecated() { return deprecated; @@ -237,8 +225,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return the input requirement of this processor */ - @ApiModelProperty( - value = "The input requirement for this processor." + @Schema(description = "The input requirement for this processor." ) public String getInputRequirement() { return inputRequirement; @@ -251,8 +238,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether this processor supports batching */ - @ApiModelProperty( - value = "Whether the processor supports batching. This makes the run duration settings available." + @Schema(description = "Whether the processor supports batching. This makes the run duration settings available." ) public Boolean getSupportsBatching() { return supportsBatching; @@ -267,9 +253,8 @@ public class ProcessorDTO extends ComponentDTO { * * @return The available relationships */ - @ApiModelProperty( - value = "The available relationships that the processor currently supports.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The available relationships that the processor currently supports.", + accessMode = Schema.AccessMode.READ_ONLY ) public List getRelationships() { return relationships; @@ -284,8 +269,7 @@ public class ProcessorDTO extends ComponentDTO { * * @return The processor configuration details */ - @ApiModelProperty( - value = "The configuration details for the processor. These details will be included in a response if the verbose flag is included in a request." + @Schema(description = "The configuration details for the processor. These details will be included in a response if the verbose flag is included in a request." ) public ProcessorConfigDTO getConfig() { return config; @@ -300,8 +284,7 @@ public class ProcessorDTO extends ComponentDTO { * * @return The validation errors */ - @ApiModelProperty( - value = "The validation errors for the processor. These validation errors represent the problems with the processor that must be resolved before it can be started." + @Schema(description = "The validation errors for the processor. These validation errors represent the problems with the processor that must be resolved before it can be started." ) public Collection getValidationErrors() { return validationErrors; @@ -311,8 +294,8 @@ public class ProcessorDTO extends ComponentDTO { this.validationErrors = validationErrors; } - @ApiModelProperty(value = "Indicates whether the Processor is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Processor is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "Indicates whether the Processor is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Processor is valid)", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; @@ -325,8 +308,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return the description for this processor */ - @ApiModelProperty( - value = "The description of the processor." + @Schema(description = "The description of the processor." ) public String getDescription() { return description; @@ -339,8 +321,7 @@ public class ProcessorDTO extends ComponentDTO { /** * @return whether or not this processor is restricted to run only in primary node */ - @ApiModelProperty( - value = "Indicates if the execution node of a processor is restricted to run only on the primary node" + @Schema(description = "Indicates if the execution node of a processor is restricted to run only on the primary node" ) public Boolean isExecutionNodeRestricted() { return executionNodeRestricted; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorRunStatusDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorRunStatusDetailsDTO.java index 6b2c9ddd35..da2161856a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorRunStatusDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorRunStatusDetailsDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Set; @@ -37,7 +37,7 @@ public class ProcessorRunStatusDetailsDTO { private int activeThreads; private Set validationErrors; - @ApiModelProperty("The ID of the processor") + @Schema(description = "The ID of the processor") public String getId() { return id; } @@ -46,7 +46,7 @@ public class ProcessorRunStatusDetailsDTO { this.id = id; } - @ApiModelProperty("The name of the processor") + @Schema(description = "The name of the processor") public String getName() { return name; } @@ -55,8 +55,7 @@ public class ProcessorRunStatusDetailsDTO { this.name = name; } - @ApiModelProperty( - value = "The run status of the processor", + @Schema(description = "The run status of the processor", allowableValues = RUNNING + ", " + STOPPED + ", " + INVALID + ", " + VALIDATING + ", " + DISABLED ) public String getRunStatus() { @@ -67,7 +66,7 @@ public class ProcessorRunStatusDetailsDTO { this.runStatus = runStatus; } - @ApiModelProperty("The current number of threads that the processor is currently using") + @Schema(description = "The current number of threads that the processor is currently using") public int getActiveThreadCount() { return activeThreads; } @@ -77,7 +76,7 @@ public class ProcessorRunStatusDetailsDTO { } - @ApiModelProperty("The processor's validation errors") + @Schema(description = "The processor's validation errors") public Set getValidationErrors() { return validationErrors; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDependencyDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDependencyDTO.java index 8abd687e59..e930ab1269 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDependencyDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDependencyDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Set; @@ -27,7 +27,7 @@ public class PropertyDependencyDTO { private String propertyName; private Set dependentValues; - @ApiModelProperty("The name of the property that is being depended upon") + @Schema(description = "The name of the property that is being depended upon") public String getPropertyName() { return propertyName; } @@ -36,7 +36,7 @@ public class PropertyDependencyDTO { this.propertyName = propertyName; } - @ApiModelProperty("The values for the property that satisfies the dependency, or null if the dependency is satisfied by the presence of any value for the associated property name") + @Schema(description = "The values for the property that satisfies the dependency, or null if the dependency is satisfied by the presence of any value for the associated property name") public Set getDependentValues() { return dependentValues; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java index 59bdb06077..65594f31e3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AllowableValueEntity; import jakarta.xml.bind.annotation.XmlType; @@ -45,8 +45,7 @@ public class PropertyDescriptorDTO { /** * @return set of allowable values for this property. If empty then the allowable values are not constrained */ - @ApiModelProperty( - value = "Allowable values for the property. If empty then the allowed values are not constrained." + @Schema(description = "Allowable values for the property. If empty then the allowed values are not constrained." ) public List getAllowableValues() { return allowableValues; @@ -59,8 +58,7 @@ public class PropertyDescriptorDTO { /** * @return default value for this property */ - @ApiModelProperty( - value = "The default value for the property." + @Schema(description = "The default value for the property." ) public String getDefaultValue() { return defaultValue; @@ -73,8 +71,7 @@ public class PropertyDescriptorDTO { /** * @return An explanation of the meaning of the given property. This description is meant to be displayed to a user or simply provide a mechanism of documenting intent */ - @ApiModelProperty( - value = "The description for the property. Used to relay additional details to a user or provide a mechanism of documenting intent." + @Schema(description = "The description for the property. Used to relay additional details to a user or provide a mechanism of documenting intent." ) public String getDescription() { return description; @@ -87,8 +84,7 @@ public class PropertyDescriptorDTO { /** * @return property name */ - @ApiModelProperty( - value = "The name for the property." + @Schema(description = "The name for the property." ) public String getName() { return name; @@ -101,8 +97,7 @@ public class PropertyDescriptorDTO { /** * @return human-readable name to display to users */ - @ApiModelProperty( - value = "The human readable name for the property." + @Schema(description = "The human readable name for the property." ) public String getDisplayName() { return displayName; @@ -115,8 +110,7 @@ public class PropertyDescriptorDTO { /** * @return whether the property is required for this processor */ - @ApiModelProperty( - value = "Whether the property is required." + @Schema(description = "Whether the property is required." ) public Boolean isRequired() { return required; @@ -129,8 +123,7 @@ public class PropertyDescriptorDTO { /** * @return indicates that the value for this property should be considered sensitive and protected whenever stored or represented */ - @ApiModelProperty( - value = "Whether the property is sensitive and protected whenever stored or represented." + @Schema(description = "Whether the property is sensitive and protected whenever stored or represented." ) public Boolean isSensitive() { return sensitive; @@ -143,8 +136,7 @@ public class PropertyDescriptorDTO { /** * @return indicates whether this property is dynamic */ - @ApiModelProperty( - value = "Whether the property is dynamic (user-defined)." + @Schema(description = "Whether the property is dynamic (user-defined)." ) public Boolean isDynamic() { return dynamic; @@ -157,8 +149,7 @@ public class PropertyDescriptorDTO { /** * @return specifies whether or not this property support expression language */ - @ApiModelProperty( - value = "Whether the property supports expression language." + @Schema(description = "Whether the property supports expression language." ) public Boolean getSupportsEl() { return supportsEl; @@ -171,8 +162,7 @@ public class PropertyDescriptorDTO { /** * @return specifies the scope of expression language evaluation */ - @ApiModelProperty( - value = "Scope of the Expression Language evaluation for the property." + @Schema(description = "Scope of the Expression Language evaluation for the property." ) public String getExpressionLanguageScope() { return expressionLanguageScope; @@ -185,8 +175,7 @@ public class PropertyDescriptorDTO { /** * @return if this property identifies a controller service this returns the fully qualified type, null otherwise */ - @ApiModelProperty( - value = "If the property identifies a controller service this returns the fully qualified type." + @Schema(description = "If the property identifies a controller service this returns the fully qualified type." ) public String getIdentifiesControllerService() { return identifiesControllerService; @@ -199,8 +188,7 @@ public class PropertyDescriptorDTO { /** * @return if this property identifies a controller service this returns the bundle of the type, null otherwise */ - @ApiModelProperty( - value = "If the property identifies a controller service this returns the bundle of the type, null otherwise." + @Schema(description = "If the property identifies a controller service this returns the bundle of the type, null otherwise." ) public BundleDTO getIdentifiesControllerServiceBundle() { return identifiesControllerServiceBundle; @@ -210,7 +198,7 @@ public class PropertyDescriptorDTO { this.identifiesControllerServiceBundle = identifiesControllerServiceBundle; } - @ApiModelProperty(value="A list of dependencies that must be met in order for this Property to be relevant. If any of these dependencies is not met, the property described by this " + + @Schema(description = "A list of dependencies that must be met in order for this Property to be relevant. If any of these dependencies is not met, the property described by this " + "Property Descriptor is not relevant.") public List getDependencies() { return dependencies; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java index 489b830b77..9575f87f03 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -32,8 +32,7 @@ public class PropertyHistoryDTO { /** * @return previous values */ - @ApiModelProperty( - value = "Previous values for a given property." + @Schema(description = "Previous values for a given property." ) public List getPreviousValues() { return previousValues; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java index 6b08819bc4..0d524755b5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,8 +32,7 @@ public class QueueSizeDTO { /** * @return the count of objects in a queue */ - @ApiModelProperty( - value = "The count of objects in a queue." + @Schema(description = "The count of objects in a queue." ) public int getObjectCount() { return objectCount; @@ -46,8 +45,7 @@ public class QueueSizeDTO { /** * @return the size of objects in a queue */ - @ApiModelProperty( - value = "The size of objects in a queue." + @Schema(description = "The size of objects in a queue." ) public long getByteCount() { return byteCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReadablePermission.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReadablePermission.java index f06e927376..d9e516cce8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReadablePermission.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReadablePermission.java @@ -16,12 +16,11 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public interface ReadablePermission { - @ApiModelProperty( - value = "Indicates whether the user can read a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Indicates whether the user can read a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) Boolean getCanRead(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java index 25f8f19bae..e75ba96bbb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,8 +34,7 @@ public class RelationshipDTO { /** * @return the relationship name */ - @ApiModelProperty( - value = "The relationship name." + @Schema(description = "The relationship name." ) public String getName() { return name; @@ -48,8 +47,7 @@ public class RelationshipDTO { /** * @return the relationship description */ - @ApiModelProperty( - value = "The relationship description." + @Schema(description = "The relationship description." ) public String getDescription() { return description; @@ -62,8 +60,7 @@ public class RelationshipDTO { /** * @return true if relationship is auto terminated;false otherwise */ - @ApiModelProperty( - value = "Whether or not flowfiles sent to this relationship should auto terminate." + @Schema(description = "Whether or not flowfiles sent to this relationship should auto terminate." ) public Boolean isAutoTerminate() { return autoTerminate; @@ -76,8 +73,7 @@ public class RelationshipDTO { /** * @return true if relationship is retry;false otherwise */ - @ApiModelProperty( - value = "Whether or not flowfiles sent to this relationship should retry." + @Schema(description = "Whether or not flowfiles sent to this relationship should retry." ) public Boolean isRetry() { return retry; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java index 0ce7d1026e..e5d2962b7f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Set; @@ -33,8 +33,7 @@ public class RemoteProcessGroupContentsDTO { /** * @return Controller Input Ports to which data can be sent */ - @ApiModelProperty( - value = "The input ports to which data can be sent." + @Schema(description = "The input ports to which data can be sent." ) public Set getInputPorts() { return inputPorts; @@ -47,8 +46,7 @@ public class RemoteProcessGroupContentsDTO { /** * @return Controller Output Ports from which data can be retrieved */ - @ApiModelProperty( - value = "The output ports from which data can be retrieved." + @Schema(description = "The output ports from which data can be retrieved." ) public Set getOutputPorts() { return outputPorts; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java index 63f6920033..068422e127 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -81,8 +81,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { * If target uri is not set, but uris are set, then returns the first url in the urls. * If neither target uri nor uris are set, then returns null. */ - @ApiModelProperty( - value = "The target URI of the remote process group." + + @Schema(description = "The target URI of the remote process group." + " If target uri is not set, but uris are set, then returns the first url in the urls." + " If neither target uri nor uris are set, then returns null." ) @@ -113,8 +112,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { * If targetUris was not set but target uri was set, then returns a collection containing the single uri. * If neither target uris nor uri were set, then returns null. */ - @ApiModelProperty( - value = "The target URI of the remote process group." + + @Schema(description = "The target URI of the remote process group." + " If target uris is not set but target uri is set," + " then returns a collection containing the single target uri." + " If neither target uris nor uris are set, then returns null." @@ -134,8 +132,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @param name of this remote process group */ - @ApiModelProperty( - value = "The name of the remote process group." + @Schema(description = "The name of the remote process group." ) public void setName(final String name) { this.name = name; @@ -148,8 +145,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return Comments for this remote process group */ - @ApiModelProperty( - value = "The comments for the remote process group." + @Schema(description = "The comments for the remote process group." ) public String getComments() { return comments; @@ -162,8 +158,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return any remote authorization issues for this remote process group */ - @ApiModelProperty( - value = "Any remote authorization issues for the remote process group." + @Schema(description = "Any remote authorization issues for the remote process group." ) public Collection getAuthorizationIssues() { return authorizationIssues; @@ -176,8 +171,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return whether or not this remote process group is actively transmitting */ - @ApiModelProperty( - value = "Whether the remote process group is actively transmitting." + @Schema(description = "Whether the remote process group is actively transmitting." ) public Boolean isTransmitting() { return transmitting; @@ -190,8 +184,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return whether or not the target is running securely */ - @ApiModelProperty( - value = "Whether the target is running securely." + @Schema(description = "Whether the target is running securely." ) public Boolean isTargetSecure() { return targetSecure; @@ -204,8 +197,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return the time period used for the timeout when communicating with this RemoteProcessGroup */ - @ApiModelProperty( - value = "The time period used for the timeout when communicating with the target." + @Schema(description = "The time period used for the timeout when communicating with the target." ) public String getCommunicationsTimeout() { return communicationsTimeout; @@ -218,8 +210,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return when yielding, this amount of time must elapse before this remote process group is scheduled again */ - @ApiModelProperty( - value = "When yielding, this amount of time must elapse before the remote process group is scheduled again." + @Schema(description = "When yielding, this amount of time must elapse before the remote process group is scheduled again." ) public String getYieldDuration() { return yieldDuration; @@ -232,8 +223,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return number of active remote input ports */ - @ApiModelProperty( - value = "The number of active remote input ports." + @Schema(description = "The number of active remote input ports." ) public Integer getActiveRemoteInputPortCount() { return activeRemoteInputPortCount; @@ -246,8 +236,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return number of inactive remote input ports */ - @ApiModelProperty( - value = "The number of inactive remote input ports." + @Schema(description = "The number of inactive remote input ports." ) public Integer getInactiveRemoteInputPortCount() { return inactiveRemoteInputPortCount; @@ -260,8 +249,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return number of active remote output ports */ - @ApiModelProperty( - value = "The number of active remote output ports." + @Schema(description = "The number of active remote output ports." ) public Integer getActiveRemoteOutputPortCount() { return activeRemoteOutputPortCount; @@ -274,8 +262,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return number of inactive remote output ports */ - @ApiModelProperty( - value = "The number of inactive remote output ports." + @Schema(description = "The number of inactive remote output ports." ) public Integer getInactiveRemoteOutputPortCount() { return inactiveRemoteOutputPortCount; @@ -288,8 +275,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return number of Remote Input Ports currently available in the remote NiFi instance */ - @ApiModelProperty( - value = "The number of remote input ports currently available on the target." + @Schema(description = "The number of remote input ports currently available on the target." ) public Integer getInputPortCount() { return inputPortCount; @@ -302,8 +288,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return number of Remote Output Ports currently available in the remote NiFi instance */ - @ApiModelProperty( - value = "The number of remote output ports currently available on the target." + @Schema(description = "The number of remote output ports currently available on the target." ) public Integer getOutputPortCount() { return outputPortCount; @@ -316,8 +301,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { /** * @return contents of this remote process group. Will contain available input/output ports */ - @ApiModelProperty( - value = "The contents of the remote process group. Will contain available input/output ports." + @Schema(description = "The contents of the remote process group. Will contain available input/output ports." ) public RemoteProcessGroupContentsDTO getContents() { return contents; @@ -331,9 +315,8 @@ public class RemoteProcessGroupDTO extends ComponentDTO { * @return the flow for this remote group was last refreshed */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The timestamp when this remote process group was last refreshed.", - dataType = "string" + @Schema(description = "The timestamp when this remote process group was last refreshed.", + type = "string" ) public Date getFlowRefreshed() { return flowRefreshed; @@ -351,7 +334,7 @@ public class RemoteProcessGroupDTO extends ComponentDTO { this.transportProtocol = transportProtocol; } - @ApiModelProperty("The local network interface to send/receive data. If not specified, any local address is used. If clustered, all nodes must have an interface with this identifier.") + @Schema(description = "The local network interface to send/receive data. If not specified, any local address is used. If clustered, all nodes must have an interface with this identifier.") public String getLocalNetworkInterface() { return localNetworkInterface; } @@ -360,8 +343,10 @@ public class RemoteProcessGroupDTO extends ComponentDTO { this.localNetworkInterface = localNetworkInterface; } - @ApiModelProperty( - "The validation errors for the remote process group. These validation errors represent the problems with the remote process group that must be resolved before it can transmit." + @Schema(description = """ + The validation errors for the remote process group. + These validation errors represent the problems with the remote process group that must be resolved before it can transmit. + """ ) public Collection getValidationErrors() { return validationErrors; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java index 333e8999ff..524641fcbe 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; /** @@ -42,8 +42,7 @@ public class RemoteProcessGroupPortDTO { /** * @return comments as configured in the target port */ - @ApiModelProperty( - value = "The comments as configured on the target port." + @Schema(description = "The comments as configured on the target port." ) public String getComments() { return comments; @@ -53,7 +52,7 @@ public class RemoteProcessGroupPortDTO { this.comments = comments; } - @ApiModelProperty("The ID of the corresponding component that is under version control") + @Schema(description = "The ID of the corresponding component that is under version control") public String getVersionedComponentId() { return versionedComponentId; } @@ -65,8 +64,7 @@ public class RemoteProcessGroupPortDTO { /** * @return number tasks that may transmit flow files to the target port concurrently */ - @ApiModelProperty( - value = "The number of task that may transmit flowfiles to the target port concurrently." + @Schema(description = "The number of task that may transmit flowfiles to the target port concurrently." ) public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; @@ -79,8 +77,7 @@ public class RemoteProcessGroupPortDTO { /** * @return id of the target port */ - @ApiModelProperty( - value = "The id of the port." + @Schema(description = "The id of the port." ) public String getId() { return id; @@ -90,7 +87,7 @@ public class RemoteProcessGroupPortDTO { this.id = id; } - @ApiModelProperty("The id of the target port.") + @Schema(description = "The id of the target port.") public String getTargetId() { return targetId; } @@ -102,8 +99,7 @@ public class RemoteProcessGroupPortDTO { /** * @return id of the remote process group that this port resides in */ - @ApiModelProperty( - value = "The id of the remote process group that the port resides in." + @Schema(description = "The id of the remote process group that the port resides in." ) public String getGroupId() { return groupId; @@ -116,8 +112,7 @@ public class RemoteProcessGroupPortDTO { /** * @return name of the target port */ - @ApiModelProperty( - value = "The name of the target port." + @Schema(description = "The name of the target port." ) public String getName() { return name; @@ -130,8 +125,7 @@ public class RemoteProcessGroupPortDTO { /** * @return whether or not this remote group port is configured for transmission */ - @ApiModelProperty( - value = "Whether the remote port is configured for transmission." + @Schema(description = "Whether the remote port is configured for transmission." ) public Boolean isTransmitting() { return transmitting; @@ -144,8 +138,7 @@ public class RemoteProcessGroupPortDTO { /** * @return whether or not flow file are compressed when sent to this target port */ - @ApiModelProperty( - value = "Whether the flowfiles are compressed when sent to the target port." + @Schema(description = "Whether the flowfiles are compressed when sent to the target port." ) public Boolean getUseCompression() { return useCompression; @@ -158,8 +151,7 @@ public class RemoteProcessGroupPortDTO { /** * @return whether or not the target port exists */ - @ApiModelProperty( - value = "Whether the target port exists." + @Schema(description = "Whether the target port exists." ) public Boolean getExists() { return exists; @@ -172,8 +164,7 @@ public class RemoteProcessGroupPortDTO { /** * @return whether or not the target port is running */ - @ApiModelProperty( - value = "Whether the target port is running." + @Schema(description = "Whether the target port is running." ) public Boolean isTargetRunning() { return targetRunning; @@ -186,8 +177,7 @@ public class RemoteProcessGroupPortDTO { /** * @return whether or not this port has either an incoming or outgoing connection */ - @ApiModelProperty( - value = "Whether the port has either an incoming or outgoing connection." + @Schema(description = "Whether the port has either an incoming or outgoing connection." ) public Boolean isConnected() { return connected; @@ -200,8 +190,7 @@ public class RemoteProcessGroupPortDTO { /** * @return batch settings for data transmission */ - @ApiModelProperty( - value = "The batch settings for data transmission." + @Schema(description = "The batch settings for data transmission." ) public BatchSettingsDTO getBatchSettings() { return batchSettings; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java index 22d15f78fd..bec8284aaf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -62,8 +62,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return user-defined name of the reporting task */ - @ApiModelProperty( - value = "The name of the reporting task." + @Schema(description = "The name of the reporting task." ) public String getName() { return name; @@ -76,8 +75,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return user-defined comments for the reporting task */ - @ApiModelProperty( - value = "The comments of the reporting task." + @Schema(description = "The comments of the reporting task." ) public String getComments() { return comments; @@ -90,8 +88,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return type of reporting task */ - @ApiModelProperty( - value = "The fully qualified type of the reporting task." + @Schema(description = "The fully qualified type of the reporting task." ) public String getType() { return type; @@ -106,8 +103,7 @@ public class ReportingTaskDTO extends ComponentDTO { * * @return The bundle details */ - @ApiModelProperty( - value = "The details of the artifact that bundled this reporting task type." + @Schema(description = "The details of the artifact that bundled this reporting task type." ) public BundleDTO getBundle() { return bundle; @@ -122,8 +118,7 @@ public class ReportingTaskDTO extends ComponentDTO { * * @return The scheduling period */ - @ApiModelProperty( - value = "The frequency with which to schedule the reporting task. The format of the value will depend on the value of the schedulingStrategy." + @Schema(description = "The frequency with which to schedule the reporting task. The format of the value will depend on the value of the schedulingStrategy." ) public String getSchedulingPeriod() { return schedulingPeriod; @@ -136,8 +131,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return whether this reporting task persists state */ - @ApiModelProperty( - value = "Whether the reporting task persists state." + @Schema(description = "Whether the reporting task persists state." ) public Boolean getPersistsState() { return persistsState; @@ -150,8 +144,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return whether this reporting task requires elevated privileges */ - @ApiModelProperty( - value = "Whether the reporting task requires elevated privileges." + @Schema(description = "Whether the reporting task requires elevated privileges." ) public Boolean getRestricted() { return restricted; @@ -164,8 +157,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return Whether the reporting task has been deprecated. */ - @ApiModelProperty( - value = "Whether the reporting task has been deprecated." + @Schema(description = "Whether the reporting task has been deprecated." ) public Boolean getDeprecated() { return deprecated; @@ -178,8 +170,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return whether the underlying extension is missing */ - @ApiModelProperty( - value = "Whether the underlying extension is missing." + @Schema(description = "Whether the underlying extension is missing." ) public Boolean getExtensionMissing() { return isExtensionMissing; @@ -192,8 +183,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return whether this reporting task has multiple versions available */ - @ApiModelProperty( - value = "Whether the reporting task has multiple versions available." + @Schema(description = "Whether the reporting task has multiple versions available." ) public Boolean getMultipleVersionsAvailable() { return multipleVersionsAvailable; @@ -206,8 +196,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return whether this reporting task supports sensitive dynamic properties */ - @ApiModelProperty( - value = "Whether the reporting task supports sensitive dynamic properties." + @Schema(description = "Whether the reporting task supports sensitive dynamic properties." ) public Boolean getSupportsSensitiveDynamicProperties() { return supportsSensitiveDynamicProperties; @@ -220,8 +209,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return current scheduling state of the reporting task */ - @ApiModelProperty( - value = "The state of the reporting task.", + @Schema(description = "The state of the reporting task.", allowableValues = "RUNNING, STOPPED, DISABLED" ) public String getState() { @@ -235,8 +223,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return The scheduling strategy that determines how the {@link #getSchedulingPeriod()} value should be interpreted */ - @ApiModelProperty( - value = "The scheduling strategy that determines how the schedulingPeriod value should be interpreted." + @Schema(description = "The scheduling strategy that determines how the schedulingPeriod value should be interpreted." ) public String getSchedulingStrategy() { return schedulingStrategy; @@ -249,8 +236,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return reporting task's properties */ - @ApiModelProperty( - value = "The properties of the reporting task." + @Schema(description = "The properties of the reporting task." ) public Map getProperties() { return properties; @@ -263,8 +249,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return Map of property name to descriptor */ - @ApiModelProperty( - value = "The descriptors for the reporting tasks properties." + @Schema(description = "The descriptors for the reporting tasks properties." ) public Map getDescriptors() { return descriptors; @@ -277,8 +262,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return Set of sensitive dynamic property names */ - @ApiModelProperty( - value = "Set of sensitive dynamic property names" + @Schema(description = "Set of sensitive dynamic property names" ) public Set getSensitiveDynamicPropertyNames() { return sensitiveDynamicPropertyNames; @@ -291,8 +275,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return the URL for this reporting task custom configuration UI if applicable. Null otherwise */ - @ApiModelProperty( - value = "The URL for the custom configuration UI for the reporting task." + @Schema(description = "The URL for the custom configuration UI for the reporting task." ) public String getCustomUiUrl() { return customUiUrl; @@ -305,8 +288,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return currently configured annotation data for the reporting task */ - @ApiModelProperty( - value = "The annotation data for the repoting task. This is how the custom UI relays configuration to the reporting task." + @Schema(description = "The annotation data for the repoting task. This is how the custom UI relays configuration to the reporting task." ) public String getAnnotationData() { return annotationData; @@ -321,8 +303,7 @@ public class ReportingTaskDTO extends ComponentDTO { * * @return The validation errors */ - @ApiModelProperty( - value = "Gets the validation errors from the reporting task. These validation errors represent the problems with the reporting task that must be resolved before " + @Schema(description = "Gets the validation errors from the reporting task. These validation errors represent the problems with the reporting task that must be resolved before " + "it can be scheduled to run." ) public Collection getValidationErrors() { @@ -333,8 +314,8 @@ public class ReportingTaskDTO extends ComponentDTO { this.validationErrors = validationErrors; } - @ApiModelProperty(value = "Indicates whether the Reporting Task is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Reporting Task is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "Indicates whether the Reporting Task is valid, invalid, or still in the process of validating (i.e., it is unknown whether or not the Reporting Task is valid)", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; @@ -347,8 +328,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return default scheduling period for the different scheduling strategies */ - @ApiModelProperty( - value = "The default scheduling period for the different scheduling strategies." + @Schema(description = "The default scheduling period for the different scheduling strategies." ) public Map getDefaultSchedulingPeriod() { return defaultSchedulingPeriod; @@ -361,8 +341,7 @@ public class ReportingTaskDTO extends ComponentDTO { /** * @return number of active threads for this reporting task */ - @ApiModelProperty( - value = "The number of active threads for the reporting task." + @Schema(description = "The number of active threads for the reporting task." ) public Integer getActiveThreadCount() { return activeThreadCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RequiredPermissionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RequiredPermissionDTO.java index 083d12cf47..f9c735cb9a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RequiredPermissionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RequiredPermissionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Objects; @@ -33,8 +33,7 @@ public class RequiredPermissionDTO { /** * @return The required sub-permission necessary for this restriction. */ - @ApiModelProperty( - value = "The required sub-permission necessary for this restriction." + @Schema(description = "The required sub-permission necessary for this restriction." ) public String getId() { return id; @@ -47,8 +46,7 @@ public class RequiredPermissionDTO { /** * @return The label for the required sub-permission necessary for this restriction. */ - @ApiModelProperty( - value = "The label for the required sub-permission necessary for this restriction." + @Schema(description = "The label for the required sub-permission necessary for this restriction." ) public String getLabel() { return label; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ResourceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ResourceDTO.java index 69cb9fa277..2a5b2105b0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ResourceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ResourceDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public class ResourceDTO { * * @return The name of the resource */ - @ApiModelProperty( - value = "The name of the resource." + @Schema(description = "The name of the resource." ) public String getName() { return name; @@ -51,8 +50,7 @@ public class ResourceDTO { * * @return The identifier of the resource */ - @ApiModelProperty( - value = "The identifier of the resource." + @Schema(description = "The identifier of the resource." ) public String getIdentifier() { return identifier; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java index f85cbe4205..74bdc89071 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -37,9 +37,11 @@ public class RevisionDTO { * * @return The client id */ - @ApiModelProperty( - value = "A client identifier used to make a request. By including a client identifier, the API can allow multiple requests without needing the current revision. Due to the asynchronous " - + "nature of requests/responses this was implemented to allow the client to make numerous requests without having to wait for the previous response to come back" + @Schema(description = """ + A client identifier used to make a request. + By including a client identifier, the API can allow multiple requests without needing the current revision. + Due to the asynchronous nature of requests/responses this was implemented to allow the client to make numerous requests without having to wait for the previous response to come back + """ ) public String getClientId() { return clientId; @@ -54,9 +56,10 @@ public class RevisionDTO { * * @return The revision */ - @ApiModelProperty( - value = "NiFi employs an optimistic locking strategy where the client must include a revision in their request when performing an update. In a response to a mutable flow request, this " - + "field represents the updated base version." + @Schema(description = """ + NiFi employs an optimistic locking strategy where the client must include a revision in their request when performing an update. + In a response to a mutable flow request, this field represents the updated base version. + """ ) public Long getVersion() { return version; @@ -69,9 +72,8 @@ public class RevisionDTO { /** * @return The user that last modified the flow */ - @ApiModelProperty( - value = "The user that last modified the flow.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The user that last modified the flow.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getLastModifier() { return lastModifier; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java index 6d6ab3c979..cc4aa71f6e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.HashMap; @@ -45,8 +45,7 @@ public class SnippetDTO { /** * @return id of this snippet */ - @ApiModelProperty( - value = "The id of the snippet." + @Schema(description = "The id of the snippet." ) public String getId() { return id; @@ -59,8 +58,7 @@ public class SnippetDTO { /** * @return uri of this snippet */ - @ApiModelProperty( - value = "The URI of the snippet." + @Schema(description = "The URI of the snippet." ) public String getUri() { return uri; @@ -73,8 +71,7 @@ public class SnippetDTO { /** * @return group id for the components in this snippet */ - @ApiModelProperty( - value = "The group id for the components in the snippet." + @Schema(description = "The group id for the components in the snippet." ) public String getParentGroupId() { return parentGroupId; @@ -88,8 +85,7 @@ public class SnippetDTO { * @return the ids of the connections in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created its * contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the connections in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the connections in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getConnections() { @@ -104,8 +100,7 @@ public class SnippetDTO { * @return the ids of the funnels in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created its * contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the funnels in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the funnels in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getFunnels() { @@ -120,8 +115,7 @@ public class SnippetDTO { * @return the ids of the input port in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created its * contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the input ports in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the input ports in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getInputPorts() { @@ -136,8 +130,7 @@ public class SnippetDTO { * @return the ids of the labels in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created its * contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the labels in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the labels in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getLabels() { @@ -152,8 +145,7 @@ public class SnippetDTO { * @return the ids of the output ports in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created * its contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the output ports in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the output ports in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getOutputPorts() { @@ -168,8 +160,7 @@ public class SnippetDTO { * @return The ids of the process groups in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created * its contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the process groups in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the process groups in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getProcessGroups() { @@ -184,8 +175,7 @@ public class SnippetDTO { * @return The ids of the processors in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been created its * contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the processors in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + @Schema(description = "The ids of the processors in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " + "has been created its contents cannot be modified (these ids are ignored during update requests)." ) public Map getProcessors() { @@ -200,9 +190,12 @@ public class SnippetDTO { * @return the ids of the remote process groups in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet has been * created its contents cannot be modified (these ids are ignored during update requests) */ - @ApiModelProperty( - value = "The ids of the remote process groups in this snippet. These ids will be populated within each response. They can be specified when creating a snippet. However, once a snippet " - + "has been created its contents cannot be modified (these ids are ignored during update requests)." + @Schema(description = """ + The ids of the remote process groups in this snippet. + These ids will be populated within each response. + They can be specified when creating a snippet. + However, once a snippet has been created its contents cannot be modified (these ids are ignored during update requests). + """ ) public Map getRemoteProcessGroups() { return remoteProcessGroups; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateEntryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateEntryDTO.java index 59ea99848b..f4f8e84271 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateEntryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateEntryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public class StateEntryDTO { /** * @return the key for this state */ - @ApiModelProperty( - value = "The key for this state." + @Schema(description = "The key for this state." ) public String getKey() { return key; @@ -49,8 +48,7 @@ public class StateEntryDTO { /** * @return the value for this state */ - @ApiModelProperty( - value = "The value for this state." + @Schema(description = "The value for this state." ) public String getValue() { return value; @@ -63,8 +61,7 @@ public class StateEntryDTO { /** * @return identifier of the node where this state originated */ - @ApiModelProperty( - value = "The identifier for the node where the state originated." + @Schema(description = "The identifier for the node where the state originated." ) public String getClusterNodeId() { return clusterNodeId; @@ -77,8 +74,7 @@ public class StateEntryDTO { /** * @return label to use to show which node this state originated from */ - @ApiModelProperty( - value = "The label for the node where the state originated." + @Schema(description = "The label for the node where the state originated." ) public String getClusterNodeAddress() { return clusterNodeAddress; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateMapDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateMapDTO.java index d4bc521056..00361ab7a5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateMapDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/StateMapDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -34,8 +34,7 @@ public class StateMapDTO { /** * @return The scope of this StateMap */ - @ApiModelProperty( - value = "The scope of this StateMap." + @Schema(description = "The scope of this StateMap." ) public String getScope() { return scope; @@ -48,8 +47,7 @@ public class StateMapDTO { /** * @return The total number of state entries. When the state map is lengthy, only of portion of the entries are returned. */ - @ApiModelProperty( - value = "The total number of state entries. When the state map is lengthy, only of portion of the entries are returned." + @Schema(description = "The total number of state entries. When the state map is lengthy, only of portion of the entries are returned." ) public int getTotalEntryCount() { return totalEntryCount; @@ -62,8 +60,7 @@ public class StateMapDTO { /** * @return The state */ - @ApiModelProperty( - value = "The state." + @Schema(description = "The state." ) public List getState() { return state; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java index 6e4d02aa94..40cc298074 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -28,7 +28,7 @@ public class SystemDiagnosticsDTO { private List nodeSnapshots; - @ApiModelProperty("A systems diagnostic snapshot that represents the aggregate values of all nodes in the cluster. If the NiFi instance is " + @Schema(description = "A systems diagnostic snapshot that represents the aggregate values of all nodes in the cluster. If the NiFi instance is " + "a standalone instance, rather than a cluster, this represents the stats of the single instance.") public SystemDiagnosticsSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; @@ -38,7 +38,7 @@ public class SystemDiagnosticsDTO { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A systems diagnostics snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + @Schema(description = "A systems diagnostics snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + "a cluster, this may be null.") public List getNodeSnapshots() { return nodeSnapshots; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsSnapshotDTO.java index cf54a28f8d..028c2dbd0f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import org.apache.nifi.web.api.dto.util.TimeAdapter; @@ -72,7 +72,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { private VersionInfoDTO versionInfo; - @ApiModelProperty("Number of available processors if supported by the underlying system.") + @Schema(description = "Number of available processors if supported by the underlying system.") public Integer getAvailableProcessors() { return availableProcessors; } @@ -81,7 +81,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.availableProcessors = availableProcessors; } - @ApiModelProperty("Number of daemon threads.") + @Schema(description = "Number of daemon threads.") public Integer getDaemonThreads() { return daemonThreads; } @@ -90,7 +90,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.daemonThreads = daemonThreads; } - @ApiModelProperty("Amount of free heap.") + @Schema(description = "Amount of free heap.") public String getFreeHeap() { return freeHeap; } @@ -99,7 +99,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.freeHeap = freeHeap; } - @ApiModelProperty("Amount of free non heap.") + @Schema(description = "Amount of free non heap.") public String getFreeNonHeap() { return freeNonHeap; } @@ -108,7 +108,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.freeNonHeap = freeNonHeap; } - @ApiModelProperty("Maximum size of heap.") + @Schema(description = "Maximum size of heap.") public String getMaxHeap() { return maxHeap; } @@ -117,7 +117,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.maxHeap = maxHeap; } - @ApiModelProperty("Maximum size of non heap.") + @Schema(description = "Maximum size of non heap.") public String getMaxNonHeap() { return maxNonHeap; } @@ -126,7 +126,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.maxNonHeap = maxNonHeap; } - @ApiModelProperty("The processor load average if supported by the underlying system.") + @Schema(description = "The processor load average if supported by the underlying system.") public Double getProcessorLoadAverage() { return processorLoadAverage; } @@ -135,7 +135,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.processorLoadAverage = processorLoadAverage; } - @ApiModelProperty("Total size of heap.") + @Schema(description = "Total size of heap.") public String getTotalHeap() { return totalHeap; } @@ -144,7 +144,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.totalHeap = totalHeap; } - @ApiModelProperty("Total size of non heap.") + @Schema(description = "Total size of non heap.") public String getTotalNonHeap() { return totalNonHeap; } @@ -153,7 +153,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.totalNonHeap = totalNonHeap; } - @ApiModelProperty("Total number of threads.") + @Schema(description = "Total number of threads.") public Integer getTotalThreads() { return totalThreads; } @@ -162,7 +162,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.totalThreads = totalThreads; } - @ApiModelProperty("Amount of used heap.") + @Schema(description = "Amount of used heap.") public String getUsedHeap() { return usedHeap; } @@ -171,7 +171,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.usedHeap = usedHeap; } - @ApiModelProperty("Amount of use non heap.") + @Schema(description = "Amount of use non heap.") public String getUsedNonHeap() { return usedNonHeap; } @@ -180,7 +180,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.usedNonHeap = usedNonHeap; } - @ApiModelProperty("Utilization of heap.") + @Schema(description = "Utilization of heap.") public String getHeapUtilization() { return heapUtilization; } @@ -189,7 +189,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.heapUtilization = heapUtilization; } - @ApiModelProperty("Utilization of non heap.") + @Schema(description = "Utilization of non heap.") public String getNonHeapUtilization() { return nonHeapUtilization; } @@ -198,7 +198,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.nonHeapUtilization = nonHeapUsage; } - @ApiModelProperty("The content repository storage usage.") + @Schema(description = "The content repository storage usage.") public Set getContentRepositoryStorageUsage() { return contentRepositoryStorageUsage; } @@ -207,7 +207,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.contentRepositoryStorageUsage = contentRepositoryStorageUsage; } - @ApiModelProperty("The provenance repository storage usage.") + @Schema(description = "The provenance repository storage usage.") public Set getProvenanceRepositoryStorageUsage() { return provenanceRepositoryStorageUsage; } @@ -216,7 +216,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.provenanceRepositoryStorageUsage = provenanceRepositoryStorageUsage; } - @ApiModelProperty("The flowfile repository storage usage.") + @Schema(description = "The flowfile repository storage usage.") public StorageUsageDTO getFlowFileRepositoryStorageUsage() { return flowFileRepositoryStorageUsage; } @@ -225,7 +225,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.flowFileRepositoryStorageUsage = flowFileRepositoryStorageUsage; } - @ApiModelProperty("The garbage collection details.") + @Schema(description = "The garbage collection details.") public Set getGarbageCollection() { return garbageCollection; } @@ -243,9 +243,8 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "When the diagnostics were generated.", - dataType = "string" + @Schema(description = "When the diagnostics were generated.", + type = "string" ) public Date getStatsLastRefreshed() { return statsLastRefreshed; @@ -256,7 +255,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { } - @ApiModelProperty("Total number of bytes allocated to the JVM not used for heap") + @Schema(description = "Total number of bytes allocated to the JVM not used for heap") public Long getTotalNonHeapBytes() { return totalNonHeapBytes; } @@ -265,7 +264,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.totalNonHeapBytes = totalNonHeapBytes; } - @ApiModelProperty("Total number of bytes used by the JVM not in the heap space") + @Schema(description = "Total number of bytes used by the JVM not in the heap space") public Long getUsedNonHeapBytes() { return usedNonHeapBytes; } @@ -274,7 +273,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.usedNonHeapBytes = usedNonHeapBytes; } - @ApiModelProperty("Total number of free non-heap bytes available to the JVM") + @Schema(description = "Total number of free non-heap bytes available to the JVM") public Long getFreeNonHeapBytes() { return freeNonHeapBytes; } @@ -283,7 +282,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.freeNonHeapBytes = freeNonHeapBytes; } - @ApiModelProperty("The maximum number of bytes that the JVM can use for non-heap purposes") + @Schema(description = "The maximum number of bytes that the JVM can use for non-heap purposes") public Long getMaxNonHeapBytes() { return maxNonHeapBytes; } @@ -292,7 +291,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.maxNonHeapBytes = maxNonHeapBytes; } - @ApiModelProperty("The total number of bytes that are available for the JVM heap to use") + @Schema(description = "The total number of bytes that are available for the JVM heap to use") public Long getTotalHeapBytes() { return totalHeapBytes; } @@ -301,7 +300,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.totalHeapBytes = totalHeapBytes; } - @ApiModelProperty("The number of bytes of JVM heap that are currently being used") + @Schema(description = "The number of bytes of JVM heap that are currently being used") public Long getUsedHeapBytes() { return usedHeapBytes; } @@ -310,7 +309,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.usedHeapBytes = usedHeapBytes; } - @ApiModelProperty("The number of bytes that are allocated to the JVM heap but not currently being used") + @Schema(description = "The number of bytes that are allocated to the JVM heap but not currently being used") public Long getFreeHeapBytes() { return freeHeapBytes; } @@ -319,7 +318,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.freeHeapBytes = freeHeapBytes; } - @ApiModelProperty("The maximum number of bytes that can be used by the JVM") + @Schema(description = "The maximum number of bytes that can be used by the JVM") public Long getMaxHeapBytes() { return maxHeapBytes; } @@ -328,7 +327,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.maxHeapBytes = maxHeapBytes; } - @ApiModelProperty("The nifi, os, java, and build version information") + @Schema(description = "The nifi, os, java, and build version information") public VersionInfoDTO getVersionInfo() { return versionInfo; } @@ -337,7 +336,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.versionInfo = versionInfo; } - @ApiModelProperty("The uptime of the Java virtual machine") + @Schema(description = "The uptime of the Java virtual machine") public String getUptime() { return uptime; } @@ -420,18 +419,16 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { private Long freeSpaceBytes; private Long totalSpaceBytes; private Long usedSpaceBytes; - private String utilization; - /** * @return identifier for this storage location */ - @ApiModelProperty( - value = "The identifier of this storage location. The identifier will correspond to the identifier keyed in the storage configuration." - ) + @Schema(description = "The identifier of this storage location. The identifier will correspond to the identifier keyed in the storage configuration.") public String getIdentifier() { return identifier; } + private String utilization; + public void setIdentifier(String identifier) { this.identifier = identifier; } @@ -439,9 +436,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return amount of free space */ - @ApiModelProperty( - value = "Amount of free space." - ) + @Schema(description = "Amount of free space.") public String getFreeSpace() { return freeSpace; } @@ -453,9 +448,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return freeSpace amount of total space */ - @ApiModelProperty( - value = "Amount of total space." - ) + @Schema(description = "Amount of total space.") public String getTotalSpace() { return totalSpace; } @@ -467,9 +460,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return amount of used space */ - @ApiModelProperty( - value = "Amount of used space." - ) + @Schema(description = "Amount of used space.") public String getUsedSpace() { return usedSpace; } @@ -481,9 +472,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return utilization of this storage location */ - @ApiModelProperty( - value = "Utilization of this storage location." - ) + @Schema(description = "Utilization of this storage location.") public String getUtilization() { return utilization; } @@ -495,9 +484,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return number of bytes of free space */ - @ApiModelProperty( - value = "The number of bytes of free space." - ) + @Schema(description = "The number of bytes of free space.") public Long getFreeSpaceBytes() { return freeSpaceBytes; } @@ -509,9 +496,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return number of bytes of total space */ - @ApiModelProperty( - value = "The number of bytes of total space." - ) + @Schema(description = "The number of bytes of total space.") public Long getTotalSpaceBytes() { return totalSpaceBytes; } @@ -523,9 +508,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { /** * @return number of bytes of used space */ - @ApiModelProperty( - value = "The number of bytes of used space." - ) + @Schema(description = "The number of bytes of used space.") public Long getUsedSpaceBytes() { return usedSpaceBytes; } @@ -560,7 +543,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { private Integer claimantCount; - @ApiModelProperty("The container of the Content Repository in which the Resource Claim exists") + @Schema(description = "The container of the Content Repository in which the Resource Claim exists") public String getContainer() { return container; } @@ -569,7 +552,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.container = container; } - @ApiModelProperty("The section of the Content Repository in which the Resource Claim exists") + @Schema(description = "The section of the Content Repository in which the Resource Claim exists") public String getSection() { return section; } @@ -578,7 +561,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.section = section; } - @ApiModelProperty("The identifier of the Resource Claim") + @Schema(description = "The identifier of the Resource Claim") public String getIdentifier() { return identifier; } @@ -587,7 +570,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.identifier = identifier; } - @ApiModelProperty("Whether or not the Resource Claim is in use") + @Schema(description = "Whether or not the Resource Claim is in use") public Boolean getInUse() { return inUse; } @@ -596,7 +579,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.inUse = inUse; } - @ApiModelProperty("Whether or not the Resource Claim is awaiting destruction") + @Schema(description = "Whether or not the Resource Claim is awaiting destruction") public Boolean getAwaitingDestruction() { return awaitingDestruction; } @@ -605,7 +588,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.awaitingDestruction = awaitingDestruction; } - @ApiModelProperty("The number of FlowFiles that have a claim to the Resource") + @Schema(description = "The number of FlowFiles that have a claim to the Resource") public Integer getClaimantCount() { return claimantCount; } @@ -614,7 +597,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.claimantCount = claimantCount; } - @ApiModelProperty("Whether or not the Resource Claim can still have more data written to it") + @Schema(description = "Whether or not the Resource Claim can still have more data written to it") public Boolean getWritable() { return writable; } @@ -647,7 +630,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { private String collectionTime; private Long collectionMillis; - @ApiModelProperty("The name of the garbage collector.") + @Schema(description = "The name of the garbage collector.") public String getName() { return name; } @@ -656,7 +639,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.name = name; } - @ApiModelProperty("The number of times garbage collection has run.") + @Schema(description = "The number of times garbage collection has run.") public long getCollectionCount() { return collectionCount; } @@ -665,7 +648,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.collectionCount = collectionCount; } - @ApiModelProperty("The total amount of time spent garbage collecting.") + @Schema(description = "The total amount of time spent garbage collecting.") public String getCollectionTime() { return collectionTime; } @@ -674,7 +657,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.collectionTime = collectionTime; } - @ApiModelProperty("The total number of milliseconds spent garbage collecting.") + @Schema(description = "The total number of milliseconds spent garbage collecting.") public Long getCollectionMillis() { return collectionMillis; } @@ -711,7 +694,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { private String buildBranch; private Date buildTimestamp; - @ApiModelProperty("The version of this NiFi.") + @Schema(description = "The version of this NiFi.") public String getNiFiVersion() { return niFiVersion; } @@ -720,7 +703,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.niFiVersion = niFiVersion; } - @ApiModelProperty("Java JVM vendor") + @Schema(description = "Java JVM vendor") public String getJavaVendor() { return javaVendor; } @@ -729,7 +712,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.javaVendor = javaVendor; } - @ApiModelProperty("Java version") + @Schema(description = "Java version") public String getJavaVersion() { return javaVersion; } @@ -738,7 +721,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.javaVersion = javaVersion; } - @ApiModelProperty("Host operating system name") + @Schema(description = "Host operating system name") public String getOsName() { return osName; } @@ -747,7 +730,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.osName = osName; } - @ApiModelProperty("Host operating system version") + @Schema(description = "Host operating system version") public String getOsVersion() { return osVersion; } @@ -756,7 +739,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.osVersion = osVersion; } - @ApiModelProperty("Host operating system architecture") + @Schema(description = "Host operating system architecture") public String getOsArchitecture() { return osArchitecture; } @@ -765,7 +748,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.osArchitecture = osArchitecture; } - @ApiModelProperty("Build tag") + @Schema(description = "Build tag") public String getBuildTag() { return buildTag; } @@ -774,7 +757,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.buildTag = buildTag; } - @ApiModelProperty("Build revision or commit hash") + @Schema(description = "Build revision or commit hash") public String getBuildRevision() { return buildRevision; } @@ -783,7 +766,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { this.buildRevision = buildRevision; } - @ApiModelProperty("Build branch") + @Schema(description = "Build branch") public String getBuildBranch() { return buildBranch; } @@ -793,7 +776,7 @@ public class SystemDiagnosticsSnapshotDTO implements Cloneable { } @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty("Build timestamp") + @Schema(description = "Build timestamp") public Date getBuildTimestamp() { return buildTimestamp; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TenantDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TenantDTO.java index ccf0ee198a..a2156562b7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TenantDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TenantDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,7 +31,7 @@ public class TenantDTO extends ComponentDTO { /** * @return tenant's identity */ - @ApiModelProperty(value = "The identity of the tenant.") + @Schema(description = "The identity of the tenant.") public String getIdentity() { return identity; } @@ -43,7 +43,7 @@ public class TenantDTO extends ComponentDTO { /** * @return whether this tenant is configurable */ - @ApiModelProperty(value = "Whether this tenant is configurable.") + @Schema(description = "Whether this tenant is configurable.") public Boolean getConfigurable() { return configurable; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UpdateStepDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UpdateStepDTO.java index ce3816b5e9..a244ddb1f3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UpdateStepDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UpdateStepDTO.java @@ -16,14 +16,14 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public abstract class UpdateStepDTO { private String description; private boolean complete; private String failureReason; - @ApiModelProperty(value = "Explanation of what happens in this step", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Explanation of what happens in this step", accessMode = Schema.AccessMode.READ_ONLY) public String getDescription() { return description; } @@ -32,7 +32,7 @@ public abstract class UpdateStepDTO { this.description = description; } - @ApiModelProperty(value = "Whether or not this step has completed", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Whether or not this step has completed", accessMode = Schema.AccessMode.READ_ONLY) public boolean isComplete() { return complete; } @@ -41,7 +41,7 @@ public abstract class UpdateStepDTO { this.complete = complete; } - @ApiModelProperty(value = "An explanation of why this step failed, or null if this step did not fail", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "An explanation of why this step failed, or null if this step did not fail", accessMode = Schema.AccessMode.READ_ONLY) public String getFailureReason() { return failureReason; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java index 5d0ec23d40..fe4e2eae72 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AccessPolicySummaryEntity; import org.apache.nifi.web.api.entity.TenantEntity; @@ -35,9 +35,8 @@ public class UserDTO extends TenantDTO { /** * @return groups to which the user belongs */ - @ApiModelProperty( - value = "The groups to which the user belongs. This field is read only and it provided for convenience.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The groups to which the user belongs. This field is read only and it provided for convenience.", + accessMode = Schema.AccessMode.READ_ONLY ) public Set getUserGroups() { return userGroups; @@ -50,9 +49,8 @@ public class UserDTO extends TenantDTO { /** * @return policies this user is part of */ - @ApiModelProperty( - value = "The access policies this user belongs to.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The access policies this user belongs to.", + accessMode = Schema.AccessMode.READ_ONLY ) public Set getAccessPolicies() { return accessPolicies; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java index b5a556b319..2cffd46a2e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.AccessPolicyEntity; import org.apache.nifi.web.api.entity.TenantEntity; @@ -35,7 +35,7 @@ public class UserGroupDTO extends TenantDTO { /** * @return users in this group */ - @ApiModelProperty(value = "The users that belong to the user group.") + @Schema(description = "The users that belong to the user group.") public Set getUsers() { return users; } @@ -47,11 +47,10 @@ public class UserGroupDTO extends TenantDTO { /** * @return policies this user group is part of */ - @ApiModelProperty( - value = "The access policies this user group belongs to. This field was incorrectly defined as an AccessPolicyEntity. For " + @Schema(description = "The access policies this user group belongs to. This field was incorrectly defined as an AccessPolicyEntity. For " + "compatibility reasons the field will remain of this type, however only the fields that are present in the " + "AccessPolicySummaryEntity will be populated here.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + accessMode = Schema.AccessMode.READ_ONLY ) public Set getAccessPolicies() { return accessPolicies; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VerifyConfigRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VerifyConfigRequestDTO.java index 059af1b5bf..966964943b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VerifyConfigRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VerifyConfigRequestDTO.java @@ -17,8 +17,8 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiModelProperty.AccessMode; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema.AccessMode; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -31,7 +31,7 @@ public class VerifyConfigRequestDTO extends AsynchronousRequestDTO attributes; private List results; - @ApiModelProperty("The ID of the component whose configuration was verified") + @Schema(description = "The ID of the component whose configuration was verified") public String getComponentId() { return componentId; } @@ -40,7 +40,7 @@ public class VerifyConfigRequestDTO extends AsynchronousRequestDTO getProperties() { return properties; } @@ -49,7 +49,7 @@ public class VerifyConfigRequestDTO extends AsynchronousRequestDTO getAttributes() { return attributes; } @@ -58,7 +58,7 @@ public class VerifyConfigRequestDTO extends AsynchronousRequestDTO getResults() { return results; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionControlInformationDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionControlInformationDTO.java index 1a80ebc0f5..6648983374 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionControlInformationDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionControlInformationDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -43,7 +43,7 @@ public class VersionControlInformationDTO { private String state; private String stateExplanation; - @ApiModelProperty("The ID of the Process Group that is under version control") + @Schema(description = "The ID of the Process Group that is under version control") public String getGroupId() { return groupId; } @@ -52,7 +52,7 @@ public class VersionControlInformationDTO { this.groupId = groupId; } - @ApiModelProperty("The ID of the registry that the flow is stored in") + @Schema(description = "The ID of the registry that the flow is stored in") public String getRegistryId() { return registryId; } @@ -61,7 +61,7 @@ public class VersionControlInformationDTO { this.registryId = registryId; } - @ApiModelProperty(value = "The name of the registry that the flow is stored in", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The name of the registry that the flow is stored in", accessMode = Schema.AccessMode.READ_ONLY) public String getRegistryName() { return registryName; } @@ -70,7 +70,7 @@ public class VersionControlInformationDTO { this.registryName = registryName; } - @ApiModelProperty("The ID of the bucket that the flow is stored in") + @Schema(description = "The ID of the bucket that the flow is stored in") public String getBucketId() { return bucketId; } @@ -79,7 +79,7 @@ public class VersionControlInformationDTO { this.bucketId = bucketId; } - @ApiModelProperty(value = "The name of the bucket that the flow is stored in", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The name of the bucket that the flow is stored in", accessMode = Schema.AccessMode.READ_ONLY) public String getBucketName() { return bucketName; } @@ -88,7 +88,7 @@ public class VersionControlInformationDTO { this.bucketName = bucketName; } - @ApiModelProperty("The ID of the flow") + @Schema(description = "The ID of the flow") public String getFlowId() { return flowId; } @@ -97,7 +97,7 @@ public class VersionControlInformationDTO { this.flowId = flowId; } - @ApiModelProperty("The name of the flow") + @Schema(description = "The name of the flow") public String getFlowName() { return flowName; } @@ -106,7 +106,7 @@ public class VersionControlInformationDTO { this.flowName = flowName; } - @ApiModelProperty("The description of the flow") + @Schema(description = "The description of the flow") public String getFlowDescription() { return flowDescription; } @@ -115,7 +115,7 @@ public class VersionControlInformationDTO { this.flowDescription = flowDescription; } - @ApiModelProperty("The version of the flow") + @Schema(description = "The version of the flow") public Integer getVersion() { return version; } @@ -124,7 +124,7 @@ public class VersionControlInformationDTO { this.version = version; } - @ApiModelProperty("The storage location") + @Schema(description = "The storage location") public String getStorageLocation() { return storageLocation; } @@ -133,8 +133,8 @@ public class VersionControlInformationDTO { this.storageLocation = storageLocation; } - @ApiModelProperty(accessMode = ApiModelProperty.AccessMode.READ_ONLY, - value = "The current state of the Process Group, as it relates to the Versioned Flow", + @Schema(accessMode = Schema.AccessMode.READ_ONLY, + description = "The current state of the Process Group, as it relates to the Versioned Flow", allowableValues = LOCALLY_MODIFIED + ", " + STALE + ", " + LOCALLY_MODIFIED_AND_STALE + ", " + UP_TO_DATE + ", " + SYNC_FAILURE) public String getState() { return state; @@ -144,7 +144,7 @@ public class VersionControlInformationDTO { this.state = state; } - @ApiModelProperty(accessMode = ApiModelProperty.AccessMode.READ_ONLY, value = "Explanation of why the group is in the specified state") + @Schema(description = "Explanation of why the group is in the specified state", accessMode = Schema.AccessMode.READ_ONLY) public String getStateExplanation() { return stateExplanation; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowDTO.java index 8239de24a2..68761a1356 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,7 +34,7 @@ public class VersionedFlowDTO { private String comments; private String action; - @ApiModelProperty("The ID of the registry that the flow is tracked to") + @Schema(description = "The ID of the registry that the flow is tracked to") public String getRegistryId() { return registryId; } @@ -43,7 +43,7 @@ public class VersionedFlowDTO { this.registryId = registryId; } - @ApiModelProperty("The ID of the bucket where the flow is stored") + @Schema(description = "The ID of the bucket where the flow is stored") public String getBucketId() { return bucketId; } @@ -52,7 +52,7 @@ public class VersionedFlowDTO { this.bucketId = bucketId; } - @ApiModelProperty(value = "The ID of the flow") + @Schema(description = "The ID of the flow") public String getFlowId() { return flowId; } @@ -61,7 +61,7 @@ public class VersionedFlowDTO { this.flowId = flowId; } - @ApiModelProperty("The name of the flow") + @Schema(description = "The name of the flow") public String getFlowName() { return flowName; } @@ -70,7 +70,7 @@ public class VersionedFlowDTO { this.flowName = flowName; } - @ApiModelProperty("A description of the flow") + @Schema(description = "A description of the flow") public String getDescription() { return description; } @@ -79,7 +79,7 @@ public class VersionedFlowDTO { this.description = description; } - @ApiModelProperty("Comments for the changeset") + @Schema(description = "Comments for the changeset") public String getComments() { return comments; } @@ -88,7 +88,7 @@ public class VersionedFlowDTO { this.comments = comments; } - @ApiModelProperty(value = "The action being performed", allowableValues = COMMIT_ACTION + ", " + FORCE_COMMIT_ACTION) + @Schema(description = "The action being performed", allowableValues = COMMIT_ACTION + ", " + FORCE_COMMIT_ACTION) public String getAction() { return action; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java index 08b6bc594c..62c9b91b9b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -25,8 +25,8 @@ import jakarta.xml.bind.annotation.XmlType; public class VersionedFlowUpdateRequestDTO extends FlowUpdateRequestDTO { private VersionControlInformationDTO versionControlInformation; - @ApiModelProperty(value = "The VersionControlInformation that describes where the Versioned Flow is located; this may not be populated until the request is completed.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The VersionControlInformation that describes where the Versioned Flow is located; this may not be populated until the request is completed.", + accessMode = Schema.AccessMode.READ_ONLY) public VersionControlInformationDTO getVersionControlInformation() { return versionControlInformation; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/WritablePermission.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/WritablePermission.java index 17e3f7b65b..459bff30e5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/WritablePermission.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/WritablePermission.java @@ -16,12 +16,11 @@ */ package org.apache.nifi.web.api.dto; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public interface WritablePermission { - @ApiModelProperty( - value = "Indicates whether the user can write a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "Indicates whether the user can write a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) Boolean getCanWrite(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java index 4ce9d547a7..b2a2703774 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.action.component.details.ComponentDetailsDTO; import org.apache.nifi.web.api.dto.action.details.ActionDetailsDTO; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; @@ -46,8 +46,7 @@ public class ActionDTO { /** * @return action id */ - @ApiModelProperty( - value = "The action id." + @Schema(description = "The action id." ) public Integer getId() { return id; @@ -60,8 +59,7 @@ public class ActionDTO { /** * @return user identity who perform this action */ - @ApiModelProperty( - value = "The identity of the user that performed the action." + @Schema(description = "The identity of the user that performed the action." ) public String getUserIdentity() { return userIdentity; @@ -75,9 +73,8 @@ public class ActionDTO { * @return action's timestamp */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The timestamp of the action.", - dataType = "string" + @Schema(description = "The timestamp of the action.", + type = "string" ) public Date getTimestamp() { return timestamp; @@ -90,8 +87,7 @@ public class ActionDTO { /** * @return id of the source component of this action */ - @ApiModelProperty( - value = "The id of the source component." + @Schema(description = "The id of the source component." ) public String getSourceId() { return sourceId; @@ -104,8 +100,7 @@ public class ActionDTO { /** * @return name of the source component of this action */ - @ApiModelProperty( - value = "The name of the source component." + @Schema(description = "The name of the source component." ) public String getSourceName() { return sourceName; @@ -118,8 +113,7 @@ public class ActionDTO { /** * @return type of the source component of this action */ - @ApiModelProperty( - value = "The type of the source component." + @Schema(description = "The type of the source component." ) public String getSourceType() { return sourceType; @@ -132,8 +126,7 @@ public class ActionDTO { /** * @return component details (if any) for this action */ - @ApiModelProperty( - value = "The details of the source component." + @Schema(description = "The details of the source component." ) public ComponentDetailsDTO getComponentDetails() { return componentDetails; @@ -146,8 +139,7 @@ public class ActionDTO { /** * @return operation being performed in this action */ - @ApiModelProperty( - value = "The operation that was performed." + @Schema(description = "The operation that was performed." ) public String getOperation() { return operation; @@ -160,8 +152,7 @@ public class ActionDTO { /** * @return action details (if any) for this action */ - @ApiModelProperty( - value = "The details of the action." + @Schema(description = "The details of the action." ) public ActionDetailsDTO getActionDetails() { return actionDetails; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java index a33ac788d4..f67b56b511 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import org.apache.nifi.web.api.entity.ActionEntity; @@ -38,8 +38,7 @@ public class HistoryDTO { /** * @return total number of actions */ - @ApiModelProperty( - value = "The number of number of actions that matched the search criteria.." + @Schema(description = "The number of number of actions that matched the search criteria.." ) public Integer getTotal() { return total; @@ -53,9 +52,8 @@ public class HistoryDTO { * @return timestamp when these records were returned */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The timestamp when the report was generated.", - dataType = "string" + @Schema(description = "The timestamp when the report was generated.", + type = "string" ) public Date getLastRefreshed() { return lastRefreshed; @@ -68,8 +66,7 @@ public class HistoryDTO { /** * @return actions for this range */ - @ApiModelProperty( - value = "The actions." + @Schema(description = "The actions." ) public Collection getActions() { return actions; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java index 5a74916b56..3e0c7c2881 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -41,8 +41,7 @@ public class HistoryQueryDTO { /** * @return user identity */ - @ApiModelProperty( - value = "The user identity." + @Schema(description = "The user identity." ) public String getUserIdentity() { return userIdentity; @@ -55,8 +54,7 @@ public class HistoryQueryDTO { /** * @return source component id */ - @ApiModelProperty( - value = "The id of the source component." + @Schema(description = "The id of the source component." ) public String getSourceId() { return sourceId; @@ -70,9 +68,8 @@ public class HistoryQueryDTO { * @return start date */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The start date of actions to return.", - dataType = "string" + @Schema(description = "The start date of actions to return.", + type = "string" ) public Date getStartDate() { return startDate; @@ -86,9 +83,8 @@ public class HistoryQueryDTO { * @return end date */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The end date of actions to return.", - dataType = "string" + @Schema(description = "The end date of actions to return.", + type = "string" ) public Date getEndDate() { return endDate; @@ -101,8 +97,7 @@ public class HistoryQueryDTO { /** * @return offset */ - @ApiModelProperty( - value = "The offset into the result set." + @Schema(description = "The offset into the result set." ) public Integer getOffset() { return offset; @@ -115,8 +110,7 @@ public class HistoryQueryDTO { /** * @return desired row count */ - @ApiModelProperty( - value = "The number of actions to return." + @Schema(description = "The number of actions to return." ) public Integer getCount() { return count; @@ -129,8 +123,7 @@ public class HistoryQueryDTO { /** * @return desired sort column */ - @ApiModelProperty( - value = "The field to sort on." + @Schema(description = "The field to sort on." ) public String getSortColumn() { return sortColumn; @@ -143,8 +136,7 @@ public class HistoryQueryDTO { /** * @return desired sort order */ - @ApiModelProperty( - value = "The sort order." + @Schema(description = "The sort order." ) public String getSortOrder() { return sortOrder; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java index 42272fb320..dd4f4a9dae 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action.component.details; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,8 +31,7 @@ public class ExtensionDetailsDTO extends ComponentDetailsDTO { /** * @return extension type */ - @ApiModelProperty( - value = "The fully qualified type of extension." + @Schema(description = "The fully qualified type of extension." ) public String getType() { return type; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java index d0384e0826..35b9a219c0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action.component.details; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,8 +31,7 @@ public class RemoteProcessGroupDetailsDTO extends ComponentDetailsDTO { /** * @return URI of the remote process group */ - @ApiModelProperty( - value = "The uri of the target of the remote process group." + @Schema(description = "The uri of the target of the remote process group." ) public String getUri() { return uri; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java index 10c1c651f8..a9f5349023 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action.details; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class ConfigureDetailsDTO extends ActionDetailsDTO { /** * @return name of the property that was modified */ - @ApiModelProperty( - value = "The name of the property that was modified." + @Schema(description = "The name of the property that was modified." ) public String getName() { return name; @@ -47,8 +46,7 @@ public class ConfigureDetailsDTO extends ActionDetailsDTO { /** * @return previous value */ - @ApiModelProperty( - value = "The previous value." + @Schema(description = "The previous value." ) public String getPreviousValue() { return previousValue; @@ -61,8 +59,7 @@ public class ConfigureDetailsDTO extends ActionDetailsDTO { /** * @return new value */ - @ApiModelProperty( - value = "The new value." + @Schema(description = "The new value." ) public String getValue() { return value; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java index 09325ef077..49060e8e69 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action.details; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -37,8 +37,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return id of the source of the connection */ - @ApiModelProperty( - value = "The id of the source of the connection." + @Schema(description = "The id of the source of the connection." ) public String getSourceId() { return sourceId; @@ -51,8 +50,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return name of the source of the connection */ - @ApiModelProperty( - value = "The name of the source of the connection." + @Schema(description = "The name of the source of the connection." ) public String getSourceName() { return sourceName; @@ -65,8 +63,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return type of the source of the connection */ - @ApiModelProperty( - value = "The type of the source of the connection." + @Schema(description = "The type of the source of the connection." ) public String getSourceType() { return sourceType; @@ -79,8 +76,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return name of the relationship that was connected */ - @ApiModelProperty( - value = "The name of the relationship that was connected." + @Schema(description = "The name of the relationship that was connected." ) public String getRelationship() { return relationship; @@ -93,8 +89,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return id of the destination of the connection */ - @ApiModelProperty( - value = "The id of the destination of the connection." + @Schema(description = "The id of the destination of the connection." ) public String getDestinationId() { return destinationId; @@ -107,8 +102,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return name of the destination of the connection */ - @ApiModelProperty( - value = "The name of the destination of the connection." + @Schema(description = "The name of the destination of the connection." ) public String getDestinationName() { return destinationName; @@ -121,8 +115,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { /** * @return type of the destination of the connection */ - @ApiModelProperty( - value = "The type of the destination of the connection." + @Schema(description = "The type of the destination of the connection." ) public String getDestinationType() { return destinationType; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java index 9100955feb..e48ae84ad8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action.details; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,8 +34,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { /** * @return id of the group the components previously belonged to */ - @ApiModelProperty( - value = "The id of the group the components previously belonged to." + @Schema(description = "The id of the group the components previously belonged to." ) public String getPreviousGroupId() { return previousGroupId; @@ -48,8 +47,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { /** * @return name of the group of the components previously belonged to */ - @ApiModelProperty( - value = "The name of the group the components previously belonged to." + @Schema(description = "The name of the group the components previously belonged to." ) public String getPreviousGroup() { return previousGroup; @@ -62,8 +60,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { /** * @return id of the group the components belong to */ - @ApiModelProperty( - value = "The id of the group that components belong to." + @Schema(description = "The id of the group that components belong to." ) public String getGroupId() { return groupId; @@ -76,8 +73,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { /** * @return name of the group the components belong to */ - @ApiModelProperty( - value = "The name of the group the components belong to." + @Schema(description = "The name of the group the components belong to." ) public String getGroup() { return group; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java index f592dc0be6..3cbd8bb2dd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.action.details; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -35,9 +35,8 @@ public class PurgeDetailsDTO extends ActionDetailsDTO { * @return end date for this purge action */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The end date for the purge action.", - dataType = "string" + @Schema(description = "The end date for the purge action.", + type = "string" ) public Date getEndDate() { return endDate; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ClassLoaderDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ClassLoaderDiagnosticsDTO.java index 7594cde001..97117cebf8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ClassLoaderDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ClassLoaderDiagnosticsDTO.java @@ -21,14 +21,14 @@ import jakarta.xml.bind.annotation.XmlType; import org.apache.nifi.web.api.dto.BundleDTO; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "classLoaderDiagnostics") public class ClassLoaderDiagnosticsDTO { private BundleDTO bundle; private ClassLoaderDiagnosticsDTO parentClassLoader; - @ApiModelProperty("Information about the Bundle that the ClassLoader belongs to, if any") + @Schema(description = "Information about the Bundle that the ClassLoader belongs to, if any") public BundleDTO getBundle() { return bundle; } @@ -37,7 +37,7 @@ public class ClassLoaderDiagnosticsDTO { this.bundle = bundle; } - @ApiModelProperty("A ClassLoaderDiagnosticsDTO that provides information about the parent ClassLoader") + @Schema(description = "A ClassLoaderDiagnosticsDTO that provides information about the parent ClassLoader") public ClassLoaderDiagnosticsDTO getParentClassLoader() { return parentClassLoader; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsDTO.java index 319cd34eed..8e67071441 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.diagnostics; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ConnectionDTO; import jakarta.xml.bind.annotation.XmlType; @@ -28,7 +28,7 @@ public class ConnectionDiagnosticsDTO { private ConnectionDiagnosticsSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty(value = "Details about the connection", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Details about the connection", accessMode = Schema.AccessMode.READ_ONLY) public ConnectionDTO getConnection() { return connection; } @@ -37,8 +37,8 @@ public class ConnectionDiagnosticsDTO { this.connection = connection; } - @ApiModelProperty(value = "Aggregate values for all nodes in the cluster, or for this instance if not clustered", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Aggregate values for all nodes in the cluster, or for this instance if not clustered", + accessMode = Schema.AccessMode.READ_ONLY) public ConnectionDiagnosticsSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; } @@ -47,7 +47,7 @@ public class ConnectionDiagnosticsDTO { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty(value = "A list of values for each node in the cluster, if clustered.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "A list of values for each node in the cluster, if clustered.", accessMode = Schema.AccessMode.READ_ONLY) public List getNodeSnapshots() { return nodeSnapshots; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsSnapshotDTO.java index 1875138cd1..8938b20d41 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ConnectionDiagnosticsSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.diagnostics; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -30,7 +30,7 @@ public class ConnectionDiagnosticsSnapshotDTO { private LocalQueuePartitionDTO localQueuePartition; private List remoteQueuePartitions; - @ApiModelProperty("Total number of FlowFiles owned by the Connection") + @Schema(description = "Total number of FlowFiles owned by the Connection") public int getTotalFlowFileCount() { return totalFlowFileCount; } @@ -39,7 +39,7 @@ public class ConnectionDiagnosticsSnapshotDTO { this.totalFlowFileCount = totalFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles owned by this Connection") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles owned by this Connection") public long getTotalByteCount() { return totalByteCount; } @@ -48,7 +48,7 @@ public class ConnectionDiagnosticsSnapshotDTO { this.totalByteCount = totalByteCount; } - @ApiModelProperty("The Node Identifier that this information pertains to") + @Schema(description = "The Node Identifier that this information pertains to") public String getNodeIdentifier() { return nodeIdentifier; } @@ -57,7 +57,7 @@ public class ConnectionDiagnosticsSnapshotDTO { this.nodeIdentifier = nodeIdentifier; } - @ApiModelProperty("The local queue partition, from which components can pull FlowFiles on this node.") + @Schema(description = "The local queue partition, from which components can pull FlowFiles on this node.") public LocalQueuePartitionDTO getLocalQueuePartition() { return localQueuePartition; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ControllerServiceDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ControllerServiceDiagnosticsDTO.java index 7741489d67..a795f644ff 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ControllerServiceDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ControllerServiceDiagnosticsDTO.java @@ -21,7 +21,7 @@ import jakarta.xml.bind.annotation.XmlType; import org.apache.nifi.web.api.entity.ControllerServiceEntity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "controllerServiceDiagnostics") public class ControllerServiceDiagnosticsDTO { @@ -32,7 +32,7 @@ public class ControllerServiceDiagnosticsDTO { this.controllerService = controllerService; } - @ApiModelProperty("The Controller Service") + @Schema(description = "The Controller Service") public ControllerServiceEntity getControllerService() { return controllerService; } @@ -41,7 +41,7 @@ public class ControllerServiceDiagnosticsDTO { this.classLoaderDiagnostics = classLoaderDiagnostics; } - @ApiModelProperty("Information about the Controller Service's Class Loader") + @Schema(description = "Information about the Controller Service's Class Loader") public ClassLoaderDiagnosticsDTO getClassLoaderDiagnostics() { return classLoaderDiagnostics; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GCDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GCDiagnosticsSnapshotDTO.java index 15c598a776..c9d40886ae 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GCDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GCDiagnosticsSnapshotDTO.java @@ -21,7 +21,7 @@ import java.util.Date; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "gcDiagnosticsSnapshot") public class GCDiagnosticsSnapshotDTO implements Cloneable { @@ -29,7 +29,7 @@ public class GCDiagnosticsSnapshotDTO implements Cloneable { private Long collectionCount; private Long collectionMillis; - @ApiModelProperty("The timestamp of when the Snapshot was taken") + @Schema(description = "The timestamp of when the Snapshot was taken") public Date getTimestamp() { return timestamp; } @@ -38,7 +38,7 @@ public class GCDiagnosticsSnapshotDTO implements Cloneable { this.timestamp = timestamp; } - @ApiModelProperty("The number of times that Garbage Collection has occurred") + @Schema(description = "The number of times that Garbage Collection has occurred") public Long getCollectionCount() { return collectionCount; } @@ -47,7 +47,7 @@ public class GCDiagnosticsSnapshotDTO implements Cloneable { this.collectionCount = collectionCount; } - @ApiModelProperty("The number of milliseconds that the Garbage Collector spent performing Garbage Collection duties") + @Schema(description = "The number of milliseconds that the Garbage Collector spent performing Garbage Collection duties") public Long getCollectionMillis() { return collectionMillis; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GarbageCollectionDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GarbageCollectionDiagnosticsDTO.java index eb02c508c2..16da751f57 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GarbageCollectionDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/GarbageCollectionDiagnosticsDTO.java @@ -22,14 +22,14 @@ import java.util.stream.Collectors; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "garbageCollectionDiagnostics") public class GarbageCollectionDiagnosticsDTO implements Cloneable { private String memoryManagerName; private List snapshots; - @ApiModelProperty("The name of the Memory Manager that this Garbage Collection information pertains to") + @Schema(description = "The name of the Memory Manager that this Garbage Collection information pertains to") public String getMemoryManagerName() { return memoryManagerName; } @@ -38,7 +38,7 @@ public class GarbageCollectionDiagnosticsDTO implements Cloneable { this.memoryManagerName = memoryManagerName; } - @ApiModelProperty("A list of snapshots that have been taken to determine the health of the JVM's heap") + @Schema(description = "A list of snapshots that have been taken to determine the health of the JVM's heap") public List getSnapshots() { return snapshots; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMControllerDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMControllerDiagnosticsSnapshotDTO.java index 3c58665b1e..2444c83679 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMControllerDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMControllerDiagnosticsSnapshotDTO.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.dto.diagnostics; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "jvmControllerDiagnosticsSnapshot") public class JVMControllerDiagnosticsSnapshotDTO implements Cloneable { @@ -27,7 +27,7 @@ public class JVMControllerDiagnosticsSnapshotDTO implements Cloneable { private Boolean clusterCoordinator; private Integer maxTimerDrivenThreads; - @ApiModelProperty("Whether or not this node is primary node") + @Schema(description = "Whether or not this node is primary node") public Boolean getPrimaryNode() { return primaryNode; } @@ -36,7 +36,7 @@ public class JVMControllerDiagnosticsSnapshotDTO implements Cloneable { this.primaryNode = primaryNode; } - @ApiModelProperty("Whether or not this node is cluster coordinator") + @Schema(description = "Whether or not this node is cluster coordinator") public Boolean getClusterCoordinator() { return clusterCoordinator; } @@ -45,7 +45,7 @@ public class JVMControllerDiagnosticsSnapshotDTO implements Cloneable { this.clusterCoordinator = clusterCoordinator; } - @ApiModelProperty("The maximum number of timer-driven threads") + @Schema(description = "The maximum number of timer-driven threads") public Integer getMaxTimerDrivenThreads() { return maxTimerDrivenThreads; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsDTO.java index 1396c49885..64af811483 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsDTO.java @@ -21,7 +21,7 @@ import java.util.List; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "jvmDiagnostics") public class JVMDiagnosticsDTO { @@ -30,7 +30,7 @@ public class JVMDiagnosticsDTO { private JVMDiagnosticsSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty("Whether or not the NiFi instance is clustered") + @Schema(description = "Whether or not the NiFi instance is clustered") public Boolean getClustered() { return clustered; } @@ -39,7 +39,7 @@ public class JVMDiagnosticsDTO { this.clustered = clustered; } - @ApiModelProperty("Whether or not the node is connected to the cluster") + @Schema(description = "Whether or not the node is connected to the cluster") public Boolean getConnected() { return connected; } @@ -48,7 +48,7 @@ public class JVMDiagnosticsDTO { this.connected = connected; } - @ApiModelProperty("Aggregate JVM diagnostic information about the entire cluster") + @Schema(description = "Aggregate JVM diagnostic information about the entire cluster") public JVMDiagnosticsSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; } @@ -57,7 +57,7 @@ public class JVMDiagnosticsDTO { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("Node-wise breakdown of JVM diagnostic information") + @Schema(description = "Node-wise breakdown of JVM diagnostic information") public List getNodeSnapshots() { return nodeSnapshots; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsSnapshotDTO.java index c0c1c2359d..365502bfa4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMDiagnosticsSnapshotDTO.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.dto.diagnostics; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "jvmDiagnosticsSnapshot") public class JVMDiagnosticsSnapshotDTO implements Cloneable { @@ -27,7 +27,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { private JVMFlowDiagnosticsSnapshotDTO flowDiagnosticsDto; private JVMControllerDiagnosticsSnapshotDTO controllerDiagnosticsDto; - @ApiModelProperty("System-related diagnostics information") + @Schema(description = "System-related diagnostics information") public JVMSystemDiagnosticsSnapshotDTO getSystemDiagnosticsDto() { return systemDiagnosticsDto; } @@ -36,7 +36,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.systemDiagnosticsDto = systemDiagnosticsDto; } - @ApiModelProperty("Flow-related diagnostics information") + @Schema(description = "Flow-related diagnostics information") public JVMFlowDiagnosticsSnapshotDTO getFlowDiagnosticsDto() { return flowDiagnosticsDto; } @@ -45,7 +45,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.flowDiagnosticsDto = flowDiagnosticsDto; } - @ApiModelProperty("Controller-related diagnostics information") + @Schema(description = "Controller-related diagnostics information") public JVMControllerDiagnosticsSnapshotDTO getControllerDiagnostics() { return controllerDiagnosticsDto; } @@ -78,7 +78,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { private String osVersion; private String osArchitecture; - @ApiModelProperty("The version of this NiFi.") + @Schema(description = "The version of this NiFi.") public String getNiFiVersion() { return niFiVersion; } @@ -87,7 +87,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.niFiVersion = niFiVersion; } - @ApiModelProperty("Java vendor") + @Schema(description = "Java vendor") public String getJavaVendor() { return javaVendor; } @@ -96,7 +96,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.javaVendor = javaVendor; } - @ApiModelProperty("Java VM Vendor") + @Schema(description = "Java VM Vendor") public String getJavaVmVendor() { return javaVmVendor; } @@ -105,7 +105,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.javaVmVendor = javaVmVendor; } - @ApiModelProperty("Java version") + @Schema(description = "Java version") public String getJavaVersion() { return javaVersion; } @@ -114,7 +114,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.javaVersion = javaVersion; } - @ApiModelProperty("Host operating system name") + @Schema(description = "Host operating system name") public String getOsName() { return osName; } @@ -123,7 +123,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.osName = osName; } - @ApiModelProperty("Host operating system version") + @Schema(description = "Host operating system version") public String getOsVersion() { return osVersion; } @@ -132,7 +132,7 @@ public class JVMDiagnosticsSnapshotDTO implements Cloneable { this.osVersion = osVersion; } - @ApiModelProperty("Host operating system architecture") + @Schema(description = "Host operating system architecture") public String getOsArchitecture() { return osArchitecture; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMFlowDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMFlowDiagnosticsSnapshotDTO.java index d7025d0a8b..c3f1d074f5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMFlowDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMFlowDiagnosticsSnapshotDTO.java @@ -24,7 +24,7 @@ import jakarta.xml.bind.annotation.XmlType; import org.apache.nifi.web.api.dto.BundleDTO; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "jvmFlowDiagnosticsSnapshot") public class JVMFlowDiagnosticsSnapshotDTO implements Cloneable { @@ -33,7 +33,7 @@ public class JVMFlowDiagnosticsSnapshotDTO implements Cloneable { private Integer activeTimerDrivenThreads; private Set bundlesLoaded; - @ApiModelProperty("How long this node has been running, formatted as hours:minutes:seconds.milliseconds") + @Schema(description = "How long this node has been running, formatted as hours:minutes:seconds.milliseconds") public String getUptime() { return uptime; } @@ -42,7 +42,7 @@ public class JVMFlowDiagnosticsSnapshotDTO implements Cloneable { this.uptime = uptime; } - @ApiModelProperty("The name of the Time Zone that is configured, if available") + @Schema(description = "The name of the Time Zone that is configured, if available") public String getTimeZone() { return timeZone; } @@ -52,7 +52,7 @@ public class JVMFlowDiagnosticsSnapshotDTO implements Cloneable { } - @ApiModelProperty("The number of timer-driven threads that are active") + @Schema(description = "The number of timer-driven threads that are active") public Integer getActiveTimerDrivenThreads() { return activeTimerDrivenThreads; } @@ -61,7 +61,7 @@ public class JVMFlowDiagnosticsSnapshotDTO implements Cloneable { this.activeTimerDrivenThreads = activeTimerDrivenThreads; } - @ApiModelProperty("The NiFi Bundles (NARs) that are loaded by NiFi") + @Schema(description = "The NiFi Bundles (NARs) that are loaded by NiFi") public Set getBundlesLoaded() { return bundlesLoaded; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMSystemDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMSystemDiagnosticsSnapshotDTO.java index 85a9781c5b..26ec2ca667 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMSystemDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/JVMSystemDiagnosticsSnapshotDTO.java @@ -23,7 +23,7 @@ import java.util.stream.Collectors; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "jvmSystemDiagnosticsSnapshot") public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { @@ -45,7 +45,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { private Long maxOpenFileDescriptors; - @ApiModelProperty("Information about the FlowFile Repository's usage") + @Schema(description = "Information about the FlowFile Repository's usage") public RepositoryUsageDTO getFlowFileRepositoryStorageUsage() { return flowFileRepositoryStorageUsage; } @@ -54,7 +54,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.flowFileRepositoryStorageUsage = flowFileRepositoryStorageUsage; } - @ApiModelProperty("Information about the Content Repository's usage") + @Schema(description = "Information about the Content Repository's usage") public Set getContentRepositoryStorageUsage() { return contentRepositoryStorageUsage; } @@ -63,7 +63,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.contentRepositoryStorageUsage = contentRepositoryStorageUsage; } - @ApiModelProperty("Information about the Provenance Repository's usage") + @Schema(description = "Information about the Provenance Repository's usage") public Set getProvenanceRepositoryStorageUsage() { return provenanceRepositoryStorageUsage; } @@ -72,7 +72,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.provenanceRepositoryStorageUsage = provenanceRepositoryStorageUsage; } - @ApiModelProperty("The maximum number of bytes that the JVM heap is configured to use for heap") + @Schema(description = "The maximum number of bytes that the JVM heap is configured to use for heap") public Long getMaxHeapBytes() { return maxHeapBytes; } @@ -81,7 +81,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.maxHeapBytes = heapBytes; } - @ApiModelProperty("The maximum number of bytes that the JVM heap is configured to use, as a human-readable value") + @Schema(description = "The maximum number of bytes that the JVM heap is configured to use, as a human-readable value") public String getMaxHeap() { return maxHeap; } @@ -90,7 +90,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.maxHeap = maxHeap; } - @ApiModelProperty("The number of CPU Cores available on the system") + @Schema(description = "The number of CPU Cores available on the system") public Integer getCpuCores() { return cpuCores; } @@ -99,7 +99,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.cpuCores = cpuCores; } - @ApiModelProperty("The 1-minute CPU Load Average") + @Schema(description = "The 1-minute CPU Load Average") public Double getCpuLoadAverage() { return cpuLoadAverage; } @@ -108,7 +108,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.cpuLoadAverage = cpuLoadAverage; } - @ApiModelProperty("The number of bytes of RAM available on the system") + @Schema(description = "The number of bytes of RAM available on the system") public Long getPhysicalMemoryBytes() { return physicalMemoryBytes; } @@ -117,7 +117,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.physicalMemoryBytes = memoryBytes; } - @ApiModelProperty("The number of bytes of RAM available on the system as a human-readable value") + @Schema(description = "The number of bytes of RAM available on the system as a human-readable value") public String getPhysicalMemory() { return physicalMemory; } @@ -126,7 +126,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.physicalMemory = memory; } - @ApiModelProperty("The number of files that are open by the NiFi process") + @Schema(description = "The number of files that are open by the NiFi process") public Long getOpenFileDescriptors() { return openFileDescriptors; } @@ -135,7 +135,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.openFileDescriptors = openFileDescriptors; } - @ApiModelProperty("The maximum number of open file descriptors that are available to each process") + @Schema(description = "The maximum number of open file descriptors that are available to each process") public Long getMaxOpenFileDescriptors() { return maxOpenFileDescriptors; } @@ -144,7 +144,7 @@ public class JVMSystemDiagnosticsSnapshotDTO implements Cloneable { this.maxOpenFileDescriptors = maxOpenFileDescriptors; } - @ApiModelProperty("Diagnostic information about the JVM's garbage collections") + @Schema(description = "Diagnostic information about the JVM's garbage collections") public List getGarbageCollectionDiagnostics() { return garbageCollectionDiagnostics; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/LocalQueuePartitionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/LocalQueuePartitionDTO.java index 65a668a299..cac5857227 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/LocalQueuePartitionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/LocalQueuePartitionDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.diagnostics; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -35,7 +35,7 @@ public class LocalQueuePartitionDTO { private Boolean allActiveQueueFlowFilesPenalized; private Boolean anyActiveQueueFlowFilesPenalized; - @ApiModelProperty("Total number of FlowFiles owned by the Connection") + @Schema(description = "Total number of FlowFiles owned by the Connection") public int getTotalFlowFileCount() { return totalFlowFileCount; } @@ -44,7 +44,7 @@ public class LocalQueuePartitionDTO { this.totalFlowFileCount = totalFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles owned by this Connection") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles owned by this Connection") public long getTotalByteCount() { return totalByteCount; } @@ -53,7 +53,7 @@ public class LocalQueuePartitionDTO { this.totalByteCount = totalByteCount; } - @ApiModelProperty("Total number of FlowFiles that exist in the Connection's Active Queue, immediately available to be offered up to a component") + @Schema(description = "Total number of FlowFiles that exist in the Connection's Active Queue, immediately available to be offered up to a component") public int getActiveQueueFlowFileCount() { return activeQueueFlowFileCount; } @@ -62,7 +62,7 @@ public class LocalQueuePartitionDTO { this.activeQueueFlowFileCount = activeQueueFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles that are present in the Connection's Active Queue") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles that are present in the Connection's Active Queue") public long getActiveQueueByteCount() { return activeQueueByteCount; } @@ -71,7 +71,7 @@ public class LocalQueuePartitionDTO { this.activeQueueByteCount = activeQueueByteCount; } - @ApiModelProperty("The total number of FlowFiles that are swapped out for this Connection") + @Schema(description = "The total number of FlowFiles that are swapped out for this Connection") public int getSwapFlowFileCount() { return swapFlowFileCount; } @@ -80,7 +80,7 @@ public class LocalQueuePartitionDTO { this.swapFlowFileCount = swapFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles that are swapped out to disk for the Connection") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles that are swapped out to disk for the Connection") public long getSwapByteCount() { return swapByteCount; } @@ -89,7 +89,7 @@ public class LocalQueuePartitionDTO { this.swapByteCount = swapByteCount; } - @ApiModelProperty("The number of Swap Files that exist for this Connection") + @Schema(description = "The number of Swap Files that exist for this Connection") public int getSwapFiles() { return swapFiles; } @@ -98,7 +98,7 @@ public class LocalQueuePartitionDTO { this.swapFiles = swapFiles; } - @ApiModelProperty("The number of In-Flight FlowFiles for this Connection. These are FlowFiles that belong to the connection but are currently being operated on by a Processor, Port, etc.") + @Schema(description = "The number of In-Flight FlowFiles for this Connection. These are FlowFiles that belong to the connection but are currently being operated on by a Processor, Port, etc.") public int getInFlightFlowFileCount() { return inFlightFlowFileCount; } @@ -107,7 +107,7 @@ public class LocalQueuePartitionDTO { this.inFlightFlowFileCount = inFlightFlowFileCount; } - @ApiModelProperty("The number bytes that make up the content of the FlowFiles that are In-Flight") + @Schema(description = "The number bytes that make up the content of the FlowFiles that are In-Flight") public long getInFlightByteCount() { return inFlightByteCount; } @@ -116,7 +116,7 @@ public class LocalQueuePartitionDTO { this.inFlightByteCount = inFlightByteCount; } - @ApiModelProperty("Whether or not all of the FlowFiles in the Active Queue are penalized") + @Schema(description = "Whether or not all of the FlowFiles in the Active Queue are penalized") public Boolean getAllActiveQueueFlowFilesPenalized() { return allActiveQueueFlowFilesPenalized; } @@ -125,7 +125,7 @@ public class LocalQueuePartitionDTO { this.allActiveQueueFlowFilesPenalized = allFlowFilesPenalized; } - @ApiModelProperty("Whether or not any of the FlowFiles in the Active Queue are penalized") + @Schema(description = "Whether or not any of the FlowFiles in the Active Queue are penalized") public Boolean getAnyActiveQueueFlowFilesPenalized() { return anyActiveQueueFlowFilesPenalized; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeGCDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeGCDiagnosticsSnapshotDTO.java index cd0ac1b58f..4700285808 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeGCDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeGCDiagnosticsSnapshotDTO.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.dto.diagnostics; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "nodeGCDiagnosticsSnapshot") public class NodeGCDiagnosticsSnapshotDTO { @@ -29,7 +29,7 @@ public class NodeGCDiagnosticsSnapshotDTO { private GCDiagnosticsSnapshotDTO snapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeGCDiagnosticsSnapshotDTO { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeGCDiagnosticsSnapshotDTO { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeGCDiagnosticsSnapshotDTO { this.apiPort = apiPort; } - @ApiModelProperty("The Garbage Collection Diagnostics Snapshot") + @Schema(description = "The Garbage Collection Diagnostics Snapshot") public GCDiagnosticsSnapshotDTO getSnapshot() { return snapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeJVMDiagnosticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeJVMDiagnosticsSnapshotDTO.java index 8aab6fb88b..be7c757634 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeJVMDiagnosticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/NodeJVMDiagnosticsSnapshotDTO.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.dto.diagnostics; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "nodeJVMDiagnosticsSnapshot") public class NodeJVMDiagnosticsSnapshotDTO { @@ -29,7 +29,7 @@ public class NodeJVMDiagnosticsSnapshotDTO { private JVMDiagnosticsSnapshotDTO snapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeJVMDiagnosticsSnapshotDTO { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeJVMDiagnosticsSnapshotDTO { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeJVMDiagnosticsSnapshotDTO { this.apiPort = apiPort; } - @ApiModelProperty("The JVM Diagnostics Snapshot") + @Schema(description = "The JVM Diagnostics Snapshot") public JVMDiagnosticsSnapshotDTO getSnapshot() { return snapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ProcessorDiagnosticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ProcessorDiagnosticsDTO.java index 5164926a87..4d589ad728 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ProcessorDiagnosticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ProcessorDiagnosticsDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.diagnostics; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ProcessorDTO; import org.apache.nifi.web.api.dto.status.ProcessorStatusDTO; @@ -37,7 +37,7 @@ public class ProcessorDiagnosticsDTO { private ClassLoaderDiagnosticsDTO classLoaderDiagnostics; - @ApiModelProperty("Information about the Processor for which the Diagnostic Report is generated") + @Schema(description = "Information about the Processor for which the Diagnostic Report is generated") public ProcessorDTO getProcessor() { return processor; } @@ -46,7 +46,7 @@ public class ProcessorDiagnosticsDTO { this.processor = processor; } - @ApiModelProperty("The Status for the Processor for which the Diagnostic Report is generated") + @Schema(description = "The Status for the Processor for which the Diagnostic Report is generated") public ProcessorStatusDTO getProcessorStatus() { return processorStatus; } @@ -55,7 +55,7 @@ public class ProcessorDiagnosticsDTO { this.processorStatus = processorStatus; } - @ApiModelProperty("Diagnostic Information about all Controller Services that the Processor is referencing") + @Schema(description = "Diagnostic Information about all Controller Services that the Processor is referencing") public Set getReferencedControllerServices() { return referencedControllerServices; } @@ -64,7 +64,7 @@ public class ProcessorDiagnosticsDTO { this.referencedControllerServices = referencedControllerServices; } - @ApiModelProperty("Diagnostic Information about all incoming Connections") + @Schema(description = "Diagnostic Information about all incoming Connections") public Set getIncomingConnections() { return incomingConnections; } @@ -73,7 +73,7 @@ public class ProcessorDiagnosticsDTO { this.incomingConnections = incomingConnections; } - @ApiModelProperty("Diagnostic Information about all outgoing Connections") + @Schema(description = "Diagnostic Information about all outgoing Connections") public Set getOutgoingConnections() { return outgoingConnections; } @@ -82,7 +82,7 @@ public class ProcessorDiagnosticsDTO { this.outgoingConnections = outgoingConnections; } - @ApiModelProperty("Diagnostic Information about the JVM and system-level diagnostics") + @Schema(description = "Diagnostic Information about the JVM and system-level diagnostics") public JVMDiagnosticsDTO getJvmDiagnostics() { return jvmDiagnostics; } @@ -91,7 +91,7 @@ public class ProcessorDiagnosticsDTO { this.jvmDiagnostics = jvmDiagnostics; } - @ApiModelProperty("Thread Dumps that were taken of the threads that are active in the Processor") + @Schema(description = "Thread Dumps that were taken of the threads that are active in the Processor") public List getThreadDumps() { return threadDumps; } @@ -100,7 +100,7 @@ public class ProcessorDiagnosticsDTO { this.threadDumps = threadDumps; } - @ApiModelProperty("Information about the Controller Service's Class Loader") + @Schema(description = "Information about the Controller Service's Class Loader") public ClassLoaderDiagnosticsDTO getClassLoaderDiagnostics() { return classLoaderDiagnostics; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RemoteQueuePartitionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RemoteQueuePartitionDTO.java index 157aed8ca0..1a15837ef8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RemoteQueuePartitionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RemoteQueuePartitionDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.diagnostics; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,7 +34,7 @@ public class RemoteQueuePartitionDTO { private int inFlightFlowFileCount; private long inFlightByteCount; - @ApiModelProperty("The Node Identifier that this queue partition is sending to") + @Schema(description = "The Node Identifier that this queue partition is sending to") public String getNodeIdentifier() { return nodeId; } @@ -43,7 +43,7 @@ public class RemoteQueuePartitionDTO { this.nodeId = nodeId; } - @ApiModelProperty("Total number of FlowFiles owned by the Connection") + @Schema(description = "Total number of FlowFiles owned by the Connection") public int getTotalFlowFileCount() { return totalFlowFileCount; } @@ -52,7 +52,7 @@ public class RemoteQueuePartitionDTO { this.totalFlowFileCount = totalFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles owned by this Connection") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles owned by this Connection") public long getTotalByteCount() { return totalByteCount; } @@ -61,7 +61,7 @@ public class RemoteQueuePartitionDTO { this.totalByteCount = totalByteCount; } - @ApiModelProperty("Total number of FlowFiles that exist in the Connection's Active Queue, immediately available to be offered up to a component") + @Schema(description = "Total number of FlowFiles that exist in the Connection's Active Queue, immediately available to be offered up to a component") public int getActiveQueueFlowFileCount() { return activeQueueFlowFileCount; } @@ -70,7 +70,7 @@ public class RemoteQueuePartitionDTO { this.activeQueueFlowFileCount = activeQueueFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles that are present in the Connection's Active Queue") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles that are present in the Connection's Active Queue") public long getActiveQueueByteCount() { return activeQueueByteCount; } @@ -79,7 +79,7 @@ public class RemoteQueuePartitionDTO { this.activeQueueByteCount = activeQueueByteCount; } - @ApiModelProperty("The total number of FlowFiles that are swapped out for this Connection") + @Schema(description = "The total number of FlowFiles that are swapped out for this Connection") public int getSwapFlowFileCount() { return swapFlowFileCount; } @@ -88,7 +88,7 @@ public class RemoteQueuePartitionDTO { this.swapFlowFileCount = swapFlowFileCount; } - @ApiModelProperty("Total number of bytes that make up the content for the FlowFiles that are swapped out to disk for the Connection") + @Schema(description = "Total number of bytes that make up the content for the FlowFiles that are swapped out to disk for the Connection") public long getSwapByteCount() { return swapByteCount; } @@ -97,7 +97,7 @@ public class RemoteQueuePartitionDTO { this.swapByteCount = swapByteCount; } - @ApiModelProperty("The number of Swap Files that exist for this Connection") + @Schema(description = "The number of Swap Files that exist for this Connection") public int getSwapFiles() { return swapFiles; } @@ -106,7 +106,7 @@ public class RemoteQueuePartitionDTO { this.swapFiles = swapFiles; } - @ApiModelProperty("The number of In-Flight FlowFiles for this Connection. These are FlowFiles that belong to the connection but are currently being operated on by a Processor, Port, etc.") + @Schema(description = "The number of In-Flight FlowFiles for this Connection. These are FlowFiles that belong to the connection but are currently being operated on by a Processor, Port, etc.") public int getInFlightFlowFileCount() { return inFlightFlowFileCount; } @@ -115,7 +115,7 @@ public class RemoteQueuePartitionDTO { this.inFlightFlowFileCount = inFlightFlowFileCount; } - @ApiModelProperty("The number bytes that make up the content of the FlowFiles that are In-Flight") + @Schema(description = "The number bytes that make up the content of the FlowFiles that are In-Flight") public long getInFlightByteCount() { return inFlightByteCount; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RepositoryUsageDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RepositoryUsageDTO.java index 1e10baf66d..6e137359c3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RepositoryUsageDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/RepositoryUsageDTO.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.dto.diagnostics; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "repositoryUsage") public class RepositoryUsageDTO implements Cloneable { @@ -33,7 +33,7 @@ public class RepositoryUsageDTO implements Cloneable { private String utilization; - @ApiModelProperty("The name of the repository") + @Schema(description = "The name of the repository") public String getName() { return name; } @@ -42,7 +42,7 @@ public class RepositoryUsageDTO implements Cloneable { this.name = name; } - @ApiModelProperty("A SHA-256 hash of the File Store name/path that is used to store the repository's data. This information is exposed as a hash in order to avoid " + @Schema(description = "A SHA-256 hash of the File Store name/path that is used to store the repository's data. This information is exposed as a hash in order to avoid " + "exposing potentially sensitive information that is not generally relevant. What is typically relevant is whether or not multiple repositories on the same node are " + "using the same File Store, as this indicates that the repositories are competing for the resources of the backing disk/storage mechanism.") public String getFileStoreHash() { @@ -53,7 +53,7 @@ public class RepositoryUsageDTO implements Cloneable { this.fileStoreHash = fileStore; } - @ApiModelProperty("Amount of free space.") + @Schema(description = "Amount of free space.") public String getFreeSpace() { return freeSpace; } @@ -62,7 +62,7 @@ public class RepositoryUsageDTO implements Cloneable { this.freeSpace = freeSpace; } - @ApiModelProperty("Amount of total space.") + @Schema(description = "Amount of total space.") public String getTotalSpace() { return totalSpace; } @@ -71,7 +71,7 @@ public class RepositoryUsageDTO implements Cloneable { this.totalSpace = totalSpace; } - @ApiModelProperty("Utilization of this storage location.") + @Schema(description = "Utilization of this storage location.") public String getUtilization() { return utilization; } @@ -80,7 +80,7 @@ public class RepositoryUsageDTO implements Cloneable { this.utilization = utilization; } - @ApiModelProperty("The number of bytes of free space.") + @Schema(description = "The number of bytes of free space.") public Long getFreeSpaceBytes() { return freeSpaceBytes; } @@ -89,7 +89,7 @@ public class RepositoryUsageDTO implements Cloneable { this.freeSpaceBytes = freeSpaceBytes; } - @ApiModelProperty("The number of bytes of total space.") + @Schema(description = "The number of bytes of total space.") public Long getTotalSpaceBytes() { return totalSpaceBytes; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ThreadDumpDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ThreadDumpDTO.java index dc1410e7cd..38ae807bef 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ThreadDumpDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/diagnostics/ThreadDumpDTO.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.dto.diagnostics; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlType(name = "threadDump") public class ThreadDumpDTO { @@ -31,7 +31,7 @@ public class ThreadDumpDTO { private long threadActiveMillis; private boolean taskTerminated; - @ApiModelProperty("The ID of the node in the cluster") + @Schema(description = "The ID of the node in the cluster") public String getNodeId() { return nodeId; } @@ -40,7 +40,7 @@ public class ThreadDumpDTO { this.nodeId = nodeId; } - @ApiModelProperty("The address of the node in the cluster") + @Schema(description = "The address of the node in the cluster") public String getNodeAddress() { return nodeAddress; } @@ -49,7 +49,7 @@ public class ThreadDumpDTO { this.nodeAddress = nodeAddress; } - @ApiModelProperty("The port the node is listening for API requests.") + @Schema(description = "The port the node is listening for API requests.") public Integer getApiPort() { return apiPort; } @@ -58,7 +58,7 @@ public class ThreadDumpDTO { this.apiPort = port; } - @ApiModelProperty("The stack trace for the thread") + @Schema(description = "The stack trace for the thread") public String getStackTrace() { return stackTrace; } @@ -67,7 +67,7 @@ public class ThreadDumpDTO { this.stackTrace = stackTrace; } - @ApiModelProperty("The name of the thread") + @Schema(description = "The name of the thread") public String getThreadName() { return threadName; } @@ -76,7 +76,7 @@ public class ThreadDumpDTO { this.threadName = threadName; } - @ApiModelProperty("The number of milliseconds that the thread has been executing in the Processor") + @Schema(description = "The number of milliseconds that the thread has been executing in the Processor") public long getThreadActiveMillis() { return threadActiveMillis; } @@ -89,7 +89,7 @@ public class ThreadDumpDTO { this.taskTerminated = terminated; } - @ApiModelProperty("Indicates whether or not the user has requested that the task be terminated. If this is true, it may indicate that " + @Schema(description = "Indicates whether or not the user has requested that the task be terminated. If this is true, it may indicate that " + "the thread is in a state where it will continue running indefinitely without returning.") public boolean isTaskTerminated() { return taskTerminated; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java index d30163a728..d4b7efda77 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.VersionControlInformationDTO; import jakarta.xml.bind.annotation.XmlType; @@ -36,8 +36,7 @@ public class FlowBreadcrumbDTO { * * @return The id */ - @ApiModelProperty( - value = "The id of the group." + @Schema(description = "The id of the group." ) public String getId() { return this.id; @@ -52,8 +51,7 @@ public class FlowBreadcrumbDTO { * * @return The name */ - @ApiModelProperty( - value = "The id of the group." + @Schema(description = "The id of the group." ) public String getName() { return this.name; @@ -66,8 +64,7 @@ public class FlowBreadcrumbDTO { /** * @return the process group version control information or null if not version controlled */ - @ApiModelProperty( - value = "The process group version control information or null if not version controlled." + @Schema(description = "The process group version control information or null if not version controlled." ) public VersionControlInformationDTO getVersionControlInformation() { return versionControlInformation; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java index a73807bc66..3b0dfce9f3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ConnectionEntity; import org.apache.nifi.web.api.entity.FunnelEntity; import org.apache.nifi.web.api.entity.LabelEntity; @@ -47,8 +47,7 @@ public class FlowDTO { /** * @return connections in this flow */ - @ApiModelProperty( - value = "The connections in this flow." + @Schema(description = "The connections in this flow." ) public Set getConnections() { return connections; @@ -61,8 +60,7 @@ public class FlowDTO { /** * @return input ports in this flow */ - @ApiModelProperty( - value = "The input ports in this flow." + @Schema(description = "The input ports in this flow." ) public Set getInputPorts() { return inputPorts; @@ -75,8 +73,7 @@ public class FlowDTO { /** * @return labels in this flow */ - @ApiModelProperty( - value = "The labels in this flow." + @Schema(description = "The labels in this flow." ) public Set getLabels() { return labels; @@ -89,8 +86,7 @@ public class FlowDTO { /** * @return funnels in this flow */ - @ApiModelProperty( - value = "The funnels in this flow." + @Schema(description = "The funnels in this flow." ) public Set getFunnels() { return funnels; @@ -103,8 +99,7 @@ public class FlowDTO { /** * @return output ports in this flow */ - @ApiModelProperty( - value = "The output ports in this flow." + @Schema(description = "The output ports in this flow." ) public Set getOutputPorts() { return outputPorts; @@ -117,8 +112,7 @@ public class FlowDTO { /** * @return process groups in this flow */ - @ApiModelProperty( - value = "The process groups in this flow." + @Schema(description = "The process groups in this flow." ) public Set getProcessGroups() { return processGroups; @@ -131,8 +125,7 @@ public class FlowDTO { /** * @return processors in this flow */ - @ApiModelProperty( - value = "The processors in this flow." + @Schema(description = "The processors in this flow." ) public Set getProcessors() { return processors; @@ -145,8 +138,7 @@ public class FlowDTO { /** * @return remote process groups in this flow */ - @ApiModelProperty( - value = "The remote process groups in this flow." + @Schema(description = "The remote process groups in this flow." ) public Set getRemoteProcessGroups() { return remoteProcessGroups; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java index 0bcc8b5013..56ba4be694 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.flow; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import org.apache.nifi.web.api.entity.FlowBreadcrumbEntity; import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity; @@ -42,8 +42,7 @@ public class ProcessGroupFlowDTO { /** * @return contents of this process group. This field will be populated if the request is marked verbose */ - @ApiModelProperty( - value = "The flow structure starting at this Process Group." + @Schema(description = "The flow structure starting at this Process Group." ) public FlowDTO getFlow() { return flow; @@ -58,8 +57,7 @@ public class ProcessGroupFlowDTO { * * @return The id */ - @ApiModelProperty( - value = "The id of the component." + @Schema(description = "The id of the component." ) public String getId() { return this.id; @@ -74,8 +72,7 @@ public class ProcessGroupFlowDTO { * * @return The breadcrumb for this ProcessGroup flow */ - @ApiModelProperty( - value = "The breadcrumb of the process group." + @Schema(description = "The breadcrumb of the process group." ) public FlowBreadcrumbEntity getBreadcrumb() { return breadcrumb; @@ -88,8 +85,7 @@ public class ProcessGroupFlowDTO { /** * @return id for the parent group of this component if applicable, null otherwise */ - @ApiModelProperty( - value = "The id of parent process group of this component if applicable." + @Schema(description = "The id of parent process group of this component if applicable." ) public String getParentGroupId() { return parentGroupId; @@ -104,8 +100,7 @@ public class ProcessGroupFlowDTO { * * @return The uri */ - @ApiModelProperty( - value = "The URI for futures requests to the component." + @Schema(description = "The URI for futures requests to the component." ) public String getUri() { return uri; @@ -116,9 +111,8 @@ public class ProcessGroupFlowDTO { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The time the flow for the process group was last refreshed.", - dataType = "string" + @Schema(description = "The time the flow for the process group was last refreshed.", + type = "string" ) public Date getLastRefreshed() { return lastRefreshed; @@ -128,7 +122,7 @@ public class ProcessGroupFlowDTO { this.lastRefreshed = lastRefreshed; } - @ApiModelProperty("The Parameter Context, or null if no Parameter Context has been bound to the Process Group") + @Schema(description = "The Parameter Context, or null if no Parameter Context has been bound to the Process Group") public ParameterContextReferenceEntity getParameterContext() { return parameterContext; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java index 1d83d33fd6..75c2649ab8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class AttributeDTO { /** * @return attribute name */ - @ApiModelProperty( - value = "The attribute name." + @Schema(description = "The attribute name." ) public String getName() { return name; @@ -47,8 +46,7 @@ public class AttributeDTO { /** * @return attribute value */ - @ApiModelProperty( - value = "The attribute value." + @Schema(description = "The attribute value." ) public String getValue() { return value; @@ -61,8 +59,7 @@ public class AttributeDTO { /** * @return value of this attribute before the event took place */ - @ApiModelProperty( - value = "The value of the attribute before the event took place." + @Schema(description = "The value of the attribute before the event took place." ) public String getPreviousValue() { return previousValue; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java index 7ef60cc852..21de8846c1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -44,8 +44,7 @@ public class ProvenanceDTO { /** * @return id of this provenance query */ - @ApiModelProperty( - value = "The id of the provenance query." + @Schema(description = "The id of the provenance query." ) public String getId() { return id; @@ -58,8 +57,7 @@ public class ProvenanceDTO { /** * @return URI for this query. Used for obtaining the requests at a later time */ - @ApiModelProperty( - value = "The URI for this query. Used for obtaining/deleting the request at a later time" + @Schema(description = "The URI for this query. Used for obtaining/deleting the request at a later time" ) public String getUri() { return uri; @@ -73,9 +71,8 @@ public class ProvenanceDTO { * @return time the query was submitted */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp when the query was submitted.", - dataType = "string" + @Schema(description = "The timestamp when the query was submitted.", + type = "string" ) public Date getSubmissionTime() { return submissionTime; @@ -89,9 +86,8 @@ public class ProvenanceDTO { * @return expiration time of the query results */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp when the query will expire.", - dataType = "string" + @Schema(description = "The timestamp when the query will expire.", + type = "string" ) public Date getExpiration() { return expiration; @@ -104,8 +100,7 @@ public class ProvenanceDTO { /** * @return percent completed */ - @ApiModelProperty( - value = "The current percent complete." + @Schema(description = "The current percent complete." ) public Integer getPercentCompleted() { return percentCompleted; @@ -118,8 +113,7 @@ public class ProvenanceDTO { /** * @return whether the query has finished */ - @ApiModelProperty( - value = "Whether the query has finished." + @Schema(description = "Whether the query has finished." ) public Boolean isFinished() { return finished; @@ -132,8 +126,7 @@ public class ProvenanceDTO { /** * @return provenance request */ - @ApiModelProperty( - value = "The provenance request." + @Schema(description = "The provenance request." ) public ProvenanceRequestDTO getRequest() { return request; @@ -146,8 +139,7 @@ public class ProvenanceDTO { /** * @return results of this query */ - @ApiModelProperty( - value = "The provenance results." + @Schema(description = "The provenance results." ) public ProvenanceResultsDTO getResults() { return results; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java index 8afc9450da..46c4f5be6a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -85,8 +85,7 @@ public class ProvenanceEventDTO { /** * @return event uuid */ - @ApiModelProperty( - value = "The event uuid." + @Schema(description = "The event uuid." ) public String getId() { return id; @@ -99,8 +98,7 @@ public class ProvenanceEventDTO { /** * @return event id */ - @ApiModelProperty( - value = "The event id. This is a one up number thats unique per node." + @Schema(description = "The event id. This is a one up number thats unique per node." ) public Long getEventId() { return eventId; @@ -114,9 +112,8 @@ public class ProvenanceEventDTO { * @return time the event occurred */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp of the event.", - dataType = "string" + @Schema(description = "The timestamp of the event.", + type = "string" ) public Date getEventTime() { return eventTime; @@ -129,8 +126,7 @@ public class ProvenanceEventDTO { /** * @return UUID of the FlowFile for this event */ - @ApiModelProperty( - value = "The uuid of the flowfile for the event." + @Schema(description = "The uuid of the flowfile for the event." ) public String getFlowFileUuid() { return flowFileUuid; @@ -143,8 +139,7 @@ public class ProvenanceEventDTO { /** * @return size of the FlowFile for this event */ - @ApiModelProperty( - value = "The size of the flowfile for the event." + @Schema(description = "The size of the flowfile for the event." ) public String getFileSize() { return fileSize; @@ -157,8 +152,7 @@ public class ProvenanceEventDTO { /** * @return size of the FlowFile in bytes for this event */ - @ApiModelProperty( - value = "The size of the flowfile in bytes for the event." + @Schema(description = "The size of the flowfile in bytes for the event." ) public Long getFileSizeBytes() { return fileSizeBytes; @@ -171,8 +165,7 @@ public class ProvenanceEventDTO { /** * @return type of this event */ - @ApiModelProperty( - value = "The type of the event." + @Schema(description = "The type of the event." ) public String getEventType() { return eventType; @@ -185,8 +178,7 @@ public class ProvenanceEventDTO { /** * @return attributes for the FlowFile for this event */ - @ApiModelProperty( - value = "The attributes of the flowfile for the event." + @Schema(description = "The attributes of the flowfile for the event." ) public Collection getAttributes() { return attributes; @@ -199,8 +191,7 @@ public class ProvenanceEventDTO { /** * @return id of the group that this component resides in. If the component is no longer in the flow, the group id will not be set */ - @ApiModelProperty( - value = "The id of the group that the component resides in. If the component is no longer in the flow, the group id will not be set." + @Schema(description = "The id of the group that the component resides in. If the component is no longer in the flow, the group id will not be set." ) public String getGroupId() { return groupId; @@ -213,8 +204,7 @@ public class ProvenanceEventDTO { /** * @return id of the component that generated this event */ - @ApiModelProperty( - value = "The id of the component that generated the event." + @Schema(description = "The id of the component that generated the event." ) public String getComponentId() { return componentId; @@ -227,8 +217,7 @@ public class ProvenanceEventDTO { /** * @return name of the component that generated this event */ - @ApiModelProperty( - value = "The name of the component that generated the event." + @Schema(description = "The name of the component that generated the event." ) public String getComponentName() { return componentName; @@ -241,8 +230,7 @@ public class ProvenanceEventDTO { /** * @return type of the component that generated this event */ - @ApiModelProperty( - value = "The type of the component that generated the event." + @Schema(description = "The type of the component that generated the event." ) public String getComponentType() { return componentType; @@ -255,8 +243,7 @@ public class ProvenanceEventDTO { /** * @return source/destination system URI if the event was a RECEIVE/SEND */ - @ApiModelProperty( - value = "The source/destination system uri if the event was a RECEIVE/SEND." + @Schema(description = "The source/destination system uri if the event was a RECEIVE/SEND." ) public String getTransitUri() { return transitUri; @@ -269,8 +256,7 @@ public class ProvenanceEventDTO { /** * @return alternate identifier URI for the FlowFile for this event */ - @ApiModelProperty( - value = "The alternate identifier uri for the fileflow for the event." + @Schema(description = "The alternate identifier uri for the fileflow for the event." ) public String getAlternateIdentifierUri() { return alternateIdentifierUri; @@ -283,8 +269,7 @@ public class ProvenanceEventDTO { /** * @return identifier of the node where this event originated */ - @ApiModelProperty( - value = "The identifier for the node where the event originated." + @Schema(description = "The identifier for the node where the event originated." ) public String getClusterNodeId() { return clusterNodeId; @@ -297,8 +282,7 @@ public class ProvenanceEventDTO { /** * @return label to use to show which node this event originated from */ - @ApiModelProperty( - value = "The label for the node where the event originated." + @Schema(description = "The label for the node where the event originated." ) public String getClusterNodeAddress() { return clusterNodeAddress; @@ -311,8 +295,7 @@ public class ProvenanceEventDTO { /** * @return parent uuids for this event */ - @ApiModelProperty( - value = "The parent uuids for the event." + @Schema(description = "The parent uuids for the event." ) public List getParentUuids() { return parentUuids; @@ -325,8 +308,7 @@ public class ProvenanceEventDTO { /** * @return child uuids for this event */ - @ApiModelProperty( - value = "The child uuids for the event." + @Schema(description = "The child uuids for the event." ) public List getChildUuids() { return childUuids; @@ -339,8 +321,7 @@ public class ProvenanceEventDTO { /** * @return duration of the event, in milliseconds */ - @ApiModelProperty( - value = "The event duration in milliseconds." + @Schema(description = "The event duration in milliseconds." ) public Long getEventDuration() { return eventDuration; @@ -353,8 +334,7 @@ public class ProvenanceEventDTO { /** * @return duration since the lineage began, in milliseconds */ - @ApiModelProperty( - value = "The duration since the lineage began, in milliseconds." + @Schema(description = "The duration since the lineage began, in milliseconds." ) public Long getLineageDuration() { return lineageDuration; @@ -367,8 +347,7 @@ public class ProvenanceEventDTO { /** * @return source system FlowFile id */ - @ApiModelProperty( - value = "The source system flowfile id." + @Schema(description = "The source system flowfile id." ) public String getSourceSystemFlowFileId() { return sourceSystemFlowFileId; @@ -381,8 +360,7 @@ public class ProvenanceEventDTO { /** * @return If this represents a route event, this is the relationship to which the flowfile was routed */ - @ApiModelProperty( - value = "The relationship to which the flowfile was routed if the event is of type ROUTE." + @Schema(description = "The relationship to which the flowfile was routed if the event is of type ROUTE." ) public String getRelationship() { return relationship; @@ -395,8 +373,7 @@ public class ProvenanceEventDTO { /** * @return event details */ - @ApiModelProperty( - value = "The event details." + @Schema(description = "The event details." ) public String getDetails() { return details; @@ -409,8 +386,7 @@ public class ProvenanceEventDTO { /** * @return whether or not the input and output content claim is the same */ - @ApiModelProperty( - value = "Whether the input and output content claim is the same." + @Schema(description = "Whether the input and output content claim is the same." ) public Boolean getContentEqual() { return contentEqual; @@ -423,8 +399,7 @@ public class ProvenanceEventDTO { /** * @return whether or not the output content is still available */ - @ApiModelProperty( - value = "Whether the output content is still available." + @Schema(description = "Whether the output content is still available." ) public Boolean getOutputContentAvailable() { return outputContentAvailable; @@ -437,8 +412,7 @@ public class ProvenanceEventDTO { /** * @return the Section in which the output Content Claim lives, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The section in which the output content claim lives." + @Schema(description = "The section in which the output content claim lives." ) public String getOutputContentClaimSection() { return outputContentClaimSection; @@ -451,8 +425,7 @@ public class ProvenanceEventDTO { /** * @return the Container in which the output Content Claim lives, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The container in which the output content claim lives." + @Schema(description = "The container in which the output content claim lives." ) public String getOutputContentClaimContainer() { return outputContentClaimContainer; @@ -465,8 +438,7 @@ public class ProvenanceEventDTO { /** * @return the Identifier of the output Content Claim, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The identifier of the output content claim." + @Schema(description = "The identifier of the output content claim." ) public String getOutputContentClaimIdentifier() { return outputContentClaimIdentifier; @@ -479,8 +451,7 @@ public class ProvenanceEventDTO { /** * @return the offset into the the output Content Claim where the FlowFile's content begins, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The offset into the output content claim where the flowfiles content begins." + @Schema(description = "The offset into the output content claim where the flowfiles content begins." ) public Long getOutputContentClaimOffset() { return outputContentClaimOffset; @@ -493,8 +464,7 @@ public class ProvenanceEventDTO { /** * @return the formatted file size of the input content claim */ - @ApiModelProperty( - value = "The file size of the output content claim formatted." + @Schema(description = "The file size of the output content claim formatted." ) public String getOutputContentClaimFileSize() { return outputContentClaimFileSize; @@ -507,8 +477,7 @@ public class ProvenanceEventDTO { /** * @return the number of bytes of the input content claim */ - @ApiModelProperty( - value = "The file size of the output content claim in bytes." + @Schema(description = "The file size of the output content claim in bytes." ) public Long getOutputContentClaimFileSizeBytes() { return outputContentClaimFileSizeBytes; @@ -521,8 +490,7 @@ public class ProvenanceEventDTO { /** * @return whether or not the input content is still available */ - @ApiModelProperty( - value = "Whether the input content is still available." + @Schema(description = "Whether the input content is still available." ) public Boolean getInputContentAvailable() { return inputContentAvailable; @@ -535,8 +503,7 @@ public class ProvenanceEventDTO { /** * @return the Section in which the input Content Claim lives, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The section in which the input content claim lives." + @Schema(description = "The section in which the input content claim lives." ) public String getInputContentClaimSection() { return inputContentClaimSection; @@ -549,8 +516,7 @@ public class ProvenanceEventDTO { /** * @return the Container in which the input Content Claim lives, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The container in which the input content claim lives." + @Schema(description = "The container in which the input content claim lives." ) public String getInputContentClaimContainer() { return inputContentClaimContainer; @@ -563,8 +529,7 @@ public class ProvenanceEventDTO { /** * @return the Identifier of the input Content Claim, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The identifier of the input content claim." + @Schema(description = "The identifier of the input content claim." ) public String getInputContentClaimIdentifier() { return inputContentClaimIdentifier; @@ -577,8 +542,7 @@ public class ProvenanceEventDTO { /** * @return the offset into the the input Content Claim where the FlowFile's content begins, or null if no Content Claim exists */ - @ApiModelProperty( - value = "The offset into the input content claim where the flowfiles content begins." + @Schema(description = "The offset into the input content claim where the flowfiles content begins." ) public Long getInputContentClaimOffset() { return inputContentClaimOffset; @@ -591,8 +555,7 @@ public class ProvenanceEventDTO { /** * @return the formatted file size of the input content claim */ - @ApiModelProperty( - value = "The file size of the input content claim formatted." + @Schema(description = "The file size of the input content claim formatted." ) public String getInputContentClaimFileSize() { return inputContentClaimFileSize; @@ -605,8 +568,7 @@ public class ProvenanceEventDTO { /** * @return the number of bytes of the input content claim */ - @ApiModelProperty( - value = "The file size of the intput content claim in bytes." + @Schema(description = "The file size of the intput content claim in bytes." ) public Long getInputContentClaimFileSizeBytes() { return inputContentClaimFileSizeBytes; @@ -619,8 +581,7 @@ public class ProvenanceEventDTO { /** * @return whether or not replay is available */ - @ApiModelProperty( - value = "Whether or not replay is available." + @Schema(description = "Whether or not replay is available." ) public Boolean getReplayAvailable() { return replayAvailable; @@ -633,8 +594,7 @@ public class ProvenanceEventDTO { /** * @return the explanation as to why replay is unavailable */ - @ApiModelProperty( - value = "Explanation as to why replay is unavailable." + @Schema(description = "Explanation as to why replay is unavailable." ) public String getReplayExplanation() { return replayExplanation; @@ -648,8 +608,7 @@ public class ProvenanceEventDTO { * @return identifier of the FlowFile Queue / Connection from which the FlowFile was pulled to generate this event, or null if either the queue is unknown or the FlowFile was created * by this event */ - @ApiModelProperty( - value = "The identifier of the queue/connection from which the flowfile was pulled to genereate this event. May be null if the queue/connection is unknown or the " + @Schema(description = "The identifier of the queue/connection from which the flowfile was pulled to genereate this event. May be null if the queue/connection is unknown or the " + "flowfile was generated from this event." ) public String getSourceConnectionIdentifier() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java index 10d51df3be..a22564f1bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -32,8 +32,7 @@ public class ProvenanceOptionsDTO { /** * @return available searchable fields for this NiFi instance */ - @ApiModelProperty( - value = "The available searchable field for the NiFi." + @Schema(description = "The available searchable field for the NiFi." ) public List getSearchableFields() { return searchableFields; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java index d51750a93a..c8a4e9053d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -44,8 +44,7 @@ public class ProvenanceRequestDTO { /** * @return the search terms to use for this search */ - @ApiModelProperty( - value = "The search terms used to perform the search." + @Schema(description = "The search terms used to perform the search." ) public Map getSearchTerms() { return searchTerms; @@ -59,9 +58,8 @@ public class ProvenanceRequestDTO { * @return earliest event time to include in the query */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The earliest event time to include in the query.", - dataType = "string" + @Schema(description = "The earliest event time to include in the query.", + type = "string" ) public Date getStartDate() { return startDate; @@ -75,9 +73,8 @@ public class ProvenanceRequestDTO { * @return latest event time to include in the query */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The latest event time to include in the query.", - dataType = "string" + @Schema(description = "The latest event time to include in the query.", + type = "string" ) public Date getEndDate() { return endDate; @@ -90,8 +87,7 @@ public class ProvenanceRequestDTO { /** * @return minimum file size to include in the query */ - @ApiModelProperty( - value = "The minimum file size to include in the query." + @Schema(description = "The minimum file size to include in the query." ) public String getMinimumFileSize() { return minimumFileSize; @@ -104,8 +100,7 @@ public class ProvenanceRequestDTO { /** * @return maximum file size to include in the query */ - @ApiModelProperty( - value = "The maximum file size to include in the query." + @Schema(description = "The maximum file size to include in the query." ) public String getMaximumFileSize() { return maximumFileSize; @@ -118,8 +113,7 @@ public class ProvenanceRequestDTO { /** * @return number of max results */ - @ApiModelProperty( - value = "The maximum number of results to include." + @Schema(description = "The maximum number of results to include." ) public Integer getMaxResults() { return maxResults; @@ -132,8 +126,7 @@ public class ProvenanceRequestDTO { /** * @return id of the node in the cluster where this provenance originated */ - @ApiModelProperty( - value = "The id of the node in the cluster where this provenance originated." + @Schema(description = "The id of the node in the cluster where this provenance originated." ) public String getClusterNodeId() { return clusterNodeId; @@ -147,8 +140,7 @@ public class ProvenanceRequestDTO { * @return whether or not incremental results are returned. If false, provenance events * are only returned once the query completes. This property is true by default. */ - @ApiModelProperty( - value = "Whether or not incremental results are returned. If false, provenance events" + @Schema(description = "Whether or not incremental results are returned. If false, provenance events" + " are only returned once the query completes. This property is true by default." ) public Boolean getIncrementalResults() { @@ -162,8 +154,7 @@ public class ProvenanceRequestDTO { /** * @return whether or not to summarize provenance events returned. This property is false by default. */ - @ApiModelProperty( - value = "Whether or not to summarize provenance events returned. This property is false by default." + @Schema(description = "Whether or not to summarize provenance events returned. This property is false by default." ) public Boolean getSummarize() { return summarize; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java index 7c036b3f55..797745ef78 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.DateTimeAdapter; import org.apache.nifi.web.api.dto.util.TimeAdapter; @@ -44,8 +44,7 @@ public class ProvenanceResultsDTO { /** * @return error messages */ - @ApiModelProperty( - value = "Any errors that occurred while performing the provenance request." + @Schema(description = "Any errors that occurred while performing the provenance request." ) public Set getErrors() { return errors; @@ -58,8 +57,7 @@ public class ProvenanceResultsDTO { /** * @return provenance events that matched the search criteria */ - @ApiModelProperty( - value = "The provenance events that matched the search criteria." + @Schema(description = "The provenance events that matched the search criteria." ) public List getProvenanceEvents() { return provenanceEvents; @@ -72,8 +70,7 @@ public class ProvenanceResultsDTO { /** * @return total number of results formatted */ - @ApiModelProperty( - value = "The total number of results formatted." + @Schema(description = "The total number of results formatted." ) public String getTotal() { return total; @@ -86,8 +83,7 @@ public class ProvenanceResultsDTO { /** * @return total number of results */ - @ApiModelProperty( - value = "The total number of results." + @Schema(description = "The total number of results." ) public Long getTotalCount() { return totalCount; @@ -101,9 +97,8 @@ public class ProvenanceResultsDTO { * @return when the search was performed */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "Then the search was performed.", - dataType = "string" + @Schema(description = "Then the search was performed.", + type = "string" ) public Date getGenerated() { return generated; @@ -117,9 +112,8 @@ public class ProvenanceResultsDTO { * @return oldest event available in the provenance repository */ @XmlJavaTypeAdapter(DateTimeAdapter.class) - @ApiModelProperty( - value = "The oldest event available in the provenance repository.", - dataType = "string" + @Schema(description = "The oldest event available in the provenance repository.", + type = "string" ) public Date getOldestEvent() { return oldestEvent; @@ -132,8 +126,7 @@ public class ProvenanceResultsDTO { /** * @return time offset on the server that's used for event time */ - @ApiModelProperty( - value = "The time offset of the server that's used for event time." + @Schema(description = "The time offset of the server that's used for event time." ) public Integer getTimeOffset() { return timeOffset; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchValueDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchValueDTO.java index 69585385ea..5537c670a4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchValueDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchValueDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,8 +32,7 @@ public class ProvenanceSearchValueDTO { /** * @return the search value */ - @ApiModelProperty( - value = "The search value." + @Schema(description = "The search value." ) public String getValue() { return value; @@ -46,8 +45,7 @@ public class ProvenanceSearchValueDTO { /** * @return whether inverse of search value should be searched or not */ - @ApiModelProperty( - value = "Query for all except for search value." + @Schema(description = "Query for all except for search value." ) public Boolean getInverse() { return inverse; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java index b3095f6337..5a491380b2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -34,8 +34,7 @@ public class ProvenanceSearchableFieldDTO { /** * @return id of this searchable field */ - @ApiModelProperty( - value = "The id of the searchable field." + @Schema(description = "The id of the searchable field." ) public String getId() { return id; @@ -48,8 +47,7 @@ public class ProvenanceSearchableFieldDTO { /** * @return the field */ - @ApiModelProperty( - value = "The searchable field." + @Schema(description = "The searchable field." ) public String getField() { return field; @@ -62,8 +60,7 @@ public class ProvenanceSearchableFieldDTO { /** * @return label for this field */ - @ApiModelProperty( - value = "The label for the searchable field." + @Schema(description = "The label for the searchable field." ) public String getLabel() { return label; @@ -76,8 +73,7 @@ public class ProvenanceSearchableFieldDTO { /** * @return type of this field */ - @ApiModelProperty( - value = "The type of the searchable field." + @Schema(description = "The type of the searchable field." ) public String getType() { return type; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java index beeb6538c0..b4d46b1492 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance.lineage; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -43,8 +43,7 @@ public class LineageDTO { /** * @return id of this lineage */ - @ApiModelProperty( - value = "The id of this lineage query." + @Schema(description = "The id of this lineage query." ) public String getId() { return id; @@ -57,8 +56,7 @@ public class LineageDTO { /** * @return uri for this lineage */ - @ApiModelProperty( - value = "The URI for this lineage query for later retrieval and deletion." + @Schema(description = "The URI for this lineage query for later retrieval and deletion." ) public String getUri() { return uri; @@ -72,9 +70,8 @@ public class LineageDTO { * @return submission time for this lineage */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "When the lineage query was submitted.", - dataType = "string" + @Schema(description = "When the lineage query was submitted.", + type = "string" ) public Date getSubmissionTime() { return submissionTime; @@ -88,9 +85,8 @@ public class LineageDTO { * @return expiration of this lineage */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "When the lineage query will expire.", - dataType = "string" + @Schema(description = "When the lineage query will expire.", + type = "string" ) public Date getExpiration() { return expiration; @@ -103,8 +99,7 @@ public class LineageDTO { /** * @return percent completed for this result */ - @ApiModelProperty( - value = "The percent complete for the lineage query." + @Schema(description = "The percent complete for the lineage query." ) public Integer getPercentCompleted() { return percentCompleted; @@ -117,8 +112,7 @@ public class LineageDTO { /** * @return whether or not the request is finished running */ - @ApiModelProperty( - value = "Whether the lineage query has finished." + @Schema(description = "Whether the lineage query has finished." ) public Boolean getFinished() { return finished; @@ -131,8 +125,7 @@ public class LineageDTO { /** * @return the lineage request */ - @ApiModelProperty( - value = "The initial lineage result." + @Schema(description = "The initial lineage result." ) public LineageRequestDTO getRequest() { return request; @@ -145,8 +138,7 @@ public class LineageDTO { /** * @return the results of this lineage */ - @ApiModelProperty( - value = "The results of the lineage query." + @Schema(description = "The results of the lineage query." ) public LineageResultsDTO getResults() { return results; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java index 7939c02b70..745e8ac017 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance.lineage; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlType; @@ -47,9 +47,11 @@ public class LineageRequestDTO { /** * @return event id that was used to generate this lineage */ - @ApiModelProperty( - value = "The event id that was used to generate this lineage, if applicable. The event id is allowed for any type of lineageRequestType. If the lineageRequestType is FLOWFILE and the " - + "flowfile uuid is also included in the request, the event id will be ignored." + @Schema(description = """ + The event id that was used to generate this lineage, if applicable. + The event id is allowed for any type of lineageRequestType. + If the lineageRequestType is FLOWFILE and the flowfile uuid is also included in the request, the event id will be ignored. + """ ) public Long getEventId() { return eventId; @@ -63,8 +65,7 @@ public class LineageRequestDTO { * @return type of lineage request. Either 'PARENTS', 'CHILDREN', or 'FLOWFILE'. PARENTS will return the lineage for the flowfiles that are parents of the specified event. CHILDREN will return the * lineage of for the flowfiles that are children of the specified event. FLOWFILE will return the lineage for the specified flowfile. */ - @ApiModelProperty( - value = "The type of lineage request. PARENTS will return the lineage for the flowfiles that are parents of the specified event. CHILDREN will return the lineage " + @Schema(description = "The type of lineage request. PARENTS will return the lineage for the flowfiles that are parents of the specified event. CHILDREN will return the lineage " + "for the flowfiles that are children of the specified event. FLOWFILE will return the lineage for the specified flowfile.", allowableValues = "PARENTS, CHILDREN, and FLOWFILE" ) @@ -79,7 +80,7 @@ public class LineageRequestDTO { /** * @return id of the node in the cluster where this lineage originated */ - @ApiModelProperty(value = "The id of the node where this lineage originated if clustered.") + @Schema(description = "The id of the node where this lineage originated if clustered.") public String getClusterNodeId() { return clusterNodeId; } @@ -91,8 +92,7 @@ public class LineageRequestDTO { /** * @return uuid that was used to generate this lineage */ - @ApiModelProperty( - value = "The flowfile uuid that was used to generate the lineage. The flowfile uuid is only allowed when the lineageRequestType is FLOWFILE and will take precedence over event id." + @Schema(description = "The flowfile uuid that was used to generate the lineage. The flowfile uuid is only allowed when the lineageRequestType is FLOWFILE and will take precedence over event id." ) public String getUuid() { return uuid; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java index 5a658ee995..2f9b43d734 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance.lineage; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -36,8 +36,7 @@ public class LineageResultsDTO { /** * @return any error messages */ - @ApiModelProperty( - value = "Any errors that occurred while generating the lineage." + @Schema(description = "Any errors that occurred while generating the lineage." ) public Set getErrors() { return errors; @@ -50,8 +49,7 @@ public class LineageResultsDTO { /** * @return the nodes */ - @ApiModelProperty( - value = "The nodes in the lineage." + @Schema(description = "The nodes in the lineage." ) public List getNodes() { return nodes; @@ -64,8 +62,7 @@ public class LineageResultsDTO { /** * @return the links */ - @ApiModelProperty( - value = "The links between the nodes in the lineage." + @Schema(description = "The links between the nodes in the lineage." ) public List getLinks() { return links; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java index 4a8f20a3e1..397dddbf38 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance.lineage; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -38,8 +38,7 @@ public class ProvenanceLinkDTO { /** * @return source node id */ - @ApiModelProperty( - value = "The source node id of the link." + @Schema(description = "The source node id of the link." ) public String getSourceId() { return sourceId; @@ -52,8 +51,7 @@ public class ProvenanceLinkDTO { /** * @return target node id */ - @ApiModelProperty( - value = "The target node id of the link." + @Schema(description = "The target node id of the link." ) public String getTargetId() { return targetId; @@ -66,8 +64,7 @@ public class ProvenanceLinkDTO { /** * @return flowfile uuid that traversed this link */ - @ApiModelProperty( - value = "The flowfile uuid that traversed the link." + @Schema(description = "The flowfile uuid that traversed the link." ) public String getFlowFileUuid() { return flowFileUuid; @@ -81,9 +78,8 @@ public class ProvenanceLinkDTO { * @return timestamp of this link (based on the destination) */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp of the link (based on the destination).", - dataType = "string" + @Schema(description = "The timestamp of the link (based on the destination).", + type = "string" ) public Date getTimestamp() { return timestamp; @@ -96,8 +92,7 @@ public class ProvenanceLinkDTO { /** * @return number of millis since epoch */ - @ApiModelProperty( - value = "The timestamp of this link in milliseconds." + @Schema(description = "The timestamp of this link in milliseconds." ) public Long getMillis() { return millis; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java index f294387b71..1fedc0fb6d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.provenance.lineage; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimestampAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -43,8 +43,7 @@ public class ProvenanceNodeDTO { /** * @return id of the node */ - @ApiModelProperty( - value = "The id of the node." + @Schema(description = "The id of the node." ) public String getId() { return id; @@ -57,8 +56,7 @@ public class ProvenanceNodeDTO { /** * @return flowfile uuid for this provenance event */ - @ApiModelProperty( - value = "The uuid of the flowfile associated with the provenance event." + @Schema(description = "The uuid of the flowfile associated with the provenance event." ) public String getFlowFileUuid() { return flowFileUuid; @@ -71,8 +69,7 @@ public class ProvenanceNodeDTO { /** * @return parent flowfile uuids for this provenance event */ - @ApiModelProperty( - value = "The uuid of the parent flowfiles of the provenance event." + @Schema(description = "The uuid of the parent flowfiles of the provenance event." ) public List getParentUuids() { return parentUuids; @@ -85,8 +82,7 @@ public class ProvenanceNodeDTO { /** * @return child flowfile uuids for this provenance event */ - @ApiModelProperty( - value = "The uuid of the childrent flowfiles of the provenance event." + @Schema(description = "The uuid of the childrent flowfiles of the provenance event." ) public List getChildUuids() { return childUuids; @@ -99,8 +95,7 @@ public class ProvenanceNodeDTO { /** * @return node identifier that this event/flowfile originated from */ - @ApiModelProperty( - value = "The identifier of the node that this event/flowfile originated from." + @Schema(description = "The identifier of the node that this event/flowfile originated from." ) public String getClusterNodeIdentifier() { return clusterNodeIdentifier; @@ -113,8 +108,7 @@ public class ProvenanceNodeDTO { /** * @return type of node */ - @ApiModelProperty( - value = "The type of the node.", + @Schema(description = "The type of the node.", allowableValues = "FLOWFILE, EVENT" ) public String getType() { @@ -128,8 +122,7 @@ public class ProvenanceNodeDTO { /** * @return this is an event node, this is the type of event */ - @ApiModelProperty( - value = "If the type is EVENT, this is the type of event." + @Schema(description = "If the type is EVENT, this is the type of event." ) public String getEventType() { return eventType; @@ -143,9 +136,8 @@ public class ProvenanceNodeDTO { * @return timestamp of this node */ @XmlJavaTypeAdapter(TimestampAdapter.class) - @ApiModelProperty( - value = "The timestamp of the node formatted.", - dataType = "string" + @Schema(description = "The timestamp of the node formatted.", + type = "string" ) public Date getTimestamp() { return timestamp; @@ -158,8 +150,7 @@ public class ProvenanceNodeDTO { /** * @return number of millis since epoch */ - @ApiModelProperty( - value = "The timestamp of the node in milliseconds." + @Schema(description = "The timestamp of the node in milliseconds." ) public Long getMillis() { return millis; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/remote/PeerDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/remote/PeerDTO.java index b94c5090b3..c8266dda11 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/remote/PeerDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/remote/PeerDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.remote; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,8 +31,7 @@ public class PeerDTO { private boolean secure; private int flowFileCount; - @ApiModelProperty( - value = "The hostname of this peer." + @Schema(description = "The hostname of this peer." ) public String getHostname() { return hostname; @@ -42,8 +41,7 @@ public class PeerDTO { this.hostname = hostname; } - @ApiModelProperty( - value = "The port number of this peer." + @Schema(description = "The port number of this peer." ) public int getPort() { return port; @@ -53,8 +51,7 @@ public class PeerDTO { this.port = port; } - @ApiModelProperty( - value = "Returns if this peer connection is secure." + @Schema(description = "Returns if this peer connection is secure." ) public boolean isSecure() { return secure; @@ -65,8 +62,7 @@ public class PeerDTO { } - @ApiModelProperty( - value = "The number of flowFiles this peer holds." + @Schema(description = "The number of flowFiles this peer holds." ) public int getFlowFileCount() { return flowFileCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java index 138132bbad..1597727fce 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.search; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -37,8 +37,7 @@ public class ComponentSearchResultDTO { /** * @return id of the component that matched */ - @ApiModelProperty( - value = "The id of the component that matched the search." + @Schema(description = "The id of the component that matched the search." ) public String getId() { return id; @@ -51,8 +50,7 @@ public class ComponentSearchResultDTO { /** * @return group id of the component that matched */ - @ApiModelProperty( - value = "The group id of the component that matched the search." + @Schema(description = "The group id of the component that matched the search." ) public String getGroupId() { return groupId; @@ -65,8 +63,7 @@ public class ComponentSearchResultDTO { /** * @return parent group of the component that matched */ - @ApiModelProperty( - value = "The parent group of the component that matched the search." + @Schema(description = "The parent group of the component that matched the search." ) public SearchResultGroupDTO getParentGroup() { return parentGroup; @@ -79,8 +76,7 @@ public class ComponentSearchResultDTO { /** * @return the nearest versioned ancestor group of the component that matched */ - @ApiModelProperty( - value = "The nearest versioned ancestor group of the component that matched the search." + @Schema(description = "The nearest versioned ancestor group of the component that matched the search." ) public SearchResultGroupDTO getVersionedGroup() { return versionedGroup; @@ -93,8 +89,7 @@ public class ComponentSearchResultDTO { /** * @return name of the component that matched */ - @ApiModelProperty( - value = "The name of the component that matched the search." + @Schema(description = "The name of the component that matched the search." ) public String getName() { return name; @@ -107,8 +102,7 @@ public class ComponentSearchResultDTO { /** * @return What matched the search string for this component */ - @ApiModelProperty( - value = "What matched the search from the component." + @Schema(description = "What matched the search from the component." ) public List getMatches() { return matches; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java index 7f5a8860fd..bcc0d6eb60 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.search; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,8 +32,7 @@ public class NodeSearchResultDTO { /** * @return id of the node that was matched */ - @ApiModelProperty( - value = "The id of the node that matched the search." + @Schema(description = "The id of the node that matched the search." ) public String getId() { return id; @@ -46,8 +45,7 @@ public class NodeSearchResultDTO { /** * @return address of the node that was matched */ - @ApiModelProperty( - value = "The address of the node that matched the search." + @Schema(description = "The address of the node that matched the search." ) public String getAddress() { return address; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultGroupDTO.java index 02ce030102..77de477a18 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultGroupDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultGroupDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.search; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,9 +31,8 @@ public class SearchResultGroupDTO { /** * @return id of this group */ - @ApiModelProperty( - value = "The id of the group.", - required = true + @Schema(description = "The id of the group.", + requiredMode = Schema.RequiredMode.REQUIRED ) public String getId() { return id; @@ -46,8 +45,7 @@ public class SearchResultGroupDTO { /** * @return name of this group */ - @ApiModelProperty( - value = "The name of the group." + @Schema(description = "The name of the group." ) public String getName() { return name; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java index 7e43fd902e..3934f328e5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.search; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.ArrayList; @@ -44,8 +44,7 @@ public class SearchResultsDTO { /** * @return The processors that matched the search */ - @ApiModelProperty( - value = "The processors that matched the search." + @Schema(description = "The processors that matched the search." ) public List getProcessorResults() { return processorResults; @@ -58,8 +57,7 @@ public class SearchResultsDTO { /** * @return connections that matched the search */ - @ApiModelProperty( - value = "The connections that matched the search." + @Schema(description = "The connections that matched the search." ) public List getConnectionResults() { return connectionResults; @@ -72,8 +70,7 @@ public class SearchResultsDTO { /** * @return process group that matched the search */ - @ApiModelProperty( - value = "The process groups that matched the search." + @Schema(description = "The process groups that matched the search." ) public List getProcessGroupResults() { return processGroupResults; @@ -86,8 +83,7 @@ public class SearchResultsDTO { /** * @return input ports that matched the search */ - @ApiModelProperty( - value = "The input ports that matched the search." + @Schema(description = "The input ports that matched the search." ) public List getInputPortResults() { return inputPortResults; @@ -96,8 +92,7 @@ public class SearchResultsDTO { /** * @return output ports that matched the search */ - @ApiModelProperty( - value = "The output ports that matched the search." + @Schema(description = "The output ports that matched the search." ) public List getOutputPortResults() { return outputPortResults; @@ -114,8 +109,7 @@ public class SearchResultsDTO { /** * @return remote process groups that matched the search */ - @ApiModelProperty( - value = "The remote process groups that matched the search." + @Schema(description = "The remote process groups that matched the search." ) public List getRemoteProcessGroupResults() { return remoteProcessGroupResults; @@ -128,8 +122,7 @@ public class SearchResultsDTO { /** * @return funnels that matched the search */ - @ApiModelProperty( - value = "The funnels that matched the search." + @Schema(description = "The funnels that matched the search." ) public List getFunnelResults() { return funnelResults; @@ -142,8 +135,7 @@ public class SearchResultsDTO { /** * @return labels that matched the search */ - @ApiModelProperty( - value = "The labels that matched the search." + @Schema(description = "The labels that matched the search." ) public List getLabelResults() { return labelResults; @@ -156,8 +148,7 @@ public class SearchResultsDTO { /** * @return the controller service nodes that matched the search */ - @ApiModelProperty( - value = "The controller service nodes that matched the search" + @Schema(description = "The controller service nodes that matched the search" ) public List getControllerServiceNodeResults() { return controllerServiceNodeResults; @@ -170,8 +161,7 @@ public class SearchResultsDTO { /** * @return the parameter provider nodes that matched the search */ - @ApiModelProperty( - value = "The parameter provider nodes that matched the search" + @Schema(description = "The parameter provider nodes that matched the search" ) public List getParameterProviderNodeResults() { return parameterProviderNodeResults; @@ -184,8 +174,7 @@ public class SearchResultsDTO { /** * @return parameter contexts that matched the search. */ - @ApiModelProperty( - value = "The parameter contexts that matched the search." + @Schema(description = "The parameter contexts that matched the search." ) public List getParameterContextResults() { return parameterContextResults; @@ -198,8 +187,7 @@ public class SearchResultsDTO { /** * @return parameters that matched the search. */ - @ApiModelProperty( - value = "The parameters that matched the search." + @Schema(description = "The parameters that matched the search." ) public List getParameterResults() { return parameterResults; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java index 7792f7fed5..143976e7b0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Collection; @@ -32,8 +32,7 @@ public class ClusterStatusDTO { /** * @return collection of the node status DTOs */ - @ApiModelProperty( - value = "The status of each node." + @Schema(description = "The status of each node." ) public Collection getNodeStatus() { return nodeStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ComponentStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ComponentStatusDTO.java index 175bc3e925..64a0822224 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ComponentStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ComponentStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -39,11 +39,11 @@ public class ComponentStatusDTO{ private Integer activeThreadCount; /** - * Sub-classes should override this method to provide API documentation using ApiModelProperty annotation with allowable values. + * Sub-classes should override this method to provide API documentation using @Schema annotation with allowable values. * @return the run status of the component */ - @ApiModelProperty(value = "The run status of this component", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "The run status of this component", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = "ENABLED, ENABLING, DISABLED, DISABLING") public String getRunStatus() { return runStatus; @@ -53,9 +53,9 @@ public class ComponentStatusDTO{ this.runStatus = runStatus; } - @ApiModelProperty(value = "Indicates whether the component is valid, invalid, or still in the process of validating" + + @Schema(description = "Indicates whether the component is valid, invalid, or still in the process of validating" + " (i.e., it is unknown whether or not the component is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = VALID + ", " + INVALID + ", " + VALIDATING) public String getValidationStatus() { return validationStatus; @@ -68,8 +68,7 @@ public class ComponentStatusDTO{ /** * @return number of active threads for this component */ - @ApiModelProperty( - value = "The number of active threads for the component." + @Schema(description = "The number of active threads for the component." ) public Integer getActiveThreadCount() { return activeThreadCount; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java index 05e6148b3b..de98da796c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -35,7 +35,7 @@ public class ConnectionStatisticsDTO implements Cloneable { private List nodeSnapshots; - @ApiModelProperty("The ID of the connection") + @Schema(description = "The ID of the connection") public String getId() { return id; } @@ -44,7 +44,7 @@ public class ConnectionStatisticsDTO implements Cloneable { this.id = id; } - @ApiModelProperty("The status snapshot that represents the aggregate stats of the cluster") + @Schema(description = "The status snapshot that represents the aggregate stats of the cluster") public ConnectionStatisticsSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; } @@ -53,7 +53,7 @@ public class ConnectionStatisticsDTO implements Cloneable { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A list of status snapshots for each node") + @Schema(description = "A list of status snapshots for each node") public List getNodeSnapshots() { return nodeSnapshots; } @@ -63,9 +63,8 @@ public class ConnectionStatisticsDTO implements Cloneable { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The timestamp of when the stats were last refreshed", - dataType = "string" + @Schema(description = "The timestamp of when the stats were last refreshed", + type = "string" ) public Date getStatsLastRefreshed() { return statsLastRefreshed; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsSnapshotDTO.java index 0ec7606f18..99d7b0d46a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsSnapshotDTO.java @@ -18,7 +18,7 @@ package org.apache.nifi.web.api.dto.status; import jakarta.xml.bind.annotation.XmlType; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * DTO for serializing the statistics of a connection. @@ -40,7 +40,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { /** * @return The connection id */ - @ApiModelProperty("The id of the connection.") + @Schema(description = "The id of the connection.") public String getId() { return id; } @@ -49,7 +49,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.id = id; } - @ApiModelProperty("The predicted number of milliseconds before the connection will have backpressure applied, based on the queued count.") + @Schema(description = "The predicted number of milliseconds before the connection will have backpressure applied, based on the queued count.") public Long getPredictedMillisUntilCountBackpressure() { return predictedMillisUntilCountBackpressure; } @@ -58,7 +58,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.predictedMillisUntilCountBackpressure = predictedMillisUntilCountBackpressure; } - @ApiModelProperty("The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue.") + @Schema(description = "The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue.") public Long getPredictedMillisUntilBytesBackpressure() { return predictedMillisUntilBytesBackpressure; } @@ -67,7 +67,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.predictedMillisUntilBytesBackpressure = predictedMillisUntilBytesBackpressure; } - @ApiModelProperty("The predicted number of queued objects at the next configured interval.") + @Schema(description = "The predicted number of queued objects at the next configured interval.") public Integer getPredictedCountAtNextInterval() { return predictedCountAtNextInterval; } @@ -76,7 +76,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.predictedCountAtNextInterval = predictedCountAtNextInterval; } - @ApiModelProperty("The predicted total number of bytes in the queue at the next configured interval.") + @Schema(description = "The predicted total number of bytes in the queue at the next configured interval.") public Long getPredictedBytesAtNextInterval() { return predictedBytesAtNextInterval; } @@ -85,7 +85,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.predictedBytesAtNextInterval = predictedBytesAtNextInterval; } - @ApiModelProperty("The predicted percentage of queued objects at the next configured interval.") + @Schema(description = "The predicted percentage of queued objects at the next configured interval.") public Integer getPredictedPercentCount() { return predictedPercentCount; } @@ -94,7 +94,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.predictedPercentCount = predictedPercentCount; } - @ApiModelProperty("The predicted percentage of bytes in the queue against current threshold at the next configured interval.") + @Schema(description = "The predicted percentage of bytes in the queue against current threshold at the next configured interval.") public Integer getPredictedPercentBytes() { return predictedPercentBytes; } @@ -103,7 +103,7 @@ public class ConnectionStatisticsSnapshotDTO implements Cloneable { this.predictedPercentBytes = predictedPercentBytes; } - @ApiModelProperty("The prediction interval in seconds") + @Schema(description = "The prediction interval in seconds") public Long getPredictionIntervalMillis() { return predictionIntervalMillis; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java index 2b96b8c287..6989977d3c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -42,7 +42,7 @@ public class ConnectionStatusDTO implements Cloneable { private List nodeSnapshots; - @ApiModelProperty("The ID of the connection") + @Schema(description = "The ID of the connection") public String getId() { return id; } @@ -51,7 +51,7 @@ public class ConnectionStatusDTO implements Cloneable { this.id = id; } - @ApiModelProperty("The ID of the Process Group that the connection belongs to") + @Schema(description = "The ID of the Process Group that the connection belongs to") public String getGroupId() { return groupId; } @@ -60,7 +60,7 @@ public class ConnectionStatusDTO implements Cloneable { this.groupId = groupId; } - @ApiModelProperty("The name of the connection") + @Schema(description = "The name of the connection") public String getName() { return name; } @@ -69,7 +69,7 @@ public class ConnectionStatusDTO implements Cloneable { this.name = name; } - @ApiModelProperty("The ID of the source component") + @Schema(description = "The ID of the source component") public String getSourceId() { return sourceId; } @@ -78,7 +78,7 @@ public class ConnectionStatusDTO implements Cloneable { this.sourceId = sourceId; } - @ApiModelProperty("The name of the source component") + @Schema(description = "The name of the source component") public String getSourceName() { return sourceName; } @@ -87,7 +87,7 @@ public class ConnectionStatusDTO implements Cloneable { this.sourceName = sourceName; } - @ApiModelProperty("The ID of the destination component") + @Schema(description = "The ID of the destination component") public String getDestinationId() { return destinationId; } @@ -96,7 +96,7 @@ public class ConnectionStatusDTO implements Cloneable { this.destinationId = destinationId; } - @ApiModelProperty("The name of the destination component") + @Schema(description = "The name of the destination component") public String getDestinationName() { return destinationName; } @@ -105,7 +105,7 @@ public class ConnectionStatusDTO implements Cloneable { this.destinationName = destinationName; } - @ApiModelProperty("The status snapshot that represents the aggregate stats of the cluster") + @Schema(description = "The status snapshot that represents the aggregate stats of the cluster") public ConnectionStatusSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; } @@ -114,7 +114,7 @@ public class ConnectionStatusDTO implements Cloneable { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A list of status snapshots for each node") + @Schema(description = "A list of status snapshots for each node") public List getNodeSnapshots() { return nodeSnapshots; } @@ -124,9 +124,8 @@ public class ConnectionStatusDTO implements Cloneable { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The timestamp of when the stats were last refreshed", - dataType = "string" + @Schema(description = "The timestamp of when the stats were last refreshed", + type = "string" ) public Date getStatsLastRefreshed() { return statsLastRefreshed; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusPredictionsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusPredictionsSnapshotDTO.java index aa3e9fbdd5..70fc4f115d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusPredictionsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusPredictionsSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -33,7 +33,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { private Integer predictedPercentCount; private Integer predictedPercentBytes; - @ApiModelProperty("The predicted number of milliseconds before the connection will have backpressure applied, based on the queued count.") + @Schema(description = "The predicted number of milliseconds before the connection will have backpressure applied, based on the queued count.") public Long getPredictedMillisUntilCountBackpressure() { return predictedMillisUntilCountBackpressure; } @@ -42,7 +42,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { this.predictedMillisUntilCountBackpressure = predictedMillisUntilCountBackpressure; } - @ApiModelProperty("The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue.") + @Schema(description = "The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue.") public Long getPredictedMillisUntilBytesBackpressure() { return predictedMillisUntilBytesBackpressure; } @@ -51,7 +51,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { this.predictedMillisUntilBytesBackpressure = predictedMillisUntilBytesBackpressure; } - @ApiModelProperty("The predicted number of queued objects at the next configured interval.") + @Schema(description = "The predicted number of queued objects at the next configured interval.") public Integer getPredictedCountAtNextInterval() { return predictedCountAtNextInterval; } @@ -60,7 +60,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { this.predictedCountAtNextInterval = predictedCountAtNextInterval; } - @ApiModelProperty("The configured interval (in seconds) for predicting connection queue count and size (and percent usage).") + @Schema(description = "The configured interval (in seconds) for predicting connection queue count and size (and percent usage).") public Integer getPredictionIntervalSeconds() { return predictionIntervalSeconds; } @@ -69,7 +69,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { this.predictionIntervalSeconds = predictionIntervalSeconds; } - @ApiModelProperty("The predicted total number of bytes in the queue at the next configured interval.") + @Schema(description = "The predicted total number of bytes in the queue at the next configured interval.") public Long getPredictedBytesAtNextInterval() { return predictedBytesAtNextInterval; } @@ -78,7 +78,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { this.predictedBytesAtNextInterval = predictedBytesAtNextInterval; } - @ApiModelProperty("Predicted connection percent use regarding queued flow files count and backpressure threshold if configured.") + @Schema(description = "Predicted connection percent use regarding queued flow files count and backpressure threshold if configured.") public Integer getPredictedPercentCount() { return predictedPercentCount; } @@ -87,7 +87,7 @@ public class ConnectionStatusPredictionsSnapshotDTO implements Cloneable { this.predictedPercentCount = predictedPercentCount; } - @ApiModelProperty("Predicted connection percent use regarding queued flow files size and backpressure threshold if configured.") + @Schema(description = "Predicted connection percent use regarding queued flow files size and backpressure threshold if configured.") public Integer getPredictedPercentBytes() { return predictedPercentBytes; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusSnapshotDTO.java index f117584c14..e876974cee 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -54,7 +54,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return The connection id */ - @ApiModelProperty("The id of the connection.") + @Schema(description = "The id of the connection.") public String getId() { return id; } @@ -66,7 +66,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return the ID of the Process Group to which this connection belongs. */ - @ApiModelProperty("The id of the process group the connection belongs to.") + @Schema(description = "The id of the process group the connection belongs to.") public String getGroupId() { return groupId; } @@ -78,7 +78,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return name of this connection */ - @ApiModelProperty("The name of the connection.") + @Schema(description = "The name of the connection.") public String getName() { return name; } @@ -90,7 +90,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return total count of flow files that are queued */ - @ApiModelProperty("The number of flowfiles that are queued, pretty printed.") + @Schema(description = "The number of flowfiles that are queued, pretty printed.") public String getQueuedCount() { return queuedCount; } @@ -103,7 +103,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return total size of flow files that are queued */ - @ApiModelProperty("The total size of flowfiles that are queued formatted.") + @Schema(description = "The total size of flowfiles that are queued formatted.") public String getQueuedSize() { return queuedSize; } @@ -128,7 +128,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return The total count and size of queued flow files */ - @ApiModelProperty("The total count and size of queued flowfiles formatted.") + @Schema(description = "The total count and size of queued flowfiles formatted.") public String getQueued() { return queued; } @@ -137,7 +137,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return id of the source of this connection */ - @ApiModelProperty("The id of the source of the connection.") + @Schema(description = "The id of the source of the connection.") public String getSourceId() { return sourceId; } @@ -149,7 +149,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return name of the source of this connection */ - @ApiModelProperty("The name of the source of the connection.") + @Schema(description = "The name of the source of the connection.") public String getSourceName() { return sourceName; } @@ -161,7 +161,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return id of the destination of this connection */ - @ApiModelProperty("The id of the destination of the connection.") + @Schema(description = "The id of the destination of the connection.") public String getDestinationId() { return destinationId; } @@ -173,7 +173,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return name of the destination of this connection */ - @ApiModelProperty("The name of the destination of the connection.") + @Schema(description = "The name of the destination of the connection.") public String getDestinationName() { return destinationName; } @@ -185,7 +185,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return predictions for this connection */ - @ApiModelProperty("Predictions, if available, for this connection (null if not available)") + @Schema(description = "Predictions, if available, for this connection (null if not available)") public ConnectionStatusPredictionsSnapshotDTO getPredictions() { return predictions; } @@ -197,7 +197,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return input for this connection */ - @ApiModelProperty("The input count/size for the connection in the last 5 minutes, pretty printed.") + @Schema(description = "The input count/size for the connection in the last 5 minutes, pretty printed.") public String getInput() { return input; } @@ -206,13 +206,13 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { /** * @return output for this connection */ - @ApiModelProperty("The output count/sie for the connection in the last 5 minutes, pretty printed.") + @Schema(description = "The output count/sie for the connection in the last 5 minutes, pretty printed.") public String getOutput() { return output; } - @ApiModelProperty("The number of FlowFiles that have come into the connection in the last 5 minutes.") + @Schema(description = "The number of FlowFiles that have come into the connection in the last 5 minutes.") public Integer getFlowFilesIn() { return flowFilesIn; } @@ -221,7 +221,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.flowFilesIn = flowFilesIn; } - @ApiModelProperty("The size of the FlowFiles that have come into the connection in the last 5 minutes.") + @Schema(description = "The size of the FlowFiles that have come into the connection in the last 5 minutes.") public Long getBytesIn() { return bytesIn; } @@ -230,7 +230,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.bytesIn = bytesIn; } - @ApiModelProperty("The number of FlowFiles that have left the connection in the last 5 minutes.") + @Schema(description = "The number of FlowFiles that have left the connection in the last 5 minutes.") public Integer getFlowFilesOut() { return flowFilesOut; } @@ -239,7 +239,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.flowFilesOut = flowFilesOut; } - @ApiModelProperty("The number of bytes that have left the connection in the last 5 minutes.") + @Schema(description = "The number of bytes that have left the connection in the last 5 minutes.") public Long getBytesOut() { return bytesOut; } @@ -248,7 +248,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.bytesOut = bytesOut; } - @ApiModelProperty("The number of FlowFiles that are currently queued in the connection.") + @Schema(description = "The number of FlowFiles that are currently queued in the connection.") public Integer getFlowFilesQueued() { return flowFilesQueued; } @@ -257,7 +257,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.flowFilesQueued = flowFilesQueued; } - @ApiModelProperty("The size of the FlowFiles that are currently queued in the connection.") + @Schema(description = "The size of the FlowFiles that are currently queued in the connection.") public Long getBytesQueued() { return bytesQueued; } @@ -266,7 +266,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.bytesQueued = bytesQueued; } - @ApiModelProperty("Connection percent use regarding queued flow files count and backpressure threshold if configured.") + @Schema(description = "Connection percent use regarding queued flow files count and backpressure threshold if configured.") public Integer getPercentUseCount() { return percentUseCount; } @@ -275,7 +275,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.percentUseCount = percentUseCount; } - @ApiModelProperty("Connection percent use regarding queued flow files size and backpressure threshold if configured.") + @Schema(description = "Connection percent use regarding queued flow files size and backpressure threshold if configured.") public Integer getPercentUseBytes() { return percentUseBytes; } @@ -284,7 +284,7 @@ public class ConnectionStatusSnapshotDTO implements Cloneable { this.percentUseBytes = percentUseBytes; } - @ApiModelProperty("The availability of FlowFiles in this connection") + @Schema(description = "The availability of FlowFiles in this connection") public String getFlowFileAvailability() { return flowFileAvailability; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerServiceStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerServiceStatusDTO.java index 6f67682e76..f6e97ac234 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerServiceStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerServiceStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -27,8 +27,8 @@ import jakarta.xml.bind.annotation.XmlType; @XmlType(name = "controllerServiceStatus") public class ControllerServiceStatusDTO extends ComponentStatusDTO { - @ApiModelProperty(value = "The run status of this ControllerService", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "The run status of this ControllerService", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = "ENABLED, ENABLING, DISABLED, DISABLING") @Override public String getRunStatus() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java index bfea16cb97..42a79a68cb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -50,7 +50,7 @@ public class ControllerStatusDTO implements Cloneable { * * @return The active thread count */ - @ApiModelProperty("The number of active threads in the NiFi.") + @Schema(description = "The number of active threads in the NiFi.") public Integer getActiveThreadCount() { return activeThreadCount; } @@ -64,7 +64,7 @@ public class ControllerStatusDTO implements Cloneable { * * @return The terminated thread count */ - @ApiModelProperty("The number of terminated threads in the NiFi.") + @Schema(description = "The number of terminated threads in the NiFi.") public Integer getTerminatedThreadCount() { return terminatedThreadCount; } @@ -76,7 +76,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return queue for the controller */ - @ApiModelProperty("The number of flowfiles queued in the NiFi.") + @Schema(description = "The number of flowfiles queued in the NiFi.") public String getQueued() { return queued; } @@ -88,7 +88,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return number of running components in this controller */ - @ApiModelProperty("The number of running components in the NiFi.") + @Schema(description = "The number of running components in the NiFi.") public Integer getRunningCount() { return runningCount; } @@ -100,7 +100,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return number of stopped components in this controller */ - @ApiModelProperty("The number of stopped components in the NiFi.") + @Schema(description = "The number of stopped components in the NiFi.") public Integer getStoppedCount() { return stoppedCount; } @@ -112,7 +112,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return number of invalid components in this controller */ - @ApiModelProperty("The number of invalid components in the NiFi.") + @Schema(description = "The number of invalid components in the NiFi.") public Integer getInvalidCount() { return invalidCount; } @@ -124,7 +124,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return number of disabled components in this controller */ - @ApiModelProperty("The number of disabled components in the NiFi.") + @Schema(description = "The number of disabled components in the NiFi.") public Integer getDisabledCount() { return disabledCount; } @@ -136,7 +136,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return number of active remote ports in this controller */ - @ApiModelProperty("The number of active remote ports in the NiFi.") + @Schema(description = "The number of active remote ports in the NiFi.") public Integer getActiveRemotePortCount() { return activeRemotePortCount; } @@ -148,7 +148,7 @@ public class ControllerStatusDTO implements Cloneable { /** * @return number of inactive remote ports in this controller */ - @ApiModelProperty("The number of inactive remote ports in the NiFi.") + @Schema(description = "The number of inactive remote ports in the NiFi.") public Integer getInactiveRemotePortCount() { return inactiveRemotePortCount; } @@ -157,7 +157,7 @@ public class ControllerStatusDTO implements Cloneable { this.inactiveRemotePortCount = inactiveRemotePortCount; } - @ApiModelProperty("The number of FlowFiles queued across the entire flow") + @Schema(description = "The number of FlowFiles queued across the entire flow") public Integer getFlowFilesQueued() { return flowFilesQueued; } @@ -166,7 +166,7 @@ public class ControllerStatusDTO implements Cloneable { this.flowFilesQueued = flowFilesQueued; } - @ApiModelProperty("The size of the FlowFiles queued across the entire flow") + @Schema(description = "The size of the FlowFiles queued across the entire flow") public Long getBytesQueued() { return bytesQueued; } @@ -175,7 +175,7 @@ public class ControllerStatusDTO implements Cloneable { this.bytesQueued = bytesQueued; } - @ApiModelProperty("The number of up to date versioned process groups in the NiFi.") + @Schema(description = "The number of up to date versioned process groups in the NiFi.") public Integer getUpToDateCount() { return upToDateCount; } @@ -184,7 +184,7 @@ public class ControllerStatusDTO implements Cloneable { this.upToDateCount = upToDateCount; } - @ApiModelProperty("The number of locally modified versioned process groups in the NiFi.") + @Schema(description = "The number of locally modified versioned process groups in the NiFi.") public Integer getLocallyModifiedCount() { return locallyModifiedCount; } @@ -193,7 +193,7 @@ public class ControllerStatusDTO implements Cloneable { this.locallyModifiedCount = locallyModifiedCount; } - @ApiModelProperty("The number of stale versioned process groups in the NiFi.") + @Schema(description = "The number of stale versioned process groups in the NiFi.") public Integer getStaleCount() { return staleCount; } @@ -202,7 +202,7 @@ public class ControllerStatusDTO implements Cloneable { this.staleCount = staleCount; } - @ApiModelProperty("The number of locally modified and stale versioned process groups in the NiFi.") + @Schema(description = "The number of locally modified and stale versioned process groups in the NiFi.") public Integer getLocallyModifiedAndStaleCount() { return locallyModifiedAndStaleCount; } @@ -211,7 +211,7 @@ public class ControllerStatusDTO implements Cloneable { this.locallyModifiedAndStaleCount = locallyModifiedAndStaleCount; } - @ApiModelProperty("The number of versioned process groups in the NiFi that are unable to sync to a registry.") + @Schema(description = "The number of versioned process groups in the NiFi that are unable to sync to a registry.") public Integer getSyncFailureCount() { return syncFailureCount; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/FlowAnalysisRuleStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/FlowAnalysisRuleStatusDTO.java index 1b19fab2e3..a4897f6d54 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/FlowAnalysisRuleStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/FlowAnalysisRuleStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -27,8 +27,8 @@ import jakarta.xml.bind.annotation.XmlType; @XmlType(name = "flowAnalysisRuleStatus") public class FlowAnalysisRuleStatusDTO extends ComponentStatusDTO { - @ApiModelProperty(value = "The run status of this FlowAnalysisRule", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "The run status of this FlowAnalysisRule", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = "ENABLED, DISABLED") @Override public String getRunStatus() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatisticsSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatisticsSnapshotDTO.java index 0d79476fc8..319da96501 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatisticsSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatisticsSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class NodeConnectionStatisticsSnapshotDTO implements Cloneable { private ConnectionStatisticsSnapshotDTO statisticsSnapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeConnectionStatisticsSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeConnectionStatisticsSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeConnectionStatisticsSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The connection status snapshot from the node.") + @Schema(description = "The connection status snapshot from the node.") public ConnectionStatisticsSnapshotDTO getStatisticsSnapshot() { return statisticsSnapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusSnapshotDTO.java index 081e06ad0c..d426bc7d48 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class NodeConnectionStatusSnapshotDTO implements Cloneable { private ConnectionStatusSnapshotDTO statusSnapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeConnectionStatusSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeConnectionStatusSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeConnectionStatusSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The connection status snapshot from the node.") + @Schema(description = "The connection status snapshot from the node.") public ConnectionStatusSnapshotDTO getStatusSnapshot() { return statusSnapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java index 597e5cc3fe..8ad3f9e25d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.NodeDTO; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class NodePortStatusDTO { /** * @return the node */ - @ApiModelProperty( - value = "The node." + @Schema(description = "The node." ) public NodeDTO getNode() { return node; @@ -47,8 +46,7 @@ public class NodePortStatusDTO { /** * @return port status */ - @ApiModelProperty( - value = "The port status from the node." + @Schema(description = "The port status from the node." ) public PortStatusDTO getPortStatus() { return portStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusSnapshotDTO.java index 9abb795876..ed6d0b1a7e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class NodePortStatusSnapshotDTO implements Cloneable { private PortStatusSnapshotDTO statusSnapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodePortStatusSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodePortStatusSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodePortStatusSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The port status snapshot from the node.") + @Schema(description = "The port status snapshot from the node.") public PortStatusSnapshotDTO getStatusSnapshot() { return statusSnapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessGroupStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessGroupStatusSnapshotDTO.java index 8f6131a306..6462dc95ac 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessGroupStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessGroupStatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class NodeProcessGroupStatusSnapshotDTO implements Cloneable { @@ -26,7 +26,7 @@ public class NodeProcessGroupStatusSnapshotDTO implements Cloneable { private ProcessGroupStatusSnapshotDTO statusSnapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -35,7 +35,7 @@ public class NodeProcessGroupStatusSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -44,7 +44,7 @@ public class NodeProcessGroupStatusSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -53,7 +53,7 @@ public class NodeProcessGroupStatusSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The process group status snapshot from the node.") + @Schema(description = "The process group status snapshot from the node.") public ProcessGroupStatusSnapshotDTO getStatusSnapshot() { return statusSnapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusSnapshotDTO.java index f95e08a00a..c08230a729 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -32,7 +32,7 @@ public class NodeProcessorStatusSnapshotDTO implements Cloneable { private ProcessorStatusSnapshotDTO statusSnapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -41,7 +41,7 @@ public class NodeProcessorStatusSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -50,7 +50,7 @@ public class NodeProcessorStatusSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -59,7 +59,7 @@ public class NodeProcessorStatusSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The processor status snapshot from the node.") + @Schema(description = "The processor status snapshot from the node.") public ProcessorStatusSnapshotDTO getStatusSnapshot() { return statusSnapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusSnapshotDTO.java index 47985dd1ee..8b1b839b8b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusSnapshotDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -29,7 +29,7 @@ public class NodeRemoteProcessGroupStatusSnapshotDTO implements Cloneable { private RemoteProcessGroupStatusSnapshotDTO statusSnapshot; - @ApiModelProperty("The unique ID that identifies the node") + @Schema(description = "The unique ID that identifies the node") public String getNodeId() { return nodeId; } @@ -38,7 +38,7 @@ public class NodeRemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.nodeId = nodeId; } - @ApiModelProperty("The API address of the node") + @Schema(description = "The API address of the node") public String getAddress() { return address; } @@ -47,7 +47,7 @@ public class NodeRemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.address = address; } - @ApiModelProperty("The API port used to communicate with the node") + @Schema(description = "The API port used to communicate with the node") public Integer getApiPort() { return apiPort; } @@ -56,7 +56,7 @@ public class NodeRemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.apiPort = apiPort; } - @ApiModelProperty("The remote process group status snapshot from the node.") + @Schema(description = "The remote process group status snapshot from the node.") public RemoteProcessGroupStatusSnapshotDTO getStatusSnapshot() { return statusSnapshot; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java index 4c2d12ceb0..6fcf1152e7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.NodeDTO; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class NodeStatusDTO { /** * @return the node */ - @ApiModelProperty( - value = "The node." + @Schema(description = "The node." ) public NodeDTO getNode() { return node; @@ -47,8 +46,7 @@ public class NodeStatusDTO { /** * @return the controller status */ - @ApiModelProperty( - value = "The controller status for each node." + @Schema(description = "The controller status for each node." ) public ProcessGroupStatusDTO getControllerStatus() { return controllerStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusSnapshotsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusSnapshotsDTO.java index d8a4c6456c..c5db00ae62 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusSnapshotsDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusSnapshotsDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.List; @@ -35,8 +35,7 @@ public class NodeStatusSnapshotsDTO { /** * @return node's host/IP address */ - @ApiModelProperty( - value = "The node's host/ip address." + @Schema(description = "The node's host/ip address." ) public String getAddress() { return address; @@ -49,8 +48,7 @@ public class NodeStatusSnapshotsDTO { /** * @return node ID */ - @ApiModelProperty( - value = "The id of the node." + @Schema(description = "The id of the node." ) public String getNodeId() { return nodeId; @@ -63,8 +61,7 @@ public class NodeStatusSnapshotsDTO { /** * @return port the node is listening for API requests */ - @ApiModelProperty( - value = "The port the node is listening for API requests." + @Schema(description = "The port the node is listening for API requests." ) public Integer getApiPort() { return apiPort; @@ -74,7 +71,7 @@ public class NodeStatusSnapshotsDTO { this.apiPort = port; } - @ApiModelProperty("A list of StatusSnapshotDTO objects that provide the actual metric values for the component for this node.") + @Schema(description = "A list of StatusSnapshotDTO objects that provide the actual metric values for the component for this node.") public List getStatusSnapshots() { return statusSnapshots; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java index 248279d527..431e14f6d3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -36,7 +36,7 @@ public class PortStatusDTO { private PortStatusSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty("Whether the port has incoming or outgoing connections to a remote NiFi.") + @Schema(description = "Whether the port has incoming or outgoing connections to a remote NiFi.") public Boolean isTransmitting() { return transmitting; } @@ -46,7 +46,7 @@ public class PortStatusDTO { } - @ApiModelProperty("The id of the port.") + @Schema(description = "The id of the port.") public String getId() { return id; } @@ -56,7 +56,7 @@ public class PortStatusDTO { } - @ApiModelProperty("The id of the parent process group of the port.") + @Schema(description = "The id of the parent process group of the port.") public String getGroupId() { return groupId; } @@ -66,7 +66,7 @@ public class PortStatusDTO { } - @ApiModelProperty("The name of the port.") + @Schema(description = "The name of the port.") public String getName() { return name; } @@ -76,8 +76,7 @@ public class PortStatusDTO { } - @ApiModelProperty( - value="The run status of the port.", + @Schema(description = "The run status of the port.", allowableValues = "Running, Stopped, Validating, Disabled, Invalid") public String getRunStatus() { return runStatus; @@ -87,7 +86,7 @@ public class PortStatusDTO { this.runStatus = runStatus; } - @ApiModelProperty("A status snapshot that represents the aggregate stats of all nodes in the cluster. If the NiFi instance is " + @Schema(description = "A status snapshot that represents the aggregate stats of all nodes in the cluster. If the NiFi instance is " + "a standalone instance, rather than a cluster, this represents the stats of the single instance.") public PortStatusSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; @@ -97,7 +96,7 @@ public class PortStatusDTO { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A status snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + @Schema(description = "A status snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + "a cluster, this may be null.") public List getNodeSnapshots() { return nodeSnapshots; @@ -113,9 +112,8 @@ public class PortStatusDTO { * @return The the status was calculated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The time the status for the process group was last refreshed.", - dataType = "string" + @Schema(description = "The time the status for the process group was last refreshed.", + type = "string" ) public Date getStatsLastRefreshed() { return statsLastRefreshed; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusSnapshotDTO.java index 63bb142227..dad3c74c93 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -44,7 +44,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return whether this port has incoming or outgoing connections to a remote NiFi */ - @ApiModelProperty("Whether the port has incoming or outgoing connections to a remote NiFi.") + @Schema(description = "Whether the port has incoming or outgoing connections to a remote NiFi.") public Boolean isTransmitting() { return transmitting; } @@ -56,7 +56,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return the active thread count for this port */ - @ApiModelProperty("The active thread count for the port.") + @Schema(description = "The active thread count for the port.") public Integer getActiveThreadCount() { return activeThreadCount; } @@ -68,7 +68,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return id of this port */ - @ApiModelProperty("The id of the port.") + @Schema(description = "The id of the port.") public String getId() { return id; } @@ -80,7 +80,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return id of the group this port resides in */ - @ApiModelProperty("The id of the parent process group of the port.") + @Schema(description = "The id of the parent process group of the port.") public String getGroupId() { return groupId; } @@ -92,7 +92,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return name of this port */ - @ApiModelProperty("The name of the port.") + @Schema(description = "The name of the port.") public String getName() { return name; } @@ -104,9 +104,10 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return run status of this port */ - @ApiModelProperty( - value="The run status of the port.", - allowableValues = "Running, Stopped, Validating, Disabled, Invalid") + @Schema( + description = "The run status of the port.", + allowableValues = "Running, Stopped, Validating, Disabled, Invalid" + ) public String getRunStatus() { return runStatus; } @@ -118,7 +119,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return The total count and size of flow files that have been accepted in the last five minutes */ - @ApiModelProperty("The count/size of flowfiles that have been accepted in the last 5 minutes.") + @Schema(description = "The count/size of flowfiles that have been accepted in the last 5 minutes.") public String getInput() { return input; } @@ -130,7 +131,7 @@ public class PortStatusSnapshotDTO implements Cloneable { /** * @return The total count and size of flow files that have been processed in the last five minutes */ - @ApiModelProperty("The count/size of flowfiles that have been processed in the last 5 minutes.") + @Schema(description = "The count/size of flowfiles that have been processed in the last 5 minutes.") public String getOutput() { return output; } @@ -139,7 +140,7 @@ public class PortStatusSnapshotDTO implements Cloneable { this.output = output; } - @ApiModelProperty("The number of FlowFiles that have been accepted in the last 5 minutes.") + @Schema(description = "The number of FlowFiles that have been accepted in the last 5 minutes.") public Integer getFlowFilesIn() { return flowFilesIn; } @@ -148,7 +149,7 @@ public class PortStatusSnapshotDTO implements Cloneable { this.flowFilesIn = flowFilesIn; } - @ApiModelProperty("The size of hte FlowFiles that have been accepted in the last 5 minutes.") + @Schema(description = "The size of hte FlowFiles that have been accepted in the last 5 minutes.") public Long getBytesIn() { return bytesIn; } @@ -157,7 +158,7 @@ public class PortStatusSnapshotDTO implements Cloneable { this.bytesIn = bytesIn; } - @ApiModelProperty("The number of FlowFiles that have been processed in the last 5 minutes.") + @Schema(description = "The number of FlowFiles that have been processed in the last 5 minutes.") public Integer getFlowFilesOut() { return flowFilesOut; } @@ -166,7 +167,7 @@ public class PortStatusSnapshotDTO implements Cloneable { this.flowFilesOut = flowFilesOut; } - @ApiModelProperty("The number of bytes that have been processed in the last 5 minutes.") + @Schema(description = "The number of bytes that have been processed in the last 5 minutes.") public Long getBytesOut() { return bytesOut; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java index 936ba3c539..7efb712f8a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -34,7 +34,7 @@ public class ProcessGroupStatusDTO implements Cloneable { private ProcessGroupStatusSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty("The ID of the Process Group") + @Schema(description = "The ID of the Process Group") public String getId() { return id; } @@ -43,7 +43,7 @@ public class ProcessGroupStatusDTO implements Cloneable { this.id = id; } - @ApiModelProperty("The name of the Process Group") + @Schema(description = "The name of the Process Group") public String getName() { return name; } @@ -52,7 +52,7 @@ public class ProcessGroupStatusDTO implements Cloneable { this.name = name; } - @ApiModelProperty("The aggregate status of all nodes in the cluster") + @Schema(description = "The aggregate status of all nodes in the cluster") public ProcessGroupStatusSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; } @@ -61,7 +61,7 @@ public class ProcessGroupStatusDTO implements Cloneable { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("The status reported by each node in the cluster. If the NiFi instance is a standalone instance, rather than " + @Schema(description = "The status reported by each node in the cluster. If the NiFi instance is a standalone instance, rather than " + "a clustered instance, this value may be null.") public List getNodeSnapshots() { return nodeSnapshots; @@ -77,9 +77,8 @@ public class ProcessGroupStatusDTO implements Cloneable { * @return The the status was calculated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The time the status for the process group was last refreshed.", - dataType = "string" + @Schema(description = "The time the status for the process group was last refreshed.", + type = "string" ) public Date getStatsLastRefreshed() { return statsLastRefreshed; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java index 06b34b0821..5c17989649 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiModelProperty.AccessMode; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.entity.ConnectionStatusSnapshotEntity; import org.apache.nifi.web.api.entity.PortStatusSnapshotEntity; import org.apache.nifi.web.api.entity.ProcessGroupStatusSnapshotEntity; @@ -87,7 +86,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The id for the process group */ - @ApiModelProperty("The id of the process group.") + @Schema(description = "The id of the process group.") public String getId() { return id; } @@ -99,7 +98,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return name of this process group */ - @ApiModelProperty("The name of this process group.") + @Schema(description = "The name of this process group.") public String getName() { return name; } @@ -108,8 +107,8 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.name = name; } - @ApiModelProperty(accessMode = ApiModelProperty.AccessMode.READ_ONLY, - value = "The current state of the Process Group, as it relates to the Versioned Flow", + @Schema(description = "The current state of the Process Group, as it relates to the Versioned Flow", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = "LOCALLY_MODIFIED, STALE, LOCALLY_MODIFIED_AND_STALE, UP_TO_DATE, SYNC_FAILURE") public String getVersionedFlowState() { return versionedFlowState; @@ -119,8 +118,10 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.versionedFlowState = versionedFlowState; } - @ApiModelProperty(accessMode = AccessMode.READ_ONLY, - value = "The current number of active threads for the Process Group, when running in Stateless mode.") + @Schema( + description = "The current number of active threads for the Process Group, when running in Stateless mode.", + accessMode = Schema.AccessMode.READ_ONLY + ) public int getStatelessActiveThreadCount() { return statelessActiveThreadCount; } @@ -132,7 +133,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return active thread count for this process group */ - @ApiModelProperty("The active thread count for this process group.") + @Schema(description = "The active thread count for this process group.") public Integer getActiveThreadCount() { return activeThreadCount; } @@ -144,7 +145,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return number of threads currently terminated for this process group */ - @ApiModelProperty("The number of threads currently terminated for the process group.") + @Schema(description = "The number of threads currently terminated for the process group.") public Integer getTerminatedThreadCount() { return terminatedThreadCount; } @@ -158,7 +159,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The status of all connections */ - @ApiModelProperty("The status of all connections in the process group.") + @Schema(description = "The status of all connections in the process group.") public Collection getConnectionStatusSnapshots() { return connectionStatusSnapshots; } @@ -172,7 +173,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The status of all process groups */ - @ApiModelProperty("The status of all process groups in the process group.") + @Schema(description = "The status of all process groups in the process group.") public Collection getProcessGroupStatusSnapshots() { return processGroupStatusSnapshots; } @@ -186,7 +187,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The status of all remote process groups */ - @ApiModelProperty("The status of all remote process groups in the process group.") + @Schema(description = "The status of all remote process groups in the process group.") public Collection getRemoteProcessGroupStatusSnapshots() { return remoteProcessGroupStatusSnapshots; } @@ -200,7 +201,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The status of all processors */ - @ApiModelProperty("The status of all processors in the process group.") + @Schema(description = "The status of all processors in the process group.") public Collection getProcessorStatusSnapshots() { return processorStatusSnapshots; } @@ -214,7 +215,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The status of all input ports */ - @ApiModelProperty("The status of all input ports in the process group.") + @Schema(description = "The status of all input ports in the process group.") public Collection getInputPortStatusSnapshots() { return inputPortStatusSnapshots; } @@ -228,7 +229,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The status of all output ports */ - @ApiModelProperty("The status of all output ports in the process group.") + @Schema(description = "The status of all output ports in the process group.") public Collection getOutputPortStatusSnapshots() { return outputPortStatusSnapshots; } @@ -242,7 +243,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The output stats */ - @ApiModelProperty("The output count/size for the process group in the last 5 minutes.") + @Schema(description = "The output count/size for the process group in the last 5 minutes.") public String getOutput() { return output; } @@ -252,7 +253,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The transferred status for this process group */ - @ApiModelProperty("The count/size transferred to/from queues in the process group in the last 5 minutes.") + @Schema(description = "The count/size transferred to/from queues in the process group in the last 5 minutes.") public String getTransferred() { return transferred; } @@ -262,7 +263,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The received stats for this process group */ - @ApiModelProperty("The count/size sent to the process group in the last 5 minutes.") + @Schema(description = "The count/size sent to the process group in the last 5 minutes.") public String getReceived() { return received; } @@ -273,7 +274,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The sent stats for this process group */ - @ApiModelProperty("The count/size sent from this process group in the last 5 minutes.") + @Schema(description = "The count/size sent from this process group in the last 5 minutes.") public String getSent() { return sent; } @@ -284,7 +285,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The queued count for this process group */ - @ApiModelProperty("The count that is queued for the process group.") + @Schema(description = "The count that is queued for the process group.") public String getQueuedCount() { return queuedCount; } @@ -295,7 +296,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The queued size for this process group */ - @ApiModelProperty("The size that is queued for the process group.") + @Schema(description = "The size that is queued for the process group.") public String getQueuedSize() { return queuedSize; } @@ -306,7 +307,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The queued stats */ - @ApiModelProperty("The count/size that is queued in the the process group.") + @Schema(description = "The count/size that is queued in the the process group.") public String getQueued() { return queued; } @@ -317,7 +318,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The read stats */ - @ApiModelProperty("The number of bytes read in the last 5 minutes.") + @Schema(description = "The number of bytes read in the last 5 minutes.") public String getRead() { return read; } @@ -328,7 +329,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The written stats */ - @ApiModelProperty("The number of bytes written in the last 5 minutes.") + @Schema(description = "The number of bytes written in the last 5 minutes.") public String getWritten() { return written; } @@ -339,13 +340,13 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { * * @return The input stats */ - @ApiModelProperty("The input count/size for the process group in the last 5 minutes (pretty printed).") + @Schema(description = "The input count/size for the process group in the last 5 minutes (pretty printed).") public String getInput() { return input; } - @ApiModelProperty("The number of FlowFiles that have come into this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of FlowFiles that have come into this ProcessGroup in the last 5 minutes") public Integer getFlowFilesIn() { return flowFilesIn; } @@ -354,7 +355,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesIn = flowFilesIn; } - @ApiModelProperty("The number of bytes that have come into this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes that have come into this ProcessGroup in the last 5 minutes") public Long getBytesIn() { return bytesIn; } @@ -363,7 +364,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesIn = bytesIn; } - @ApiModelProperty("The number of FlowFiles that are queued up in this ProcessGroup right now") + @Schema(description = "The number of FlowFiles that are queued up in this ProcessGroup right now") public Integer getFlowFilesQueued() { return flowFilesQueued; } @@ -372,7 +373,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesQueued = flowFilesQueued; } - @ApiModelProperty("The number of bytes that are queued up in this ProcessGroup right now") + @Schema(description = "The number of bytes that are queued up in this ProcessGroup right now") public Long getBytesQueued() { return bytesQueued; } @@ -381,7 +382,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesQueued = bytesQueued; } - @ApiModelProperty("The number of bytes read by components in this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes read by components in this ProcessGroup in the last 5 minutes") public Long getBytesRead() { return bytesRead; } @@ -390,7 +391,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesRead = bytesRead; } - @ApiModelProperty("The number of bytes written by components in this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes written by components in this ProcessGroup in the last 5 minutes") public Long getBytesWritten() { return bytesWritten; } @@ -399,7 +400,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesWritten = bytesWritten; } - @ApiModelProperty("The number of FlowFiles transferred out of this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of FlowFiles transferred out of this ProcessGroup in the last 5 minutes") public Integer getFlowFilesOut() { return flowFilesOut; } @@ -408,7 +409,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesOut = flowFilesOut; } - @ApiModelProperty("The number of bytes transferred out of this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes transferred out of this ProcessGroup in the last 5 minutes") public Long getBytesOut() { return bytesOut; } @@ -417,7 +418,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesOut = bytesOut; } - @ApiModelProperty("The number of FlowFiles transferred in this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of FlowFiles transferred in this ProcessGroup in the last 5 minutes") public Integer getFlowFilesTransferred() { return flowFilesTransferred; } @@ -426,7 +427,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesTransferred = flowFilesTransferred; } - @ApiModelProperty("The number of bytes transferred in this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes transferred in this ProcessGroup in the last 5 minutes") public Long getBytesTransferred() { return bytesTransferred; } @@ -435,7 +436,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesTransferred = bytesTransferred; } - @ApiModelProperty("The number of bytes received from external sources by components within this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes received from external sources by components within this ProcessGroup in the last 5 minutes") public Long getBytesReceived() { return bytesReceived; } @@ -444,7 +445,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesReceived = bytesReceived; } - @ApiModelProperty("The number of bytes sent to an external sink by components within this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of bytes sent to an external sink by components within this ProcessGroup in the last 5 minutes") public Long getBytesSent() { return bytesSent; } @@ -453,7 +454,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesSent = bytesSent; } - @ApiModelProperty("The number of FlowFiles sent to an external sink by components within this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of FlowFiles sent to an external sink by components within this ProcessGroup in the last 5 minutes") public Integer getFlowFilesSent() { return flowFilesSent; } @@ -462,7 +463,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesSent = flowFilesSent; } - @ApiModelProperty("The number of FlowFiles received from external sources by components within this ProcessGroup in the last 5 minutes") + @Schema(description = "The number of FlowFiles received from external sources by components within this ProcessGroup in the last 5 minutes") public Integer getFlowFilesReceived() { return flowFilesReceived; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java index d391fcdd07..36c3f27e43 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -41,7 +41,7 @@ public class ProcessorStatusDTO implements Cloneable { private ProcessorStatusSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty("The unique ID of the process group that the Processor belongs to") + @Schema(description = "The unique ID of the process group that the Processor belongs to") public String getGroupId() { return groupId; } @@ -50,7 +50,7 @@ public class ProcessorStatusDTO implements Cloneable { this.groupId = groupId; } - @ApiModelProperty("The unique ID of the Processor") + @Schema(description = "The unique ID of the Processor") public String getId() { return id; } @@ -59,7 +59,7 @@ public class ProcessorStatusDTO implements Cloneable { this.id = id; } - @ApiModelProperty("The name of the Processor") + @Schema(description = "The name of the Processor") public String getName() { return name; } @@ -68,7 +68,7 @@ public class ProcessorStatusDTO implements Cloneable { this.name = name; } - @ApiModelProperty("The type of the Processor") + @Schema(description = "The type of the Processor") public String getType() { return type; } @@ -77,7 +77,7 @@ public class ProcessorStatusDTO implements Cloneable { this.type = type; } - @ApiModelProperty(value="The run status of the Processor", + @Schema(description = "The run status of the Processor", allowableValues = "Running, Stopped, Validating, Disabled, Invalid") public String getRunStatus() { return runStatus; @@ -88,10 +88,7 @@ public class ProcessorStatusDTO implements Cloneable { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value="The timestamp of when the stats were last refreshed", - dataType = "string" - ) + @Schema(description = "The timestamp of when the stats were last refreshed", type = "string") public Date getStatsLastRefreshed() { return statsLastRefreshed; } @@ -100,7 +97,7 @@ public class ProcessorStatusDTO implements Cloneable { this.statsLastRefreshed = statsLastRefreshed; } - @ApiModelProperty("A status snapshot that represents the aggregate stats of all nodes in the cluster. If the NiFi instance is " + @Schema(description = "A status snapshot that represents the aggregate stats of all nodes in the cluster. If the NiFi instance is " + "a standalone instance, rather than a cluster, this represents the stats of the single instance.") public ProcessorStatusSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; @@ -110,7 +107,7 @@ public class ProcessorStatusDTO implements Cloneable { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A status snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + @Schema(description = "A status snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + "a cluster, this may be null.") public List getNodeSnapshots() { return nodeSnapshots; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusSnapshotDTO.java index 4c3d978595..2e9d1ac245 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -57,7 +57,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return The processor id */ - @ApiModelProperty("The id of the processor.") + @Schema(description = "The id of the processor.") public String getId() { return id; } @@ -69,7 +69,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return The processor name */ - @ApiModelProperty("The name of the prcessor.") + @Schema(description = "The name of the prcessor.") public String getName() { return name; } @@ -81,7 +81,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return The processor type */ - @ApiModelProperty("The type of the processor.") + @Schema(description = "The type of the processor.") public String getType() { return type; } @@ -93,8 +93,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return run status of this processor */ - @ApiModelProperty( - value = "The state of the processor.", + @Schema(description = "The state of the processor.", allowableValues = "Running, Stopped, Validating, Disabled, Invalid" ) public String getRunStatus() { @@ -105,8 +104,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.runStatus = runStatus; } - @ApiModelProperty( - value = "Indicates the node where the process will execute.", + @Schema(description = "Indicates the node where the process will execute.", allowableValues = "ALL, PRIMARY" ) public String getExecutionNode() { @@ -120,7 +118,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return The total count and size of flow files that have been accepted in the last five minutes */ - @ApiModelProperty("The count/size of flowfiles that have been accepted in the last 5 minutes.") + @Schema(description = "The count/size of flowfiles that have been accepted in the last 5 minutes.") public String getInput() { return input; } @@ -132,7 +130,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return number of bytes read */ - @ApiModelProperty("The number of bytes read in the last 5 minutes.") + @Schema(description = "The number of bytes read in the last 5 minutes.") public String getRead() { return read; } @@ -144,7 +142,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return number of bytes written */ - @ApiModelProperty("The number of bytes written in the last 5 minutes.") + @Schema(description = "The number of bytes written in the last 5 minutes.") public String getWritten() { return written; } @@ -156,7 +154,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return the ID of the Process Group to which this processor belongs. */ - @ApiModelProperty("The id of the parent process group to which the processor belongs.") + @Schema(description = "The id of the parent process group to which the processor belongs.") public String getGroupId() { return groupId; } @@ -168,7 +166,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return The total count and size of flow files that have been processed in the last five minutes */ - @ApiModelProperty("The count/size of flowfiles that have been processed in the last 5 minutes.") + @Schema(description = "The count/size of flowfiles that have been processed in the last 5 minutes.") public String getOutput() { return output; } @@ -180,7 +178,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return number of threads currently running for this Processor */ - @ApiModelProperty("The number of threads currently executing in the processor.") + @Schema(description = "The number of threads currently executing in the processor.") public Integer getActiveThreadCount() { return activeThreadCount; } @@ -192,7 +190,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return number of threads currently terminated for this Processor */ - @ApiModelProperty("The number of threads currently terminated for the processor.") + @Schema(description = "The number of threads currently terminated for the processor.") public Integer getTerminatedThreadCount() { return terminatedThreadCount; } @@ -204,7 +202,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return number of task this connectable has had over the last 5 minutes */ - @ApiModelProperty("The total number of task this connectable has completed over the last 5 minutes.") + @Schema(description = "The total number of task this connectable has completed over the last 5 minutes.") public String getTasks() { return tasks; } @@ -216,7 +214,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { /** * @return total duration of all tasks for this connectable over the last 5 minutes */ - @ApiModelProperty("The total duration of all tasks for this connectable over the last 5 minutes.") + @Schema(description = "The total duration of all tasks for this connectable over the last 5 minutes.") public String getTasksDuration() { return tasksDuration; } @@ -225,7 +223,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.tasksDuration = tasksDuration; } - @ApiModelProperty("The number of bytes read by this Processor in the last 5 mintues") + @Schema(description = "The number of bytes read by this Processor in the last 5 mintues") public Long getBytesRead() { return bytesRead; } @@ -234,7 +232,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.bytesRead = bytesRead; } - @ApiModelProperty("The number of bytes written by this Processor in the last 5 minutes") + @Schema(description = "The number of bytes written by this Processor in the last 5 minutes") public Long getBytesWritten() { return bytesWritten; } @@ -243,7 +241,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.bytesWritten = bytesWritten; } - @ApiModelProperty("The number of FlowFiles that have been accepted in the last 5 minutes") + @Schema(description = "The number of FlowFiles that have been accepted in the last 5 minutes") public Integer getFlowFilesIn() { return flowFilesIn; } @@ -252,7 +250,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.flowFilesIn = flowFilesIn; } - @ApiModelProperty("The size of the FlowFiles that have been accepted in the last 5 minutes") + @Schema(description = "The size of the FlowFiles that have been accepted in the last 5 minutes") public Long getBytesIn() { return bytesIn; } @@ -261,7 +259,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.bytesIn = bytesIn; } - @ApiModelProperty("The number of FlowFiles transferred to a Connection in the last 5 minutes") + @Schema(description = "The number of FlowFiles transferred to a Connection in the last 5 minutes") public Integer getFlowFilesOut() { return flowFilesOut; } @@ -270,7 +268,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.flowFilesOut = flowFilesOut; } - @ApiModelProperty("The size of the FlowFiles transferred to a Connection in the last 5 minutes") + @Schema(description = "The size of the FlowFiles transferred to a Connection in the last 5 minutes") public Long getBytesOut() { return bytesOut; } @@ -279,7 +277,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.bytesOut = bytesOut; } - @ApiModelProperty("The number of times this Processor has run in the last 5 minutes") + @Schema(description = "The number of times this Processor has run in the last 5 minutes") public Integer getTaskCount() { return taskCount; } @@ -288,7 +286,7 @@ public class ProcessorStatusSnapshotDTO implements Cloneable { this.taskCount = taskCount; } - @ApiModelProperty("The number of nanoseconds that this Processor has spent running in the last 5 minutes") + @Schema(description = "The number of nanoseconds that this Processor has spent running in the last 5 minutes") public Long getTasksDurationNanos() { return tasksDurationNanos; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java index d7f640239f..0ebb33c742 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -38,7 +38,7 @@ public class RemoteProcessGroupStatusDTO { private RemoteProcessGroupStatusSnapshotDTO aggregateSnapshot; private List nodeSnapshots; - @ApiModelProperty("The unique ID of the process group that the Processor belongs to") + @Schema(description = "The unique ID of the process group that the Processor belongs to") public String getGroupId() { return groupId; } @@ -47,7 +47,7 @@ public class RemoteProcessGroupStatusDTO { this.groupId = groupId; } - @ApiModelProperty("The unique ID of the Processor") + @Schema(description = "The unique ID of the Processor") public String getId() { return id; } @@ -56,7 +56,7 @@ public class RemoteProcessGroupStatusDTO { this.id = id; } - @ApiModelProperty("The name of the remote process group.") + @Schema(description = "The name of the remote process group.") public String getName() { return name; } @@ -65,7 +65,7 @@ public class RemoteProcessGroupStatusDTO { this.name = name; } - @ApiModelProperty("The transmission status of the remote process group.") + @Schema(description = "The transmission status of the remote process group.") public String getTransmissionStatus() { return transmissionStatus; } @@ -74,7 +74,7 @@ public class RemoteProcessGroupStatusDTO { this.transmissionStatus = transmissionStatus; } - @ApiModelProperty("The URI of the target system.") + @Schema(description = "The URI of the target system.") public String getTargetUri() { return targetUri; } @@ -83,7 +83,7 @@ public class RemoteProcessGroupStatusDTO { this.targetUri = targetUri; } - @ApiModelProperty("A status snapshot that represents the aggregate stats of all nodes in the cluster. If the NiFi instance is " + @Schema(description = "A status snapshot that represents the aggregate stats of all nodes in the cluster. If the NiFi instance is " + "a standalone instance, rather than a cluster, this represents the stats of the single instance.") public RemoteProcessGroupStatusSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; @@ -93,7 +93,7 @@ public class RemoteProcessGroupStatusDTO { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("A status snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + @Schema(description = "A status snapshot for each node in the cluster. If the NiFi instance is a standalone instance, rather than " + "a cluster, this may be null.") public List getNodeSnapshots() { return nodeSnapshots; @@ -109,9 +109,8 @@ public class RemoteProcessGroupStatusDTO { * @return The the status was calculated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The time the status for the process group was last refreshed.", - dataType = "string" + @Schema(description = "The time the status for the process group was last refreshed.", + type = "string" ) public Date getStatsLastRefreshed() { return statsLastRefreshed; @@ -121,9 +120,9 @@ public class RemoteProcessGroupStatusDTO { this.statsLastRefreshed = statsLastRefreshed; } - @ApiModelProperty(value = "Indicates whether the component is valid, invalid, or still in the process of validating" + + @Schema(description = "Indicates whether the component is valid, invalid, or still in the process of validating" + " (i.e., it is unknown whether or not the component is valid)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = "VALID, INVALID, VALIDATING") public String getValidationStatus() { return validationStatus; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusSnapshotDTO.java index 2c01dd4423..911552f3da 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -44,7 +44,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return The id for the remote process group */ - @ApiModelProperty("The id of the remote process group.") + @Schema(description = "The id of the remote process group.") public String getId() { return id; } @@ -56,7 +56,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return id of the group this remote process group is in */ - @ApiModelProperty("The id of the parent process group the remote process group resides in.") + @Schema(description = "The id of the parent process group the remote process group resides in.") public String getGroupId() { return groupId; } @@ -68,7 +68,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return URI of the target system */ - @ApiModelProperty("The URI of the target system.") + @Schema(description = "The URI of the target system.") public String getTargetUri() { return targetUri; } @@ -80,7 +80,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return name of this remote process group */ - @ApiModelProperty("The name of the remote process group.") + @Schema(description = "The name of the remote process group.") public String getName() { return name; } @@ -92,7 +92,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return transmission status of this remote process group */ - @ApiModelProperty("The transmission status of the remote process group.") + @Schema(description = "The transmission status of the remote process group.") public String getTransmissionStatus() { return transmissionStatus; } @@ -104,7 +104,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return number of active threads */ - @ApiModelProperty("The number of active threads for the remote process group.") + @Schema(description = "The number of active threads for the remote process group.") public Integer getActiveThreadCount() { return activeThreadCount; } @@ -116,7 +116,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return Formatted description of the amount of data sent to this remote process group */ - @ApiModelProperty("The count/size of the flowfiles sent to the remote process group in the last 5 minutes.") + @Schema(description = "The count/size of the flowfiles sent to the remote process group in the last 5 minutes.") public String getSent() { return sent; } @@ -129,7 +129,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { /** * @return Formatted description of the amount of data received from this remote process group */ - @ApiModelProperty("The count/size of the flowfiles received from the remote process group in the last 5 minutes.") + @Schema(description = "The count/size of the flowfiles received from the remote process group in the last 5 minutes.") public String getReceived() { return received; } @@ -138,7 +138,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.received = received; } - @ApiModelProperty("The number of FlowFiles sent to the remote process group in the last 5 minutes.") + @Schema(description = "The number of FlowFiles sent to the remote process group in the last 5 minutes.") public Integer getFlowFilesSent() { return flowFilesSent; } @@ -147,7 +147,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesSent = flowFilesSent; } - @ApiModelProperty("The size of the FlowFiles sent to the remote process group in the last 5 minutes.") + @Schema(description = "The size of the FlowFiles sent to the remote process group in the last 5 minutes.") public Long getBytesSent() { return bytesSent; } @@ -156,7 +156,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.bytesSent = bytesSent; } - @ApiModelProperty("The number of FlowFiles received from the remote process group in the last 5 minutes.") + @Schema(description = "The number of FlowFiles received from the remote process group in the last 5 minutes.") public Integer getFlowFilesReceived() { return flowFilesReceived; } @@ -165,7 +165,7 @@ public class RemoteProcessGroupStatusSnapshotDTO implements Cloneable { this.flowFilesReceived = flowFilesReceived; } - @ApiModelProperty("The size of the FlowFiles received from the remote process group in the last 5 minutes.") + @Schema(description = "The size of the FlowFiles received from the remote process group in the last 5 minutes.") public Long getBytesReceived() { return bytesReceived; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ReportingTaskStatusDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ReportingTaskStatusDTO.java index e9ee0e7a9e..f7c3859fb3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ReportingTaskStatusDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ReportingTaskStatusDTO.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -31,8 +31,8 @@ public class ReportingTaskStatusDTO extends ComponentStatusDTO { public static final String STOPPED = "STOPPED"; public static final String DISABLED = "DISABLED"; - @ApiModelProperty(value = "The run status of this ReportingTask", - accessMode = ApiModelProperty.AccessMode.READ_ONLY, + @Schema(description = "The run status of this ReportingTask", + accessMode = Schema.AccessMode.READ_ONLY, allowableValues = "RUNNING, STOPPED, DISABLED") @Override public String getRunStatus() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java index f76c89c0ed..b6e3e4feb4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Objects; @@ -51,8 +51,7 @@ public class StatusDescriptorDTO { /** * @return name of this status field */ - @ApiModelProperty( - value = "The name of the status field." + @Schema(description = "The name of the status field." ) public String getField() { return field; @@ -65,8 +64,7 @@ public class StatusDescriptorDTO { /** * @return label of this status field */ - @ApiModelProperty( - value = "The label for the status field." + @Schema(description = "The label for the status field." ) public String getLabel() { return label; @@ -79,8 +77,7 @@ public class StatusDescriptorDTO { /** * @return description of this status field */ - @ApiModelProperty( - value = "The description of the status field." + @Schema(description = "The description of the status field." ) public String getDescription() { return description; @@ -93,8 +90,7 @@ public class StatusDescriptorDTO { /** * @return formatter for this descriptor */ - @ApiModelProperty( - value = "The formatter for the status descriptor." + @Schema(description = "The formatter for the status descriptor." ) public String getFormatter() { return formatter; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java index 87b626220b..1763ac832a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlType; @@ -42,9 +42,8 @@ public class StatusHistoryDTO { * @return when this status history was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "When the status history was generated.", - dataType = "string" + @Schema(description = "When the status history was generated.", + type = "string" ) public Date getGenerated() { return generated; @@ -57,7 +56,7 @@ public class StatusHistoryDTO { /** * @return key/value pairs that describe the component that the status history belongs to */ - @ApiModelProperty("A Map of key/value pairs that describe the component that the status history belongs to") + @Schema(description = "A Map of key/value pairs that describe the component that the status history belongs to") public LinkedHashMap getComponentDetails() { return componentDetails; } @@ -66,7 +65,7 @@ public class StatusHistoryDTO { this.componentDetails = componentDetails; } - @ApiModelProperty("The Descriptors that provide information on each of the metrics provided in the status history") + @Schema(description = "The Descriptors that provide information on each of the metrics provided in the status history") public List getFieldDescriptors() { return fieldDescriptors; } @@ -75,7 +74,7 @@ public class StatusHistoryDTO { this.fieldDescriptors = fieldDescriptors; } - @ApiModelProperty("A list of StatusSnapshotDTO objects that provide the actual metric values for the component. If the NiFi instance " + @Schema(description = "A list of StatusSnapshotDTO objects that provide the actual metric values for the component. If the NiFi instance " + "is clustered, this will represent the aggregate status across all nodes. If the NiFi instance is not clustered, this will represent " + "the status of the entire NiFi instance.") public List getAggregateSnapshots() { @@ -86,7 +85,7 @@ public class StatusHistoryDTO { this.aggregateSnapshots = aggregateSnapshots; } - @ApiModelProperty("The NodeStatusSnapshotsDTO objects that provide the actual metric values for the component, for each node. " + @Schema(description = "The NodeStatusSnapshotsDTO objects that provide the actual metric values for the component, for each node. " + "If the NiFi instance is not clustered, this value will be null.") public List getNodeSnapshots() { return nodeSnapshots; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java index b10675169c..003b8de20a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.dto.status; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; import java.util.Date; @@ -34,8 +34,7 @@ public class StatusSnapshotDTO { /** * @return timestamp of this snapshot */ - @ApiModelProperty( - value = "The timestamp of the snapshot." + @Schema(description = "The timestamp of the snapshot." ) public Date getTimestamp() { return timestamp; @@ -48,8 +47,7 @@ public class StatusSnapshotDTO { /** * @return status metrics */ - @ApiModelProperty( - value = "The status metrics." + @Schema(description = "The status metrics." ) public Map getStatusMetrics() { return statusMetrics; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java index 0d01781d7f..2558b4e5fb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.AccessPolicyDTO; import org.apache.nifi.web.api.dto.util.TimeAdapter; @@ -50,9 +50,8 @@ public class AccessPolicyEntity extends ComponentEntity implements Permissible components; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The id of the ProcessGroup") + @Schema(description = "The id of the ProcessGroup") public String getId() { return id; } @@ -44,7 +44,7 @@ public class ActivateControllerServicesEntity extends Entity { /** * @return The desired state of the descendant components. Possible states are 'RUNNING' and 'STOPPED' */ - @ApiModelProperty(value = "The desired state of the descendant components", + @Schema(description = "The desired state of the descendant components", allowableValues = STATE_ENABLED + ", " + STATE_DISABLED) public String getState() { return state; @@ -54,7 +54,7 @@ public class ActivateControllerServicesEntity extends Entity { this.state = state; } - @ApiModelProperty("Optional services to schedule. If not specified, all authorized descendant controller services will be used.") + @Schema(description = "Optional services to schedule. If not specified, all authorized descendant controller services will be used.") public Map getComponents() { return components; } @@ -63,8 +63,7 @@ public class ActivateControllerServicesEntity extends Entity { this.components = components; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java index a2f80ee98d..e4a8f145a6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.AffectedComponentDTO; import org.apache.nifi.web.api.dto.ProcessGroupNameDTO; @@ -47,7 +47,7 @@ public class AffectedComponentEntity extends ComponentEntity implements Permissi this.component = component; } - @ApiModelProperty("The Process Group that the component belongs to") + @Schema(description = "The Process Group that the component belongs to") public ProcessGroupNameDTO getProcessGroup() { return processGroup; } @@ -56,7 +56,7 @@ public class AffectedComponentEntity extends ComponentEntity implements Permissi this.processGroup = processGroup; } - @ApiModelProperty(value="The type of component referenced", + @Schema(description = "The type of component referenced", allowableValues = AffectedComponentDTO.COMPONENT_TYPE_PROCESSOR + "," + AffectedComponentDTO.COMPONENT_TYPE_CONTROLLER_SERVICE + ", " + AffectedComponentDTO.COMPONENT_TYPE_INPUT_PORT + ", " + AffectedComponentDTO.COMPONENT_TYPE_OUTPUT_PORT + ", " + AffectedComponentDTO.COMPONENT_TYPE_REMOTE_INPUT_PORT + ", " + AffectedComponentDTO.COMPONENT_TYPE_REMOTE_OUTPUT_PORT) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/BulletinEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/BulletinEntity.java index e35f24f5a7..435b5daefb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/BulletinEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/BulletinEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.BulletinDTO; import org.apache.nifi.web.api.dto.ReadablePermission; import org.apache.nifi.web.api.dto.util.TimeAdapter; @@ -90,9 +90,8 @@ public class BulletinEntity extends Entity implements ReadablePermission { * @return When this bulletin was generated. */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "When this bulletin was generated.", - dataType = "string" + @Schema(description = "When this bulletin was generated.", + type = "string" ) public Date getTimestamp() { return timestamp; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java index 35679a4535..f03fa9d5f2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.PositionDTO; import org.apache.nifi.web.api.dto.RevisionDTO; @@ -42,8 +42,7 @@ public class ComponentEntity extends Entity { /** * @return revision for this request/response */ - @ApiModelProperty( - value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." + @Schema(description = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." ) public RevisionDTO getRevision() { return revision; @@ -58,8 +57,7 @@ public class ComponentEntity extends Entity { * * @return The id */ - @ApiModelProperty( - value = "The id of the component." + @Schema(description = "The id of the component." ) public String getId() { return this.id; @@ -74,8 +72,7 @@ public class ComponentEntity extends Entity { * * @return The uri */ - @ApiModelProperty( - value = "The URI for futures requests to the component." + @Schema(description = "The URI for futures requests to the component." ) public String getUri() { return uri; @@ -90,8 +87,7 @@ public class ComponentEntity extends Entity { * * @return The position */ - @ApiModelProperty( - value = "The position of this component in the UI if applicable." + @Schema(description = "The position of this component in the UI if applicable." ) public PositionDTO getPosition() { return position; @@ -106,8 +102,7 @@ public class ComponentEntity extends Entity { * * @return The permissions */ - @ApiModelProperty( - value = "The permissions for this component." + @Schema(description = "The permissions for this component." ) public PermissionsDTO getPermissions() { return permissions; @@ -122,8 +117,7 @@ public class ComponentEntity extends Entity { * * @return The bulletins */ - @ApiModelProperty( - value = "The bulletins for this component." + @Schema(description = "The bulletins for this component." ) public List getBulletins() { return bulletins; @@ -133,8 +127,7 @@ public class ComponentEntity extends Entity { this.bulletins = bulletins; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentReferenceEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentReferenceEntity.java index e3a589c7ec..cc0d1317a2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentReferenceEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentReferenceEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ComponentReferenceDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -34,8 +34,7 @@ public class ComponentReferenceEntity extends ComponentEntity { /** * @return id for the parent group of this component if applicable, null otherwise */ - @ApiModelProperty( - value = "The id of parent process group of this component if applicable." + @Schema(description = "The id of parent process group of this component if applicable." ) public String getParentGroupId() { return parentGroupId; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentRunStatusEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentRunStatusEntity.java index bf4145dbbd..e0849654c9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentRunStatusEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentRunStatusEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; import jakarta.xml.bind.annotation.XmlType; @@ -35,8 +35,7 @@ public abstract class ComponentRunStatusEntity extends Entity { /** * @return revision for this request/response */ - @ApiModelProperty( - value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." + @Schema(description = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." ) public RevisionDTO getRevision() { return revision; @@ -49,8 +48,7 @@ public abstract class ComponentRunStatusEntity extends Entity { * Run status for this component. * @return The run status */ - @ApiModelProperty( - value = "The run status of the component." + @Schema(description = "The run status of the component." ) public String getState() { return this.state; @@ -60,8 +58,7 @@ public abstract class ComponentRunStatusEntity extends Entity { this.state = state; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentStateEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentStateEntity.java index 0d856f58c2..b58d1b81bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentStateEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentStateEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ComponentStateDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -34,8 +34,7 @@ public class ComponentStateEntity extends Entity { * * @return The ComponentStateDTO object */ - @ApiModelProperty( - value = "The component state." + @Schema(description = "The component state." ) public ComponentStateDTO getComponentState() { return componentState; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentValidationResultsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentValidationResultsEntity.java index c2fea0f935..9792997ea6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentValidationResultsEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentValidationResultsEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.List; @@ -25,7 +25,7 @@ import java.util.List; public class ComponentValidationResultsEntity extends Entity { private List componentValidationResults; - @ApiModelProperty("A List of ComponentValidationResultEntity, one for each component that is validated") + @Schema(description = "A List of ComponentValidationResultEntity, one for each component that is validated") public List getValidationResults() { return componentValidationResults; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConfigurationAnalysisEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConfigurationAnalysisEntity.java index 7b395a3d31..8defbafd93 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConfigurationAnalysisEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConfigurationAnalysisEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ConfigurationAnalysisDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -26,7 +26,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; public class ConfigurationAnalysisEntity extends Entity { private ConfigurationAnalysisDTO configurationAnalysis; - @ApiModelProperty("The configuration analysis") + @Schema(description = "The configuration analysis") public ConfigurationAnalysisDTO getConfigurationAnalysis() { return configurationAnalysis; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java index 7ff12f66e2..bfc222847b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ConnectionDTO; import org.apache.nifi.web.api.dto.PositionDTO; import org.apache.nifi.web.api.dto.status.ConnectionStatusDTO; @@ -56,8 +56,7 @@ public class ConnectionEntity extends ComponentEntity implements Permissible getBends() { return bends; @@ -84,8 +82,7 @@ public class ConnectionEntity extends ComponentEntity implements Permissible getBulletins() { return bulletins; } @@ -50,7 +50,7 @@ public class ControllerBulletinsEntity extends Entity { /** * @return Controller service bulletins to be reported to the user */ - @ApiModelProperty("Controller service bulletins to be reported to the user.") + @Schema(description = "Controller service bulletins to be reported to the user.") public List getControllerServiceBulletins() { return controllerServiceBulletins; } @@ -62,7 +62,7 @@ public class ControllerBulletinsEntity extends Entity { /** * @return Reporting task bulletins to be reported to the user */ - @ApiModelProperty("Reporting task bulletins to be reported to the user.") + @Schema(description = "Reporting task bulletins to be reported to the user.") public List getReportingTaskBulletins() { return reportingTaskBulletins; } @@ -74,7 +74,7 @@ public class ControllerBulletinsEntity extends Entity { /** * @return Flow Analysis Rule bulletins to be reported to the user */ - @ApiModelProperty("Flow Analysis Rule bulletins to be reported to the user.") + @Schema(description = "Flow Analysis Rule bulletins to be reported to the user.") public List getFlowAnalysisRuleBulletins() { return flowAnalysisRuleBulletins; } @@ -86,7 +86,7 @@ public class ControllerBulletinsEntity extends Entity { /** * @return Parameter provider bulletins to be reported to the user */ - @ApiModelProperty("Parameter provider bulletins to be reported to the user.") + @Schema(description = "Parameter provider bulletins to be reported to the user.") public List getParameterProviderBulletins() { return parameterProviderBulletins; } @@ -98,7 +98,7 @@ public class ControllerBulletinsEntity extends Entity { /** * @return Flow registry client bulletins to be reported to the user */ - @ApiModelProperty("Flow registry client bulletins to be reported to the user.") + @Schema(description = "Flow registry client bulletins to be reported to the user.") public List getFlowRegistryClientBulletins() { return flowRegistryClientBulletins; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java index 5dcb403a48..0221d9d2ab 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ControllerConfigurationDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.RevisionDTO; @@ -37,8 +37,7 @@ public class ControllerConfigurationEntity extends Entity implements Permissible /** * @return revision for this request/response */ - @ApiModelProperty( - value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." + @Schema(description = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." ) public RevisionDTO getRevision() { if (revision == null) { @@ -57,8 +56,7 @@ public class ControllerConfigurationEntity extends Entity implements Permissible * * @return The ControllerConfigurationDTO object */ - @ApiModelProperty( - value = "The controller configuration." + @Schema(description = "The controller configuration." ) public ControllerConfigurationDTO getComponent() { return controllerConfiguration; @@ -73,8 +71,7 @@ public class ControllerConfigurationEntity extends Entity implements Permissible * * @return The permissions */ - @ApiModelProperty( - value = "The permissions for this component." + @Schema(description = "The permissions for this component." ) public PermissionsDTO getPermissions() { return permissions; @@ -84,8 +81,7 @@ public class ControllerConfigurationEntity extends Entity implements Permissible this.permissions = permissions; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java index 77be2ac36f..3910671f8b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java @@ -18,7 +18,7 @@ package org.apache.nifi.web.api.entity; import jakarta.xml.bind.annotation.XmlRootElement; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ControllerServiceDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.status.ControllerServiceStatusDTO; @@ -37,8 +37,7 @@ public class ControllerServiceEntity extends ComponentEntity implements Permissi /** * @return The id for the parent group of this ControllerService */ - @ApiModelProperty( - value = "The id of parent process group of this ControllerService." + @Schema(description = "The id of parent process group of this ControllerService." ) public String getParentGroupId() { return parentGroupId; @@ -62,8 +61,7 @@ public class ControllerServiceEntity extends ComponentEntity implements Permissi /** * @return The permissions for this component operations */ - @ApiModelProperty( - value = "The permissions for this component operations." + @Schema(description = "The permissions for this component operations." ) @Override public PermissionsDTO getOperatePermissions() { @@ -78,9 +76,8 @@ public class ControllerServiceEntity extends ComponentEntity implements Permissi /** * @return The status for this ControllerService */ - @ApiModelProperty( - value = "The status for this ControllerService.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The status for this ControllerService.", + accessMode = Schema.AccessMode.READ_ONLY ) public ControllerServiceStatusDTO getStatus() { return status; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentEntity.java index d120f19692..647e57ee35 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentEntity.java @@ -19,7 +19,7 @@ package org.apache.nifi.web.api.entity; import jakarta.xml.bind.annotation.XmlRootElement; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ControllerServiceReferencingComponentDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; @@ -47,8 +47,7 @@ public class ControllerServiceReferencingComponentEntity extends ComponentEntity /** * @return The permissions for this component operations */ - @ApiModelProperty( - value = "The permissions for this component operations." + @Schema(description = "The permissions for this component operations." ) @Override public PermissionsDTO getOperatePermissions() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceRunStatusEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceRunStatusEntity.java index f090af4d0d..6110055bf1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceRunStatusEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceRunStatusEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -38,17 +38,18 @@ public class ControllerServiceRunStatusEntity extends ComponentRunStatusEntity { * Run status for this ControllerService. * @return The run status */ - @ApiModelProperty( - value = "The run status of the ControllerService.", + @Schema(description = "The run status of the ControllerService.", allowableValues = "ENABLED, DISABLED" ) public String getState() { return super.getState(); } - @ApiModelProperty( - value = "Indicates whether or not responses should only include fields necessary for rendering the NiFi User Interface. As such, when this value is set to true, some fields may be " + - "returned as null values, and the selected fields may change at any time without notice. As a result, this value should not be set to true by any client other than the UI." + @Schema(description = """ + Indicates whether or not responses should only include fields necessary for rendering the NiFi User Interface. + As such, when this value is set to true, some fields may be returned as null values, and the selected fields may change at any time without notice. + As a result, this value should not be set to true by any client other than the UI. + """ ) public Boolean getUiOnly() { return uiOnly; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java index 0c4904a597..139f2e00bc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlRootElement; @@ -48,9 +48,8 @@ public class ControllerServicesEntity extends Entity { * @return current time on the server */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The current time on the system.", - dataType = "string" + @Schema(description = "The current time on the system.", + type = "string" ) public Date getCurrentTime() { return currentTime; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CopySnippetRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CopySnippetRequestEntity.java index 53dddf50e5..3c228d1158 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CopySnippetRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CopySnippetRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; @@ -31,8 +31,7 @@ public class CopySnippetRequestEntity extends Entity { private Double originY; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty( - value = "The identifier of the snippet." + @Schema(description = "The identifier of the snippet." ) public String getSnippetId() { return snippetId; @@ -42,8 +41,7 @@ public class CopySnippetRequestEntity extends Entity { this.snippetId = snippetId; } - @ApiModelProperty( - value = "The x coordinate of the origin of the bounding box where the new components will be placed." + @Schema(description = "The x coordinate of the origin of the bounding box where the new components will be placed." ) public Double getOriginX() { return originX; @@ -53,8 +51,7 @@ public class CopySnippetRequestEntity extends Entity { this.originX = originX; } - @ApiModelProperty( - value = "The y coordinate of the origin of the bounding box where the new components will be placed." + @Schema(description = "The y coordinate of the origin of the bounding box where the new components will be placed." ) public Double getOriginY() { return originY; @@ -64,8 +61,7 @@ public class CopySnippetRequestEntity extends Entity { this.originY = originY; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CreateActiveRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CreateActiveRequestEntity.java index 4e0c3144bf..78837d6e58 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CreateActiveRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CreateActiveRequestEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; @@ -26,7 +26,7 @@ public class CreateActiveRequestEntity extends Entity { private String processGroupId; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The Process Group ID that this active request will update") + @Schema(description = "The Process Group ID that this active request will update") public String getProcessGroupId() { return processGroupId; } @@ -35,8 +35,7 @@ public class CreateActiveRequestEntity extends Entity { this.processGroupId = processGroupId; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java index 5a54639840..739575d1f5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ComponentRestrictionPermissionDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; @@ -47,7 +47,7 @@ public class CurrentUserEntity extends Entity { /** * @return the user identity being serialized */ - @ApiModelProperty("The user identity being serialized.") + @Schema(description = "The user identity being serialized.") public String getIdentity() { return identity; } @@ -59,7 +59,7 @@ public class CurrentUserEntity extends Entity { /** * @return if the user is anonymous */ - @ApiModelProperty("Whether the current user is anonymous.") + @Schema(description = "Whether the current user is anonymous.") public boolean isAnonymous() { return anonymous; } @@ -71,7 +71,7 @@ public class CurrentUserEntity extends Entity { /** * @return if the use can query provenance */ - @ApiModelProperty("Permissions for querying provenance.") + @Schema(description = "Permissions for querying provenance.") public PermissionsDTO getProvenancePermissions() { return provenancePermissions; } @@ -83,7 +83,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing counters */ - @ApiModelProperty("Permissions for accessing counters.") + @Schema(description = "Permissions for accessing counters.") public PermissionsDTO getCountersPermissions() { return countersPermissions; } @@ -95,7 +95,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing users */ - @ApiModelProperty("Permissions for accessing tenants.") + @Schema(description = "Permissions for accessing tenants.") public PermissionsDTO getTenantsPermissions() { return tenantsPermissions; } @@ -107,7 +107,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing the controller */ - @ApiModelProperty("Permissions for accessing the controller.") + @Schema(description = "Permissions for accessing the controller.") public PermissionsDTO getControllerPermissions() { return controllerPermissions; } @@ -119,7 +119,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing the all policies */ - @ApiModelProperty("Permissions for accessing the policies.") + @Schema(description = "Permissions for accessing the policies.") public PermissionsDTO getPoliciesPermissions() { return policiesPermissions; } @@ -131,7 +131,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing the system */ - @ApiModelProperty("Permissions for accessing system.") + @Schema(description = "Permissions for accessing system.") public PermissionsDTO getSystemPermissions() { return systemPermissions; } @@ -143,7 +143,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing parameter contexts */ - @ApiModelProperty("Permissions for accessing parameter contexts.") + @Schema(description = "Permissions for accessing parameter contexts.") public PermissionsDTO getParameterContextPermissions() { return parameterContextPermissions; } @@ -155,7 +155,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for accessing the restricted components */ - @ApiModelProperty("Permissions for accessing restricted components. Note: the read permission are not used and will always be false.") + @Schema(description = "Permissions for accessing restricted components. Note: the read permission are not used and will always be false.") public PermissionsDTO getRestrictedComponentsPermissions() { return restrictedComponentsPermissions; } @@ -167,7 +167,7 @@ public class CurrentUserEntity extends Entity { /** * @return permissions for specific component restrictions */ - @ApiModelProperty("Permissions for specific component restrictions.") + @Schema(description = "Permissions for specific component restrictions.") public Set getComponentRestrictionPermissions() { return componentRestrictionPermissions; } @@ -179,7 +179,7 @@ public class CurrentUserEntity extends Entity { /** * @return whether the current user can version flows */ - @ApiModelProperty("Whether the current user can version flows.") + @Schema(description = "Whether the current user can version flows.") public boolean isCanVersionFlows() { return canVersionFlows; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleEntity.java index 6683c8a50c..d5929b6b5a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.nifi.web.api.dto.FlowAnalysisRuleDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; @@ -48,7 +48,7 @@ public class FlowAnalysisRuleEntity extends ComponentEntity implements Permissib /** * @return The permissions for this component operations */ - @ApiModelProperty(value = "The permissions for this component operations.") + @Schema(description = "The permissions for this component operations.") @Override public PermissionsDTO getOperatePermissions() { return operatePermissions; @@ -62,7 +62,7 @@ public class FlowAnalysisRuleEntity extends ComponentEntity implements Permissib /** * @return The status for this FlowAnalysisRule */ - @ApiModelProperty(value = "The status for this FlowAnalysisRule.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The status for this FlowAnalysisRule.", accessMode = Schema.AccessMode.READ_ONLY) public FlowAnalysisRuleStatusDTO getStatus() { return status; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleRunStatusEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleRunStatusEntity.java index 8cab7c64e9..25e6bb5857 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleRunStatusEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowAnalysisRuleRunStatusEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -37,8 +37,7 @@ public class FlowAnalysisRuleRunStatusEntity extends ComponentRunStatusEntity { * State of this FlowAnalysisRule. * @return The state */ - @ApiModelProperty( - value = "The state of the FlowAnalysisRule.", + @Schema(description = "The state of the FlowAnalysisRule.", allowableValues = "ENABLED, DISABLED" ) public String getState() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java index fa9a6992c6..d31b796b61 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.flow.FlowBreadcrumbDTO; @@ -39,8 +39,7 @@ public class FlowBreadcrumbEntity extends Entity { * * @return The id */ - @ApiModelProperty( - value = "The id of this ancestor ProcessGroup." + @Schema(description = "The id of this ancestor ProcessGroup." ) public String getId() { return id; @@ -55,8 +54,7 @@ public class FlowBreadcrumbEntity extends Entity { * * @return The permissions */ - @ApiModelProperty( - value = "The permissions for this ancestor ProcessGroup." + @Schema(description = "The permissions for this ancestor ProcessGroup." ) public PermissionsDTO getPermissions() { return permissions; @@ -71,8 +69,7 @@ public class FlowBreadcrumbEntity extends Entity { * * @return The FlowBreadcrumbDTO object */ - @ApiModelProperty( - value = "This breadcrumb." + @Schema(description = "This breadcrumb." ) public FlowBreadcrumbDTO getBreadcrumb() { return breadcrumb; @@ -87,8 +84,7 @@ public class FlowBreadcrumbEntity extends Entity { * * @return The parent breadcrumb for this breadcrumb */ - @ApiModelProperty( - value = "The parent breadcrumb for this breadcrumb." + @Schema(description = "The parent breadcrumb for this breadcrumb." ) public FlowBreadcrumbEntity getParentBreadcrumb() { return parentBreadcrumb; @@ -98,9 +94,11 @@ public class FlowBreadcrumbEntity extends Entity { this.parentBreadcrumb = parentBreadcrumb; } - @ApiModelProperty(accessMode = ApiModelProperty.AccessMode.READ_ONLY, - value = "The current state of the Process Group, as it relates to the Versioned Flow", - allowableValues = "LOCALLY_MODIFIED, STALE, LOCALLY_MODIFIED_AND_STALE, UP_TO_DATE, SYNC_FAILURE") + @Schema( + description = "The current state of the Process Group, as it relates to the Versioned Flow", + allowableValues = "LOCALLY_MODIFIED, STALE, LOCALLY_MODIFIED_AND_STALE, UP_TO_DATE, SYNC_FAILURE", + accessMode = Schema.AccessMode.READ_ONLY + ) public String getVersionedFlowState() { return versionedFlowState; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowComparisonEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowComparisonEntity.java index 1c9539b1bf..5fe4b7e851 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowComparisonEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowComparisonEntity.java @@ -23,13 +23,13 @@ import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.nifi.web.api.dto.ComponentDifferenceDTO; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; @XmlRootElement(name = "flowComparisonEntity") public class FlowComparisonEntity extends Entity { private Set componentDifferences; - @ApiModelProperty("The list of differences for each component in the flow that is not the same between the two flows") + @Schema(description = "The list of differences for each component in the flow that is not the same between the two flows") public Set getComponentDifferences() { return componentDifferences; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowConfigurationEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowConfigurationEntity.java index b87af2f500..802471df67 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowConfigurationEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowConfigurationEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.FlowConfigurationDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -34,8 +34,7 @@ public class FlowConfigurationEntity extends Entity { * * @return The FlowConfigurationDTO object */ - @ApiModelProperty( - value = "The controller configuration." + @Schema(description = "The controller configuration." ) public FlowConfigurationDTO getFlowConfiguration() { return flowConfiguration; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowRegistryClientsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowRegistryClientsEntity.java index 2031fd2559..49ba0ff173 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowRegistryClientsEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowRegistryClientsEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlRootElement; @@ -48,9 +48,8 @@ public class FlowRegistryClientsEntity extends Entity { * @return current time on the server */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The current time on the system.", - dataType = "string" + @Schema(description = "The current time on the system.", + type = "string" ) public Date getCurrentTime() { return currentTime; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowUpdateRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowUpdateRequestEntity.java index cb2df23789..719d6803c8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowUpdateRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowUpdateRequestEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.FlowUpdateRequestDTO; import org.apache.nifi.web.api.dto.RevisionDTO; @@ -25,7 +25,7 @@ public abstract class FlowUpdateRequestEntity ex protected RevisionDTO processGroupRevision; protected T request; - @ApiModelProperty("The revision for the Process Group being updated.") + @Schema(description = "The revision for the Process Group being updated.") public RevisionDTO getProcessGroupRevision() { return processGroupRevision; } @@ -34,7 +34,7 @@ public abstract class FlowUpdateRequestEntity ex this.processGroupRevision = revision; } - @ApiModelProperty("The Process Group Update Request") + @Schema(description = "The Process Group Update Request") public abstract T getRequest(); public abstract void setRequest(T request); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java index d694b5f53a..b94165e4f6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.DimensionsDTO; import org.apache.nifi.web.api.dto.LabelDTO; @@ -61,8 +61,7 @@ public class LabelEntity extends ComponentEntity implements Permissible referencingComponents; - @ApiModelProperty("The Revision of the Parameter Context") + @Schema(description = "The Revision of the Parameter Context") public RevisionDTO getParameterContextRevision() { return parameterContextRevision; } @@ -38,8 +38,8 @@ public class ParameterContextUpdateEntity extends Entity { this.parameterContextRevision = parameterContextRevision; } - @ApiModelProperty(value = "The Parameter Context that is being operated on. This may not be populated until the request has successfully completed.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The Parameter Context that is being operated on. This may not be populated until the request has successfully completed.", + accessMode = Schema.AccessMode.READ_ONLY) public ParameterContextDTO getParameterContext() { return parameterContext; } @@ -48,7 +48,7 @@ public class ParameterContextUpdateEntity extends Entity { this.parameterContext = parameterContext; } - @ApiModelProperty(value = "The components that are referenced by the update.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The components that are referenced by the update.", accessMode = Schema.AccessMode.READ_ONLY) public Set getReferencingComponents() { return referencingComponents; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextUpdateRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextUpdateRequestEntity.java index c3bcbf0d73..52c09a7918 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextUpdateRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextUpdateRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ParameterContextUpdateRequestDTO; import org.apache.nifi.web.api.dto.RevisionDTO; @@ -27,7 +27,7 @@ public class ParameterContextUpdateRequestEntity extends Entity { private RevisionDTO parameterContextRevision; private ParameterContextUpdateRequestDTO request; - @ApiModelProperty("The Revision of the Parameter Context") + @Schema(description = "The Revision of the Parameter Context") public RevisionDTO getParameterContextRevision() { return parameterContextRevision; } @@ -36,7 +36,7 @@ public class ParameterContextUpdateRequestEntity extends Entity { this.parameterContextRevision = parameterContextRevision; } - @ApiModelProperty("The Update Request") + @Schema(description = "The Update Request") public ParameterContextUpdateRequestDTO getRequest() { return request; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextValidationRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextValidationRequestEntity.java index eedee79006..4a2fcc9326 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextValidationRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextValidationRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ParameterContextValidationRequestDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -26,7 +26,7 @@ public class ParameterContextValidationRequestEntity extends Entity { private ParameterContextValidationRequestDTO request; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The Update Request") + @Schema(description = "The Update Request") public ParameterContextValidationRequestDTO getRequest() { return request; } @@ -35,7 +35,7 @@ public class ParameterContextValidationRequestEntity extends Entity { this.request = request; } - @ApiModelProperty("Acknowledges that this node is disconnected to allow for mutable requests to proceed.") + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.") public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextsEntity.java index 0c66dd2b99..08ee5b3f2d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextsEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterContextsEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlRootElement; @@ -29,7 +29,7 @@ public class ParameterContextsEntity extends Entity { private Set parameterContexts; private Date currentTime; - @ApiModelProperty("The Parameter Contexts") + @Schema(description = "The Parameter Contexts") public Set getParameterContexts() { return parameterContexts; } @@ -39,10 +39,9 @@ public class ParameterContextsEntity extends Entity { } @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The current time on the system.", - dataType = "string", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The current time on the system.", + type = "string", + accessMode = Schema.AccessMode.READ_ONLY ) public Date getCurrentTime() { return currentTime; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterEntity.java index e877c77b82..5181f4da75 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ParameterDTO; import org.apache.nifi.web.api.dto.WritablePermission; @@ -27,7 +27,7 @@ public class ParameterEntity extends Entity implements WritablePermission { private Boolean canWrite; private ParameterDTO parameter; - @ApiModelProperty("The parameter information") + @Schema(description = "The parameter information") public ParameterDTO getParameter() { return parameter; } @@ -37,7 +37,7 @@ public class ParameterEntity extends Entity implements WritablePermission { } @Override - @ApiModelProperty(value = "Indicates whether the user can write a given resource.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Indicates whether the user can write a given resource.", accessMode = Schema.AccessMode.READ_ONLY) public Boolean getCanWrite() { return canWrite; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterGroupConfigurationEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterGroupConfigurationEntity.java index 7bfe04ff1b..1a546f83bd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterGroupConfigurationEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterGroupConfigurationEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.parameter.ParameterSensitivity; import jakarta.xml.bind.annotation.XmlType; @@ -33,8 +33,7 @@ public class ParameterGroupConfigurationEntity extends Entity implements Compara private Boolean isSynchronized; private Map parameterSensitivities; - @ApiModelProperty( - value = "The name of the external parameter group to which the provided parameter names apply." + @Schema(description = "The name of the external parameter group to which the provided parameter names apply." ) public String getGroupName() { return groupName; @@ -44,8 +43,7 @@ public class ParameterGroupConfigurationEntity extends Entity implements Compara this.groupName = groupName; } - @ApiModelProperty( - value = "The name of the ParameterContext that receives the parameters in this group" + @Schema(description = "The name of the ParameterContext that receives the parameters in this group" ) public String getParameterContextName() { return parameterContextName; @@ -58,8 +56,7 @@ public class ParameterGroupConfigurationEntity extends Entity implements Compara /** * @return All fetched parameter names that should be applied. */ - @ApiModelProperty( - value = "All fetched parameter names that should be applied." + @Schema(description = "All fetched parameter names that should be applied." ) public Map getParameterSensitivities() { return parameterSensitivities; @@ -69,8 +66,7 @@ public class ParameterGroupConfigurationEntity extends Entity implements Compara this.parameterSensitivities = parameterSensitivities; } - @ApiModelProperty( - value = "True if this group should be synchronized to a ParameterContext, including creating one if it does not exist." + @Schema(description = "True if this group should be synchronized to a ParameterContext, including creating one if it does not exist." ) public Boolean isSynchronized() { return isSynchronized; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderApplyParametersRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderApplyParametersRequestEntity.java index a73448925d..db2c225ca6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderApplyParametersRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderApplyParametersRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ParameterProviderApplyParametersRequestDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -25,7 +25,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; public class ParameterProviderApplyParametersRequestEntity extends Entity { private ParameterProviderApplyParametersRequestDTO request; - @ApiModelProperty("The Apply Parameters Request") + @Schema(description = "The Apply Parameters Request") public ParameterProviderApplyParametersRequestDTO getRequest() { return request; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderConfigurationEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderConfigurationEntity.java index 9796da1b7b..e36a14ecd0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderConfigurationEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderConfigurationEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ParameterProviderConfigurationDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; @@ -38,8 +38,7 @@ public class ParameterProviderConfigurationEntity implements Permissible parameterGroupConfigurations; - @ApiModelProperty( - value = "The id of the parameter provider." + @Schema(description = "The id of the parameter provider." ) public String getId() { return id; @@ -47,8 +46,7 @@ public class ParameterProviderParameterApplicationEntity extends Entity { /** * @return revision for this request/response */ - @ApiModelProperty( - value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." + @Schema(description = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." ) public RevisionDTO getRevision() { return revision; @@ -58,8 +56,7 @@ public class ParameterProviderParameterApplicationEntity extends Entity { this.revision = revision; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; @@ -72,8 +69,7 @@ public class ParameterProviderParameterApplicationEntity extends Entity { /** * @return Specifies per group which parameter names should be applied to the Parameter Contexts. */ - @ApiModelProperty( - value = "Configuration for the fetched Parameter Groups" + @Schema(description = "Configuration for the fetched Parameter Groups" ) public Collection getParameterGroupConfigurations() { return parameterGroupConfigurations; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderParameterFetchEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderParameterFetchEntity.java index e034ad49c4..f1eaf9802f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderParameterFetchEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderParameterFetchEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; import jakarta.xml.bind.annotation.XmlType; @@ -31,8 +31,7 @@ public class ParameterProviderParameterFetchEntity extends Entity { private RevisionDTO revision; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty( - value = "The id of the parameter provider." + @Schema(description = "The id of the parameter provider." ) public String getId() { return id; @@ -45,8 +44,7 @@ public class ParameterProviderParameterFetchEntity extends Entity { /** * @return revision for this request/response */ - @ApiModelProperty( - value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." + @Schema(description = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." ) public RevisionDTO getRevision() { return revision; @@ -56,8 +54,7 @@ public class ParameterProviderParameterFetchEntity extends Entity { this.revision = revision; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderReferencingComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderReferencingComponentEntity.java index 4bf122a151..aed4e7fe1e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderReferencingComponentEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ParameterProviderReferencingComponentEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ParameterProviderReferencingComponentDTO; import org.apache.nifi.web.api.dto.PermissionsDTO; @@ -47,8 +47,7 @@ public class ParameterProviderReferencingComponentEntity extends ComponentEntity /** * @return The permissions for this component */ - @ApiModelProperty( - value = "The permissions for this component." + @Schema(description = "The permissions for this component." ) @Override public PermissionsDTO getPermissions() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java index 6e05655326..dd31dc5917 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.PortDTO; import org.apache.nifi.web.api.dto.status.PortStatusDTO; @@ -51,8 +51,7 @@ public class PortEntity extends ComponentEntity implements Permissible, /** * @return the port status */ - @ApiModelProperty( - value = "The status of the port." + @Schema(description = "The status of the port." ) public PortStatusDTO getStatus() { return status; @@ -73,8 +72,7 @@ public class PortEntity extends ComponentEntity implements Permissible, /** * @return The permissions for this component operations */ - @ApiModelProperty( - value = "The permissions for this component operations." + @Schema(description = "The permissions for this component operations." ) @Override public PermissionsDTO getOperatePermissions() { @@ -89,8 +87,7 @@ public class PortEntity extends ComponentEntity implements Permissible, /** * @return whether this port can be accessed remotely via Site-to-Site protocol. */ - @ApiModelProperty( - value = "Whether this port can be accessed remotely via Site-to-Site protocol." + @Schema(description = "Whether this port can be accessed remotely via Site-to-Site protocol." ) public Boolean isAllowRemoteAccess() { return allowRemoteAccess; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortRunStatusEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortRunStatusEntity.java index c1a451cb10..106727dfa3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortRunStatusEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortRunStatusEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -37,8 +37,7 @@ public class PortRunStatusEntity extends ComponentRunStatusEntity { * Run status for this Port. * @return The run status */ - @ApiModelProperty( - value = "The run status of the Port.", + @Schema(description = "The run status of the Port.", allowableValues = "RUNNING, STOPPED, DISABLED" ) public String getState() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortStatusSnapshotEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortStatusSnapshotEntity.java index 2628e3be8a..7d4676c9e0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortStatusSnapshotEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortStatusSnapshotEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.ReadablePermission; import org.apache.nifi.web.api.dto.status.PortStatusSnapshotDTO; @@ -32,7 +32,7 @@ public class PortStatusSnapshotEntity extends Entity implements ReadablePermissi /** * @return The port id */ - @ApiModelProperty("The id of the port.") + @Schema(description = "The id of the port.") public String getId() { return id; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupDescriptorEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupDescriptorEntity.java index b7116e31d4..c0e34b4c46 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupDescriptorEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupDescriptorEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; /** @@ -28,7 +28,7 @@ public abstract class ProcessGroupDescriptorEntity extends Entity { private RevisionDTO processGroupRevision; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The Revision for the Process Group") + @Schema(description = "The Revision for the Process Group") public RevisionDTO getProcessGroupRevision() { return processGroupRevision; } @@ -37,8 +37,7 @@ public abstract class ProcessGroupDescriptorEntity extends Entity { this.processGroupRevision = revision; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java index 172b9c97fb..cd5f452d40 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.flow.RegisteredFlowSnapshot; import org.apache.nifi.web.api.dto.ProcessGroupDTO; import org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO; @@ -76,8 +76,7 @@ public class ProcessGroupEntity extends ComponentEntity implements Permissible

{ private RegisteredFlowSnapshot versionedFlowSnapshot; - @ApiModelProperty(value = "Returns the Versioned Flow to replace with", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Returns the Versioned Flow to replace with", accessMode = Schema.AccessMode.READ_ONLY) public RegisteredFlowSnapshot getVersionedFlowSnapshot() { return versionedFlowSnapshot; } @@ -39,7 +39,7 @@ public class ProcessGroupReplaceRequestEntity extends FlowUpdateRequestEntity { private ProcessorDiagnosticsDTO processorDiagnostics; @Override - @ApiModelProperty("The Processor Diagnostics") + @Schema(description = "The Processor Diagnostics") public ProcessorDiagnosticsDTO getComponent() { return processorDiagnostics; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java index ba6a9870da..3012d98599 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.ProcessorDTO; import org.apache.nifi.web.api.dto.status.ProcessorStatusDTO; @@ -63,8 +63,7 @@ public class ProcessorEntity extends ComponentEntity implements Permissible nodeSnapshots; - @ApiModelProperty("The UUID of the component whose last event should be replayed.") + @Schema(description = "The UUID of the component whose last event should be replayed.") public String getComponentId() { return componentId; } @@ -38,8 +38,7 @@ public class ReplayLastEventResponseEntity extends Entity { this.componentId = componentId; } - @ApiModelProperty( - value = "Which nodes were requested to replay their last provenance event.", + @Schema(description = "Which nodes were requested to replay their last provenance event.", allowableValues = "ALL, PRIMARY" ) public String getNodes() { @@ -50,7 +49,7 @@ public class ReplayLastEventResponseEntity extends Entity { this.nodes = nodes; } - @ApiModelProperty("The aggregate result of all nodes' responses") + @Schema(description = "The aggregate result of all nodes' responses") public ReplayLastEventSnapshotDTO getAggregateSnapshot() { return aggregateSnapshot; } @@ -59,7 +58,7 @@ public class ReplayLastEventResponseEntity extends Entity { this.aggregateSnapshot = aggregateSnapshot; } - @ApiModelProperty("The node-wise results") + @Schema(description = "The node-wise results") public List getNodeSnapshots() { return nodeSnapshots; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReplayLastEventSnapshotDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReplayLastEventSnapshotDTO.java index 91ddfa18da..1493b642d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReplayLastEventSnapshotDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReplayLastEventSnapshotDTO.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Collection; @@ -27,7 +27,7 @@ public class ReplayLastEventSnapshotDTO { private String failureExplanation; private Boolean eventAvailable; - @ApiModelProperty("The IDs of the events that were successfully replayed") + @Schema(description = "The IDs of the events that were successfully replayed") public Collection getEventsReplayed() { return eventsReplayed; } @@ -36,7 +36,7 @@ public class ReplayLastEventSnapshotDTO { this.eventsReplayed = eventsReplayed; } - @ApiModelProperty("If unable to replay an event, specifies why the event could not be replayed") + @Schema(description = "If unable to replay an event, specifies why the event could not be replayed") public String getFailureExplanation() { return failureExplanation; } @@ -45,7 +45,7 @@ public class ReplayLastEventSnapshotDTO { this.failureExplanation = failureExplanation; } - @ApiModelProperty("Whether or not an event was available. This may not be populated if there was a failure.") + @Schema(description = "Whether or not an event was available. This may not be populated if there was a failure.") public Boolean getEventAvailable() { return eventAvailable; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java index 0c169f7af8..f14cfc09ff 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java @@ -18,7 +18,7 @@ package org.apache.nifi.web.api.entity; import jakarta.xml.bind.annotation.XmlRootElement; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.ReportingTaskDTO; import org.apache.nifi.web.api.dto.status.ReportingTaskStatusDTO; @@ -50,8 +50,7 @@ public class ReportingTaskEntity extends ComponentEntity implements Permissible< /** * @return The permissions for this component operations */ - @ApiModelProperty( - value = "The permissions for this component operations." + @Schema(description = "The permissions for this component operations." ) @Override public PermissionsDTO getOperatePermissions() { @@ -66,9 +65,8 @@ public class ReportingTaskEntity extends ComponentEntity implements Permissible< /** * @return The status for this ReportingTask */ - @ApiModelProperty( - value = "The status for this ReportingTask.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema(description = "The status for this ReportingTask.", + accessMode = Schema.AccessMode.READ_ONLY ) public ReportingTaskStatusDTO getStatus() { return status; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskRunStatusEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskRunStatusEntity.java index c9bc4921dd..db9a70b989 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskRunStatusEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskRunStatusEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlType; @@ -37,8 +37,7 @@ public class ReportingTaskRunStatusEntity extends ComponentRunStatusEntity { * Run status for this ReportingTask. * @return The run status */ - @ApiModelProperty( - value = "The run status of the ReportingTask.", + @Schema(description = "The run status of the ReportingTask.", allowableValues = "RUNNING, STOPPED" ) public String getState() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java index d61a8327af..f756aff31c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlRootElement; @@ -48,9 +48,8 @@ public class ReportingTasksEntity extends Entity { * @return current time on the server */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "The current time on the system.", - dataType = "string" + @Schema(description = "The current time on the system.", + type = "string" ) public Date getCurrentTime() { return currentTime; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RunStatusDetailsRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RunStatusDetailsRequestEntity.java index ac9830ca59..813302c936 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RunStatusDetailsRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RunStatusDetailsRequestEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Set; @@ -26,7 +26,7 @@ import java.util.Set; public class RunStatusDetailsRequestEntity extends Entity { private Set processorIds; - @ApiModelProperty("The IDs of all processors whose run status details should be provided") + @Schema(description = "The IDs of all processors whose run status details should be provided") public Set getProcessorIds() { return processorIds; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ScheduleComponentsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ScheduleComponentsEntity.java index 4af081814b..9ec1092cd6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ScheduleComponentsEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ScheduleComponentsEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -40,8 +40,7 @@ public class ScheduleComponentsEntity extends Entity { /** * @return The id of the ProcessGroup */ - @ApiModelProperty( - value = "The id of the ProcessGroup" + @Schema(description = "The id of the ProcessGroup" ) public String getId() { return id; @@ -54,8 +53,7 @@ public class ScheduleComponentsEntity extends Entity { /** * @return The desired state of the descendant components. Possible states are 'RUNNING', 'STOPPED', 'ENABLED', and 'DISABLED' */ - @ApiModelProperty( - value = "The desired state of the descendant components", + @Schema(description = "The desired state of the descendant components", allowableValues = STATE_RUNNING + ", " + STATE_STOPPED + ", " + STATE_ENABLED + ", " + STATE_DISABLED ) public String getState() { @@ -69,8 +67,7 @@ public class ScheduleComponentsEntity extends Entity { /** * @return The components to schedule. If not specified, all authorized descendant components will be used. */ - @ApiModelProperty( - value = "Optional components to schedule. If not specified, all authorized descendant components will be used." + @Schema(description = "Optional components to schedule. If not specified, all authorized descendant components will be used." ) public Map getComponents() { return components; @@ -80,8 +77,7 @@ public class ScheduleComponentsEntity extends Entity { this.components = components; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SnippetEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SnippetEntity.java index 8220d74469..8be9731c30 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SnippetEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SnippetEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.SnippetDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -35,7 +35,7 @@ public class SnippetEntity extends Entity { * * @return The SnippetDTO object */ - @ApiModelProperty("The snippet.") + @Schema(description = "The snippet.") public SnippetDTO getSnippet() { return snippet; } @@ -44,8 +44,7 @@ public class SnippetEntity extends Entity { this.snippet = snippet; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/StartVersionControlRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/StartVersionControlRequestEntity.java index 4e91db8d59..59d61e67b8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/StartVersionControlRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/StartVersionControlRequestEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; import org.apache.nifi.web.api.dto.VersionedFlowDTO; @@ -29,7 +29,7 @@ public class StartVersionControlRequestEntity extends Entity { private RevisionDTO processGroupRevision; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The versioned flow") + @Schema(description = "The versioned flow") public VersionedFlowDTO getVersionedFlow() { return versionedFlow; } @@ -38,7 +38,7 @@ public class StartVersionControlRequestEntity extends Entity { this.versionedFlow = versionedFLow; } - @ApiModelProperty("The Revision of the Process Group under Version Control") + @Schema(description = "The Revision of the Process Group under Version Control") public RevisionDTO getProcessGroupRevision() { return processGroupRevision; } @@ -47,8 +47,7 @@ public class StartVersionControlRequestEntity extends Entity { this.processGroupRevision = revision; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SubmitReplayRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SubmitReplayRequestEntity.java index fe63418c3e..23c0bc41d7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SubmitReplayRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SubmitReplayRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; @@ -29,8 +29,7 @@ public class SubmitReplayRequestEntity extends Entity { private Long eventId; private String clusterNodeId; - @ApiModelProperty( - value = "The event identifier" + @Schema(description = "The event identifier" ) public Long getEventId() { return eventId; @@ -40,8 +39,7 @@ public class SubmitReplayRequestEntity extends Entity { this.eventId = eventId; } - @ApiModelProperty( - value = "The identifier of the node where to submit the replay request." + @Schema(description = "The identifier of the node where to submit the replay request." ) public String getClusterNodeId() { return clusterNodeId; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UpdateControllerServiceReferenceRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UpdateControllerServiceReferenceRequestEntity.java index 5e82f6c9c6..181e793e28 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UpdateControllerServiceReferenceRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UpdateControllerServiceReferenceRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -34,8 +34,7 @@ public class UpdateControllerServiceReferenceRequestEntity extends Entity { private Boolean disconnectedNodeAcknowledged; private Boolean uiOnly; - @ApiModelProperty( - value = "The identifier of the Controller Service." + @Schema(description = "The identifier of the Controller Service." ) public String getId() { return id; @@ -45,8 +44,7 @@ public class UpdateControllerServiceReferenceRequestEntity extends Entity { this.id = id; } - @ApiModelProperty( - value = "The new state of the references for the controller service.", + @Schema(description = "The new state of the references for the controller service.", allowableValues = "ENABLED, DISABLED, RUNNING, STOPPED" ) public String getState() { @@ -57,8 +55,7 @@ public class UpdateControllerServiceReferenceRequestEntity extends Entity { this.state = state; } - @ApiModelProperty( - value = "The revisions for all referencing components." + @Schema(description = "The revisions for all referencing components." ) public Map getReferencingComponentRevisions() { return referencingComponentRevisions; @@ -68,8 +65,7 @@ public class UpdateControllerServiceReferenceRequestEntity extends Entity { this.referencingComponentRevisions = referencingComponentRevisions; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; @@ -79,9 +75,11 @@ public class UpdateControllerServiceReferenceRequestEntity extends Entity { this.disconnectedNodeAcknowledged = disconnectedNodeAcknowledged; } - @ApiModelProperty( - value = "Indicates whether or not the response should only include fields necessary for rendering the NiFi User Interface. As such, when this value is set to true, some fields may be " + - "returned as null values, and the selected fields may change at any time without notice. As a result, this value should not be set to true by any client other than the UI." + @Schema(description = """ + Indicates whether or not the response should only include fields necessary for rendering the NiFi User Interface. + As such, when this value is set to true, some fields may be returned as null values, and the selected fields may change at any time without notice. + As a result, this value should not be set to true by any client other than the UI. + """ ) public Boolean getUiOnly() { return uiOnly; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java index cce6ee6e4c..f62664a465 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.util.TimeAdapter; import jakarta.xml.bind.annotation.XmlRootElement; @@ -51,9 +51,8 @@ public class UsersEntity extends Entity { * @return When this content was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) - @ApiModelProperty( - value = "When this content was generated.", - dataType = "string" + @Schema(description = "When this content was generated.", + type = "string" ) public Date getGenerated() { return generated; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VerifyConfigRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VerifyConfigRequestEntity.java index 5dcb36d726..b1d2004bff 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VerifyConfigRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VerifyConfigRequestEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.VerifyConfigRequestDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -26,7 +26,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; public class VerifyConfigRequestEntity extends Entity { private VerifyConfigRequestDTO request; - @ApiModelProperty("The request") + @Schema(description = "The request") public VerifyConfigRequestDTO getRequest() { return request; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlComponentMappingEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlComponentMappingEntity.java index 8b532af483..2ca0319c58 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlComponentMappingEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlComponentMappingEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.RevisionDTO; import org.apache.nifi.web.api.dto.VersionControlInformationDTO; @@ -31,7 +31,7 @@ public class VersionControlComponentMappingEntity extends Entity { private RevisionDTO processGroupRevision; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The Version Control information") + @Schema(description = "The Version Control information") public VersionControlInformationDTO getVersionControlInformation() { return versionControlDto; } @@ -40,7 +40,7 @@ public class VersionControlComponentMappingEntity extends Entity { this.versionControlDto = versionControlDto; } - @ApiModelProperty("The mapping of Versioned Component Identifiers to instance ID's") + @Schema(description = "The mapping of Versioned Component Identifiers to instance ID's") public Map getVersionControlComponentMapping() { return versionControlComponentMapping; } @@ -49,7 +49,7 @@ public class VersionControlComponentMappingEntity extends Entity { this.versionControlComponentMapping = mapping; } - @ApiModelProperty("The revision of the Process Group") + @Schema(description = "The revision of the Process Group") public RevisionDTO getProcessGroupRevision() { return processGroupRevision; } @@ -58,8 +58,7 @@ public class VersionControlComponentMappingEntity extends Entity { this.processGroupRevision = processGroupRevision; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlInformationEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlInformationEntity.java index 143d2e2cba..c3af007fe6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlInformationEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionControlInformationEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.VersionControlInformationDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -26,7 +26,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; public class VersionControlInformationEntity extends ProcessGroupDescriptorEntity { private VersionControlInformationDTO versionControlInformation; - @ApiModelProperty("The Version Control information") + @Schema(description = "The Version Control information") public VersionControlInformationDTO getVersionControlInformation() { return versionControlInformation; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowEntity.java index 642d8e52e4..eced7b7221 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.VersionedFlowDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -26,7 +26,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; public class VersionedFlowEntity extends Entity { private VersionedFlowDTO versionedFlow; - @ApiModelProperty("The versioned flow") + @Schema(description = "The versioned flow") public VersionedFlowDTO getVersionedFlow() { return versionedFlow; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotEntity.java index 3a3e9e63ba..6cdb3d5819 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.flow.RegisteredFlowSnapshot; import org.apache.nifi.web.api.dto.RevisionDTO; @@ -31,7 +31,7 @@ public class VersionedFlowSnapshotEntity extends Entity { private Boolean updateDescendantVersionedFlows; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The versioned flow snapshot") + @Schema(description = "The versioned flow snapshot") public RegisteredFlowSnapshot getVersionedFlowSnapshot() { return versionedFlowSnapshot; } @@ -40,7 +40,7 @@ public class VersionedFlowSnapshotEntity extends Entity { this.versionedFlowSnapshot = versionedFlowSnapshot; } - @ApiModelProperty("The Revision of the Process Group under Version Control") + @Schema(description = "The Revision of the Process Group under Version Control") public RevisionDTO getProcessGroupRevision() { return processGroupRevision; } @@ -49,7 +49,7 @@ public class VersionedFlowSnapshotEntity extends Entity { this.processGroupRevision = revision; } - @ApiModelProperty("The ID of the Registry that this flow belongs to") + @Schema(description = "The ID of the Registry that this flow belongs to") public String getRegistryId() { return registryId; } @@ -58,7 +58,7 @@ public class VersionedFlowSnapshotEntity extends Entity { this.registryId = registryId; } - @ApiModelProperty("If the Process Group to be updated has a child or descendant Process Group that is also under " + @Schema(description = "If the Process Group to be updated has a child or descendant Process Group that is also under " + "Version Control, this specifies whether or not the contents of that child/descendant Process Group should be updated.") public Boolean getUpdateDescendantVersionedFlows() { return updateDescendantVersionedFlows; @@ -68,8 +68,7 @@ public class VersionedFlowSnapshotEntity extends Entity { this.updateDescendantVersionedFlows = update; } - @ApiModelProperty( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + @Schema(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) public Boolean isDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotMetadataEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotMetadataEntity.java index 2b354760a3..5071c1d370 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotMetadataEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowSnapshotMetadataEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.flow.RegisteredFlowSnapshotMetadata; import jakarta.xml.bind.annotation.XmlRootElement; @@ -27,7 +27,7 @@ public class VersionedFlowSnapshotMetadataEntity extends Entity { private RegisteredFlowSnapshotMetadata versionedFlowSnapshotMetadata; private String registryId; - @ApiModelProperty("The collection of registered flow snapshot metadata") + @Schema(description = "The collection of registered flow snapshot metadata") public RegisteredFlowSnapshotMetadata getVersionedFlowSnapshotMetadata() { return versionedFlowSnapshotMetadata; } @@ -36,7 +36,7 @@ public class VersionedFlowSnapshotMetadataEntity extends Entity { this.versionedFlowSnapshotMetadata = versionedFlowSnapshotMetadata; } - @ApiModelProperty("The ID of the Registry that this flow belongs to") + @Schema(description = "The ID of the Registry that this flow belongs to") public String getRegistryId() { return registryId; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowUpdateRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowUpdateRequestEntity.java index efddccc29e..1bf3a23ecb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowUpdateRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedFlowUpdateRequestEntity.java @@ -17,7 +17,7 @@ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.web.api.dto.VersionedFlowUpdateRequestDTO; import jakarta.xml.bind.annotation.XmlRootElement; @@ -25,7 +25,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "registeredFlowUpdateRequestEntity") public class VersionedFlowUpdateRequestEntity extends FlowUpdateRequestEntity { - @ApiModelProperty("The Flow Update Request") + @Schema(description = "The Flow Update Request") public VersionedFlowUpdateRequestDTO getRequest() { if (request == null) { request = new VersionedFlowUpdateRequestDTO(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportRequestEntity.java index b4faf5cdf2..884cb3ba0f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportRequestEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.flow.VersionedReportingTaskSnapshot; import jakarta.xml.bind.annotation.XmlRootElement; @@ -27,7 +27,7 @@ public class VersionedReportingTaskImportRequestEntity extends Entity { private VersionedReportingTaskSnapshot reportingTaskSnapshot; private Boolean disconnectedNodeAcknowledged; - @ApiModelProperty("The snapshot to import") + @Schema(description = "The snapshot to import") public VersionedReportingTaskSnapshot getReportingTaskSnapshot() { return reportingTaskSnapshot; } @@ -36,7 +36,7 @@ public class VersionedReportingTaskImportRequestEntity extends Entity { this.reportingTaskSnapshot = reportingTaskSnapshot; } - @ApiModelProperty("The disconnected node acknowledged flag") + @Schema(description = "The disconnected node acknowledged flag") public Boolean getDisconnectedNodeAcknowledged() { return disconnectedNodeAcknowledged; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportResponseEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportResponseEntity.java index f708c4b34b..16ed10a4cb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportResponseEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/VersionedReportingTaskImportResponseEntity.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.web.api.entity; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Set; @@ -27,7 +27,7 @@ public class VersionedReportingTaskImportResponseEntity extends Entity { private Set reportingTasks; private Set controllerServices; - @ApiModelProperty("The reporting tasks created by the import") + @Schema(description = "The reporting tasks created by the import") public Set getReportingTasks() { return reportingTasks; } @@ -36,7 +36,7 @@ public class VersionedReportingTaskImportResponseEntity extends Entity { this.reportingTasks = reportingTasks; } - @ApiModelProperty("The controller services created by the import") + @Schema(description = "The controller services created by the import") public Set getControllerServices() { return controllerServices; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml index 834af46ba8..65674d9a9f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml @@ -24,9 +24,8 @@ war - ${project.build.directory}/swagger - ${swaggerDirectory}/swagger.yaml ${project.build.directory}/${project.artifactId}-${project.version}/docs/rest-api/ + ${restApiDirectory}/swagger.yaml @@ -97,17 +96,17 @@ io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.2.19 org.apache.nifi.web.api - ${swaggerDirectory} + ${restApiDirectory} swagger JSONANDYAML true 200 ${project.build.outputDirectory}/openapi.yaml + org.apache.nifi.swagger.integration.StandardObjectMapperProcessor @@ -117,11 +116,17 @@ + + + org.apache.nifi + nifi-swagger-integration + 2.0.0-SNAPSHOT + + io.swagger.codegen.v3 swagger-codegen-maven-plugin - 3.0.50 compile @@ -281,7 +286,7 @@ provided - io.swagger + io.swagger.core.v3 swagger-annotations provided diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AbstractParameterResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AbstractParameterResource.java index 19a7985f94..f0309bc518 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AbstractParameterResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AbstractParameterResource.java @@ -24,6 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import jakarta.ws.rs.HttpMethod; + import java.net.URI; import java.util.Map; @@ -31,7 +32,7 @@ public abstract class AbstractParameterResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(AbstractParameterResource.class); public NodeResponse updateParameterContext(final ParameterContextEntity parameterContext, final URI updateUri, - final Map headers, final NiFiUser user) throws LifecycleManagementException { + final Map headers, final NiFiUser user) throws LifecycleManagementException { final NodeResponse clusterResponse; try { logger.debug("Replicating PUT request to {} for user {}", updateUri, user); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java index 03dda923e6..77ee63ffb9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java @@ -16,16 +16,16 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -37,7 +37,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -63,20 +62,14 @@ import org.apache.nifi.web.dao.AccessPolicyDAO; * RESTful endpoint for managing access policies. */ @Path("/policies") -@Api( - value = "/policies", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing access policies.") -}) +@Tag(name = "Policies") public class AccessPolicyResource extends ApplicationResource { private final NiFiServiceFacade serviceFacade; private final Authorizer authorizer; public AccessPolicyResource(NiFiServiceFacade serviceFacade, Authorizer authorizer, NiFiProperties properties, RequestReplicator requestReplicator, - ClusterCoordinator clusterCoordinator, FlowController flowController) { + ClusterCoordinator clusterCoordinator, FlowController flowController) { this.serviceFacade = serviceFacade; this.authorizer = authorizer; setProperties(properties); @@ -109,39 +102,40 @@ public class AccessPolicyResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{action}/{resource: .+}") - @ApiOperation( - value = "Gets an access policy for the specified action and resource", - notes = "Will return the effective policy if no component specific policy exists for the specified action and resource. " + @Operation( + summary = "Gets an access policy for the specified action and resource", + description = "Will return the effective policy if no component specific policy exists for the specified action and resource. " + "Must have Read permissions to the policy with the desired action and resource. Permissions for the policy that is " + "returned will be indicated in the response. This means the client could be authorized to get the policy for a " + "given component but the effective policy may be inherited from an ancestor Process Group. If the client does not " + "have permissions to that policy, the response will not include the policy and the permissions in the response " + "will be marked accordingly. If the client does not have permissions to the policy of the desired action and resource " + "a 403 response will be returned.", - response = AccessPolicyEntity.class, - authorizations = { - @Authorization(value = "Read - /policies/{resource}") + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), + security = { + @SecurityRequirement(name = "Read - /policies/{resource}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getAccessPolicyForResource( - @ApiParam( - value = "The request action.", - allowableValues = "read, write", + @Parameter( + description = "The request action.", required = true - ) @PathParam("action") final String action, - @ApiParam( - value = "The resource of the policy.", + ) + @PathParam("action") final String action, + @Parameter( + description = "The resource of the policy.", required = true - ) @PathParam("resource") String rawResource) { + ) + @PathParam("resource") String rawResource) { // ensure we're running with a configurable authorizer if (!AuthorizerCapabilityDetection.isManagedAuthorizer(authorizer)) { @@ -176,33 +170,31 @@ public class AccessPolicyResource extends ApplicationResource { /** * Creates a new access policy. * - * @param httpServletRequest request * @param requestAccessPolicyEntity An accessPolicyEntity. * @return An accessPolicyEntity. */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Creates an access policy", - response = AccessPolicyEntity.class, - authorizations = { - @Authorization(value = "Write - /policies/{resource}") + @Operation( + summary = "Creates an access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), + security = { + @SecurityRequirement(name = "Write - /policies/{resource}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createAccessPolicy( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The access policy configuration details.", + @Parameter( + description = "The access policy configuration details.", required = true ) final AccessPolicyEntity requestAccessPolicyEntity) { @@ -276,25 +268,25 @@ public class AccessPolicyResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets an access policy", - response = AccessPolicyEntity.class, - authorizations = { - @Authorization(value = "Read - /policies/{resource}") + @Operation( + summary = "Gets an access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), + security = { + @SecurityRequirement(name = "Read - /policies/{resource}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getAccessPolicy( - @ApiParam( - value = "The access policy id.", + @Parameter( + description = "The access policy id.", required = true ) @PathParam("id") final String id) { @@ -324,8 +316,7 @@ public class AccessPolicyResource extends ApplicationResource { /** * Updates an access policy. * - * @param httpServletRequest request - * @param id The id of the access policy to update. + * @param id The id of the access policy to update. * @param requestAccessPolicyEntity An accessPolicyEntity. * @return An accessPolicyEntity. */ @@ -333,31 +324,30 @@ public class AccessPolicyResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a access policy", - response = AccessPolicyEntity.class, - authorizations = { - @Authorization(value = "Write - /policies/{resource}") + @Operation( + summary = "Updates a access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), + security = { + @SecurityRequirement(name = "Write - /policies/{resource}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateAccessPolicy( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The access policy id.", + @Parameter( + description = "The access policy id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The access policy configuration details.", + @Parameter( + description = "The access policy configuration details.", required = true ) final AccessPolicyEntity requestAccessPolicyEntity) { @@ -413,55 +403,50 @@ public class AccessPolicyResource extends ApplicationResource { /** * Removes the specified access policy. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the access policy to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the access policy to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes an access policy", - response = AccessPolicyEntity.class, - authorizations = { - @Authorization(value = "Write - /policies/{resource}"), - @Authorization(value = "Write - Policy of the parent resource - /policies/{resource}") + @Operation( + summary = "Deletes an access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), + security = { + @SecurityRequirement(name = "Write - /policies/{resource}"), + @SecurityRequirement(name = "Write - Policy of the parent resource - /policies/{resource}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeAccessPolicy( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The access policy id.", + @Parameter( + description = "The access policy id.", required = true ) @PathParam("id") final String id) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java index 62a9896f18..e2a0cba657 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java @@ -16,13 +16,6 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; - import java.net.HttpURLConnection; import java.net.URI; import java.security.cert.X509Certificate; @@ -32,6 +25,12 @@ import java.util.Optional; import java.util.UUID; import java.util.concurrent.TimeUnit; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.ws.rs.Consumes; @@ -96,13 +95,7 @@ import org.springframework.security.web.authentication.preauth.x509.X509Principa * RESTful endpoint for managing access. */ @Path("/access") -@Api( - value = "/access", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoints for obtaining an access token or checking access status.") -}) +@Tag(name = "Access") public class AccessResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(AccessResource.class); @@ -132,9 +125,9 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("config") - @ApiOperation( - value = "Retrieves the access configuration for this NiFi", - response = AccessConfigurationEntity.class + @Operation( + summary = "Retrieves the access configuration for this NiFi", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessConfigurationEntity.class))) ) public Response getLoginConfig(@Context HttpServletRequest httpServletRequest) { @@ -155,8 +148,8 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("knox/request") - @ApiOperation( - value = "Initiates a request to authenticate through Apache Knox." + @Operation( + summary = "Initiates a request to authenticate through Apache Knox." ) public void knoxRequest(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { // only consider user specific access over https @@ -187,8 +180,8 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("knox/callback") - @ApiOperation( - value = "Redirect/callback URI for processing the result of the Apache Knox login sequence." + @Operation( + summary = "Redirect/callback URI for processing the result of the Apache Knox login sequence." ) public void knoxCallback(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { // only consider user specific access over https @@ -210,11 +203,11 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("knox/logout") - @ApiOperation( - value = "Performs a logout in the Apache Knox.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Performs a logout in the Apache Knox.", + description = NON_GUARANTEED_ENDPOINT ) - public void knoxLogout(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { + public void knoxLogout(@Context HttpServletResponse httpServletResponse) throws Exception { String redirectPath = generateResourceUri("..", "nifi", "login"); httpServletResponse.sendRedirect(redirectPath); } @@ -229,18 +222,18 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("") - @ApiOperation( - value = "Gets the status the client's access", - notes = NON_GUARANTEED_ENDPOINT, - response = AccessStatusEntity.class + @Operation( + summary = "Gets the status the client's access", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessStatusEntity.class))) ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Unable to determine access status because the client could not be authenticated."), - @ApiResponse(code = 403, message = "Unable to determine access status because the client is not authorized to make this request."), - @ApiResponse(code = 409, message = "Unable to determine access status because NiFi is not in the appropriate state."), - @ApiResponse(code = 500, message = "Unable to determine access status because an unexpected error occurred.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Unable to determine access status because the client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Unable to determine access status because the client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "500", description = "Unable to determine access status because an unexpected error occurred.") } ) public Response getAccessStatus(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) { @@ -313,21 +306,23 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Path("/kerberos") - @ApiOperation( - value = "Creates a token for accessing the REST API via Kerberos ticket exchange / SPNEGO negotiation", - notes = "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + + @Operation( + summary = "Creates a token for accessing the REST API via Kerberos ticket exchange / SPNEGO negotiation", + description = "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + "in the format 'Authorization: Bearer '. It is also stored in the browser as a cookie.", - response = String.class + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))) ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "NiFi was unable to complete the request because it did not contain a valid Kerberos " + + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse( + responseCode = "401", description = "NiFi was unable to complete the request because it did not contain a valid Kerberos " + "ticket in the Authorization header. Retry this request after initializing a ticket with kinit and " + - "ensuring your browser is configured to support SPNEGO."), - @ApiResponse(code = 409, message = "Unable to create access token because NiFi is not in the appropriate state. (i.e. may not be configured to support Kerberos login."), - @ApiResponse(code = 500, message = "Unable to create access token because an unexpected error occurred.") + "ensuring your browser is configured to support SPNEGO." + ), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "500", description = "Unable to create access token because an unexpected error occurred.") } ) public Response createAccessTokenFromTicket(@Context final HttpServletRequest httpServletRequest, @Context final HttpServletResponse httpServletResponse) { @@ -379,27 +374,27 @@ public class AccessResource extends ApplicationResource { * Creates a token for accessing the REST API via username/password stored as a cookie in the browser. * * @param httpServletRequest the servlet request - * @param username the username - * @param password the password + * @param username the username + * @param password the password * @return A JWT (string) in a cookie and as the body */ @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.TEXT_PLAIN) @Path("/token") - @ApiOperation( - value = "Creates a token for accessing the REST API via username/password", - notes = "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + + @Operation( + summary = "Creates a token for accessing the REST API via username/password", + description = "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. It is stored in the browser as a cookie, but also returned in" + "the response body to be stored/used by third party client scripts.", - response = String.class + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))) ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "Unable to create access token because NiFi is not in the appropriate state. (i.e. may not be configured to support username/password login."), - @ApiResponse(code = 500, message = "Unable to create access token because an unexpected error occurred.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "500", description = "Unable to create access token because an unexpected error occurred.") } ) public Response createAccessToken( @@ -450,16 +445,16 @@ public class AccessResource extends ApplicationResource { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/token/expiration") - @ApiOperation( - value = "Get expiration for current Access Token", - notes = NON_GUARANTEED_ENDPOINT, - response = AccessTokenExpirationEntity.class + @Operation( + summary = "Get expiration for current Access Token", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessTokenExpirationEntity.class))) ) @ApiResponses( value = { - @ApiResponse(code = 200, message = "Access Token Expiration found"), - @ApiResponse(code = 401, message = "Access Token not authorized"), - @ApiResponse(code = 409, message = "Access Token not resolved"), + @ApiResponse(responseCode = "200", description = "Access Token Expiration found"), + @ApiResponse(responseCode = "401", description = "Access Token not authorized"), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getAccessTokenExpiration() { @@ -481,15 +476,15 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/logout") - @ApiOperation( - value = "Performs a logout for other providers that have been issued a JWT.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Performs a logout for other providers that have been issued a JWT.", + description = NON_GUARANTEED_ENDPOINT ) @ApiResponses( value = { - @ApiResponse(code = 200, message = "User was logged out successfully."), - @ApiResponse(code = 401, message = "Authentication token provided was empty or not in the correct JWT format."), - @ApiResponse(code = 500, message = "Client failed to log out."), + @ApiResponse(responseCode = "200", description = "User was logged out successfully."), + @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), + @ApiResponse(responseCode = "500", description = "Client failed to log out."), } ) public Response logOut(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) { @@ -527,15 +522,15 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/logout/complete") - @ApiOperation( - value = "Completes the logout sequence by removing the cached Logout Request and Cookie if they existed and redirects to /nifi/login.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Completes the logout sequence by removing the cached Logout Request and Cookie if they existed and redirects to /nifi/login.", + description = NON_GUARANTEED_ENDPOINT ) @ApiResponses( value = { - @ApiResponse(code = 200, message = "User was logged out successfully."), - @ApiResponse(code = 401, message = "Authentication token provided was empty or not in the correct JWT format."), - @ApiResponse(code = 500, message = "Client failed to log out."), + @ApiResponse(responseCode = "200", description = "User was logged out successfully."), + @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), + @ApiResponse(responseCode = "500", description = "Client failed to log out."), } ) public void logOutComplete(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java index ae8113fe0e..a896aaa6f0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java @@ -79,6 +79,7 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response.ResponseBuilder; import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriInfo; + import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Collections; @@ -233,7 +234,7 @@ public abstract class ApplicationResource { /** * Generates a 201 Created response with the specified content. * - * @param uri The URI + * @param uri The URI * @param entity entity * @return The response to be built */ @@ -420,8 +421,8 @@ public abstract class ApplicationResource { /** * Authorize any restrictions for the specified ComponentAuthorizable. * - * @param authorizer authorizer - * @param authorizable component authorizable + * @param authorizer authorizer + * @param authorizable component authorizable */ protected void authorizeRestrictions(final Authorizer authorizer, final ComponentAuthorizable authorizable) { authorizable.getRestrictedAuthorizables().forEach(restrictionAuthorizable -> restrictionAuthorizable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser())); @@ -430,13 +431,13 @@ public abstract class ApplicationResource { /** * Authorizes the specified process group. * - * @param processGroupAuthorizable process group - * @param authorizer authorizer - * @param lookup lookup - * @param action action - * @param authorizeReferencedServices whether to authorize referenced services - * @param authorizeControllerServices whether to authorize controller services - * @param authorizeTransitiveServices whether to authorize transitive services + * @param processGroupAuthorizable process group + * @param authorizer authorizer + * @param lookup lookup + * @param action action + * @param authorizeReferencedServices whether to authorize referenced services + * @param authorizeControllerServices whether to authorize controller services + * @param authorizeTransitiveServices whether to authorize transitive services * @param authorizeParameterReferences whether to authorize parameter references */ protected void authorizeProcessGroup(final ProcessGroupAuthorizable processGroupAuthorizable, final Authorizer authorizer, final AuthorizableLookup lookup, final RequestAction action, @@ -495,8 +496,8 @@ public abstract class ApplicationResource { * Authorizes the specified Snippet with the specified request action. * * @param authorizer authorizer - * @param lookup lookup - * @param action action + * @param lookup lookup + * @param action action */ protected void authorizeSnippet(final SnippetAuthorizable snippet, final Authorizer authorizer, final AuthorizableLookup lookup, final RequestAction action, final boolean authorizeReferencedServices, final boolean authorizeTransitiveServices, final boolean authorizeParameterReferences) { @@ -537,10 +538,10 @@ public abstract class ApplicationResource { * Executes an action through the service facade using the specified revision. * * @param serviceFacade service facade - * @param revision revision - * @param authorizer authorizer - * @param verifier verifier - * @param action executor + * @param revision revision + * @param authorizer authorizer + * @param verifier verifier + * @param action executor * @return the response */ protected Response withWriteLock(final NiFiServiceFacade serviceFacade, final T entity, final Revision revision, final AuthorizeAccess authorizer, @@ -591,10 +592,10 @@ public abstract class ApplicationResource { * Executes an action through the service facade using the specified revision. * * @param serviceFacade service facade - * @param revisions revisions - * @param authorizer authorizer - * @param verifier verifier - * @param action executor + * @param revisions revisions + * @param authorizer authorizer + * @param verifier verifier + * @param action executor * @return the response */ protected Response withWriteLock(final NiFiServiceFacade serviceFacade, final T entity, final Set revisions, final AuthorizeAccess authorizer, @@ -645,9 +646,9 @@ public abstract class ApplicationResource { * Executes an action through the service facade. * * @param serviceFacade service facade - * @param authorizer authorizer - * @param verifier verifier - * @param action the action to execute + * @param authorizer authorizer + * @param verifier verifier + * @param action the action to execute * @return the response */ protected Response withWriteLock(final NiFiServiceFacade serviceFacade, final T entity, final AuthorizeAccess authorizer, @@ -803,7 +804,7 @@ public abstract class ApplicationResource { /** * Replicates the request to the given node * - * @param method the HTTP method + * @param method the HTTP method * @param nodeUuid the UUID of the node to replicate the request to * @return the response from the node * @throws UnknownNodeException if the nodeUuid given does not map to any node in the cluster @@ -826,8 +827,8 @@ public abstract class ApplicationResource { /** * Replicates the request to the given node * - * @param method the HTTP method - * @param entity the Entity to replicate + * @param method the HTTP method + * @param entity the Entity to replicate * @param nodeUuid the UUID of the node to replicate the request to * @return the response from the node * @throws UnknownNodeException if the nodeUuid given does not map to any node in the cluster @@ -839,8 +840,8 @@ public abstract class ApplicationResource { /** * Replicates the request to the given node * - * @param method the HTTP method - * @param entity the Entity to replicate + * @param method the HTTP method + * @param entity the Entity to replicate * @param nodeUuid the UUID of the node to replicate the request to * @return the response from the node * @throws UnknownNodeException if the nodeUuid given does not map to any node in the cluster @@ -975,8 +976,8 @@ public abstract class ApplicationResource { * used will be those provided by the {@link #getHeaders()} method. The URI that will be used will be * that provided by the {@link #getAbsolutePath()} method * - * @param method the HTTP method to use - * @param entity the entity to replicate + * @param method the HTTP method to use + * @param entity the entity to replicate * @param headersToOverride the headers to override * @return the response from the request * @see #replicateNodeResponse(String, Object, Map) @@ -1001,8 +1002,8 @@ public abstract class ApplicationResource { * that provided by the {@link #getAbsolutePath()} method. This method returns the NodeResponse, * rather than a Response object. * - * @param method the HTTP method to use - * @param entity the entity to replicate + * @param method the HTTP method to use + * @param entity the entity to replicate * @param headersToOverride the headers to override * @return the response from the request * @throws InterruptedException if interrupted while replicating the request diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java index 837cd228a3..e56e452c05 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java @@ -16,17 +16,17 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.List; import java.util.Set; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -37,7 +37,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -60,13 +59,7 @@ import org.apache.nifi.web.api.request.LongParameter; * RESTful endpoint for managing a Connection. */ @Path("/connections") -@Api( - value = "/connections", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Connection.") -}) +@Tag(name = "Connections") public class ConnectionResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -107,26 +100,26 @@ public class ConnectionResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") - @ApiOperation( - value = "Gets a connection", - response = ConnectionEntity.class, - authorizations = { - @Authorization(value = "Read Source - /{component-type}/{uuid}"), - @Authorization(value = "Read Destination - /{component-type}/{uuid}") + @Operation( + summary = "Gets a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), + security = { + @SecurityRequirement(name = "Read Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Read Destination - /{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getConnection( - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String id) throws InterruptedException { @@ -153,9 +146,8 @@ public class ConnectionResource extends ApplicationResource { /** * Updates the specified connection. * - * @param httpServletRequest request - * @param id The id of the connection. - * @param requestConnectionEntity A connectionEntity. + * @param id The id of the connection. + * @param requestConnectionEntity A connectionEntity. * @return A connectionEntity. * @throws InterruptedException if interrupted */ @@ -163,34 +155,33 @@ public class ConnectionResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") - @ApiOperation( - value = "Updates a connection", - response = ConnectionEntity.class, - authorizations = { - @Authorization(value = "Write Source - /{component-type}/{uuid}"), - @Authorization(value = "Write Destination - /{component-type}/{uuid}"), - @Authorization(value = "Write New Destination - /{component-type}/{uuid} - if updating Destination"), - @Authorization(value = "Write Process Group - /process-groups/{uuid} - if updating Destination") + @Operation( + summary = "Updates a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), + security = { + @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write New Destination - /{component-type}/{uuid} - if updating Destination"), + @SecurityRequirement(name = "Write Process Group - /process-groups/{uuid} - if updating Destination") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateConnection( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The connection configuration details.", + @Parameter( + description = "The connection configuration details.", required = true ) final ConnectionEntity requestConnectionEntity) throws InterruptedException { @@ -285,10 +276,9 @@ public class ConnectionResource extends ApplicationResource { /** * Removes the specified connection. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the connection. + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the connection. * @return An Entity containing the client id and an updated revision. * @throws InterruptedException if interrupted */ @@ -296,43 +286,39 @@ public class ConnectionResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") - @ApiOperation( - value = "Deletes a connection", - response = ConnectionEntity.class, - authorizations = { - @Authorization(value = "Write Source - /{component-type}/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}"), - @Authorization(value = "Write Destination - /{component-type}/{uuid}") + @Operation( + summary = "Deletes a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), + security = { + @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteConnection( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String id) throws InterruptedException { @@ -376,7 +362,6 @@ public class ConnectionResource extends ApplicationResource { ); } - // setters public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java index e6e928a6c9..380f1c2895 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java @@ -16,14 +16,14 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.authorization.AuthorizeControllerServiceReference; import org.apache.nifi.authorization.Authorizer; @@ -87,7 +87,6 @@ import org.apache.nifi.web.api.request.LongParameter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -99,9 +98,9 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; + import java.net.URI; import java.util.Collections; import java.util.Date; @@ -114,16 +113,9 @@ import java.util.function.Consumer; * RESTful endpoint for managing a Flow Controller. */ @Path("/controller") -@Api( - value = "/controller", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Provides realtime command and control of this NiFi instance.") -}) +@Tag(name = "Controller") public class ControllerResource extends ApplicationResource { private static final Logger LOGGER = LoggerFactory.getLogger(ControllerResource.class); - private static final String NIFI_REGISTRY_TYPE = "org.apache.nifi.registry.flow.NifiRegistryFlowRegistryClient"; public static final String VERIFICATION_REQUEST_TYPE = "verification-request"; public RequestManager> configVerificationRequestManager = @@ -155,19 +147,19 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("config") - @ApiOperation( - value = "Retrieves the configuration for this NiFi Controller", - response = ControllerConfigurationEntity.class, - authorizations = { - @Authorization(value = "Read - /controller") + @Operation( + summary = "Retrieves the configuration for this NiFi Controller", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerConfigurationEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerConfig() { @@ -185,33 +177,31 @@ public class ControllerResource extends ApplicationResource { /** * Update the configuration for this NiFi. * - * @param httpServletRequest request - * @param requestConfigEntity A controllerConfigurationEntity. + * @param requestConfigEntity A controllerConfigurationEntity. * @return A controllerConfigurationEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("config") - @ApiOperation( - value = "Retrieves the configuration for this NiFi", - response = ControllerConfigurationEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Retrieves the configuration for this NiFi", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerConfigurationEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateControllerConfig( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The controller configuration.", + @Parameter( + description = "The controller configuration.", required = true ) final ControllerConfigurationEntity requestConfigEntity) { @@ -234,9 +224,7 @@ public class ControllerResource extends ApplicationResource { serviceFacade, requestConfigEntity, requestRevision, - lookup -> { - authorizeController(RequestAction.WRITE); - }, + lookup -> authorizeController(RequestAction.WRITE), null, (revision, configEntity) -> { final ControllerConfigurationEntity entity = serviceFacade.updateControllerConfiguration(revision, configEntity.getComponent()); @@ -252,7 +240,6 @@ public class ControllerResource extends ApplicationResource { /** * Creates a new Parameter Provider. * - * @param httpServletRequest request * @param requestParameterProviderEntity A parameterProviderEntity. * @return A parameterProviderEntity. */ @@ -260,27 +247,26 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("parameter-providers") - @ApiOperation( - value = "Creates a new parameter provider", - response = ParameterProviderEntity.class, - authorizations = { - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @Authorization(value = "Write - if the Parameter Provider is restricted - /restricted-components") + @Operation( + summary = "Creates a new parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Parameter Provider is restricted - /restricted-components") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createParameterProvider( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The parameter provider configuration details.", + @Parameter( + description = "The parameter provider configuration details.", required = true ) final ParameterProviderEntity requestParameterProviderEntity) { @@ -356,7 +342,6 @@ public class ControllerResource extends ApplicationResource { /** * Creates a new Reporting Task. * - * @param httpServletRequest request * @param requestReportingTaskEntity A reportingTaskEntity. * @return A reportingTaskEntity. */ @@ -364,27 +349,26 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("reporting-tasks") - @ApiOperation( - value = "Creates a new reporting task", - response = ReportingTaskEntity.class, - authorizations = { - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @Authorization(value = "Write - if the Reporting Task is restricted - /restricted-components") + @Operation( + summary = "Creates a new reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Reporting Task is restricted - /restricted-components") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createReportingTask( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The reporting task configuration details.", + @Parameter( + description = "The reporting task configuration details.", required = true ) final ReportingTaskEntity requestReportingTaskEntity) { @@ -459,25 +443,24 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("reporting-tasks/import") - @ApiOperation( - value = "Imports a reporting task snapshot", - response = VersionedReportingTaskImportResponseEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Imports a reporting task snapshot", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedReportingTaskImportResponseEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response importReportingTaskSnapshot( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The import request containing the reporting task snapshot to import.", + @Parameter( + description = "The import request containing the reporting task snapshot to import.", required = true ) final VersionedReportingTaskImportRequestEntity importRequestEntity) { @@ -525,7 +508,6 @@ public class ControllerResource extends ApplicationResource { /** * Creates a new Flow Analysis Rule. * - * @param httpServletRequest request * @param requestFlowAnalysisRuleEntity A flowAnalysisRuleEntity. * @return A flowAnalysisRuleEntity.0 */ @@ -533,38 +515,35 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules") - @ApiOperation( - value = "Creates a new flow analysis rule", - response = FlowAnalysisRuleEntity.class, - authorizations = { - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @Authorization(value = "Write - if the Flow Analysis Rule is restricted - /restricted-components") - } + @Operation( + summary = "Creates a new flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Flow Analysis Rule is restricted - /restricted-components") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response createFlowAnalysisRule( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The flow analysis rule configuration details.", - required = true - ) final FlowAnalysisRuleEntity requestFlowAnalysisRuleEntity) { + @Parameter(description = "The flow analysis rule configuration details.", required = true) final FlowAnalysisRuleEntity requestFlowAnalysisRuleEntity + ) { if (requestFlowAnalysisRuleEntity == null || requestFlowAnalysisRuleEntity.getComponent() == null) { throw new IllegalArgumentException("Flow analysis rule details must be specified."); } if ( - requestFlowAnalysisRuleEntity.getRevision() == null - || (requestFlowAnalysisRuleEntity.getRevision().getVersion() == null - || requestFlowAnalysisRuleEntity.getRevision().getVersion() != 0) + requestFlowAnalysisRuleEntity.getRevision() == null + || (requestFlowAnalysisRuleEntity.getRevision().getVersion() == null + || requestFlowAnalysisRuleEntity.getRevision().getVersion() != 0) ) { throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Flow analysis rule."); } @@ -585,77 +564,75 @@ public class ControllerResource extends ApplicationResource { } return withWriteLock( - serviceFacade, - requestFlowAnalysisRuleEntity, - lookup -> { - authorizeController(RequestAction.WRITE); + serviceFacade, + requestFlowAnalysisRuleEntity, + lookup -> { + authorizeController(RequestAction.WRITE); - ComponentAuthorizable authorizable = null; - try { - authorizable = lookup.getConfigurableComponent(requestFlowAnalysisRule.getType(), requestFlowAnalysisRule.getBundle()); + ComponentAuthorizable authorizable = null; + try { + authorizable = lookup.getConfigurableComponent(requestFlowAnalysisRule.getType(), requestFlowAnalysisRule.getBundle()); - if (authorizable.isRestricted()) { - authorizeRestrictions(authorizer, authorizable); - } + if (authorizable.isRestricted()) { + authorizeRestrictions(authorizer, authorizable); + } - if (requestFlowAnalysisRule.getProperties() != null) { - AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestFlowAnalysisRule.getProperties(), authorizable, authorizer, lookup); - } - } finally { - if (authorizable != null) { - authorizable.cleanUpResources(); + if (requestFlowAnalysisRule.getProperties() != null) { + AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestFlowAnalysisRule.getProperties(), authorizable, authorizer, lookup); + } + } finally { + if (authorizable != null) { + authorizable.cleanUpResources(); + } } + }, + () -> serviceFacade.verifyCreateFlowAnalysisRule(requestFlowAnalysisRule), + (flowAnalysisRuleEntity) -> { + final FlowAnalysisRuleDTO flowAnalysisRule = flowAnalysisRuleEntity.getComponent(); + + // set the processor id as appropriate + flowAnalysisRule.setId(generateUuid()); + + // create the flow analysis rule and generate the json + final Revision revision = getRevision(flowAnalysisRuleEntity, flowAnalysisRule.getId()); + final FlowAnalysisRuleEntity entity = serviceFacade.createFlowAnalysisRule(revision, flowAnalysisRule); + populateRemainingFlowAnalysisRuleEntityContent(entity); + + // build the response + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); } - }, - () -> serviceFacade.verifyCreateFlowAnalysisRule(requestFlowAnalysisRule), - (flowAnalysisRuleEntity) -> { - final FlowAnalysisRuleDTO flowAnalysisRule = flowAnalysisRuleEntity.getComponent(); - - // set the processor id as appropriate - flowAnalysisRule.setId(generateUuid()); - - // create the flow analysis rule and generate the json - final Revision revision = getRevision(flowAnalysisRuleEntity, flowAnalysisRule.getId()); - final FlowAnalysisRuleEntity entity = serviceFacade.createFlowAnalysisRule(revision, flowAnalysisRule); - populateRemainingFlowAnalysisRuleEntityContent(entity); - - // build the response - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } ); } /** * Clears the state for a flow analysis rule. * - * @param httpServletRequest servlet request - * @param id The id of the flow analysis rule + * @param id The id of the flow analysis rule * @return a componentStateEntity */ @POST @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/state/clear-requests") - @ApiOperation( - value = "Clears the state for a flow analysis rule", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /flow-analysis-rules/{uuid}") + @Operation( + summary = "Clears the state for a flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response clearState( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") final String id) { @@ -688,8 +665,7 @@ public class ControllerResource extends ApplicationResource { /** * Updates the specified Flow Analysis Rule. * - * @param httpServletRequest request - * @param id The id of the flow analysis rule to update. + * @param id The id of the flow analysis rule to update. * @param requestFlowAnalysisRuleEntity A flowAnalysisRuleEntity. * @return A flowAnalysisRuleEntity. */ @@ -697,32 +673,31 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}") - @ApiOperation( - value = "Updates a flow analysis rule", - response = FlowAnalysisRuleEntity.class, - authorizations = { - @Authorization(value = "Write - /flow-analysis-rules/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") + @Operation( + summary = "Updates a flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateFlowAnalysisRule( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The flow analysis rule configuration details.", + @Parameter( + description = "The flow analysis rule configuration details.", required = true ) final FlowAnalysisRuleEntity requestFlowAnalysisRuleEntity) { @@ -778,56 +753,51 @@ public class ControllerResource extends ApplicationResource { /** * Removes the specified flow analysis rule. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the flow analysis rule to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the flow analysis rule to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}") - @ApiOperation( - value = "Deletes a flow analysis rule", - response = FlowAnalysisRuleEntity.class, - authorizations = { - @Authorization(value = "Write - /flow-analysis-rules/{uuid}"), - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}") + @Operation( + summary = "Deletes a flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"), + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeFlowAnalysisRule( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") String id) { @@ -867,8 +837,7 @@ public class ControllerResource extends ApplicationResource { /** * Updates the operational status for the specified FlowAnalysisRule with the specified values. * - * @param httpServletRequest request - * @param id The id of the flow analysis rule to update. + * @param id The id of the flow analysis rule to update. * @param requestRunStatus A runStatusEntity. * @return A flowAnalysisRuleEntity. */ @@ -876,31 +845,30 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/run-status") - @ApiOperation( - value = "Updates run status of a flow analysis rule", - response = FlowAnalysisRuleEntity.class, - authorizations = { - @Authorization(value = "Write - /flow-analysis-rules/{uuid} or or /operation/flow-analysis-rules/{uuid}") + @Operation( + summary = "Updates run status of a flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid} or or /operation/flow-analysis-rules/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRunStatus( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The flow analysis rule run status.", + @Parameter( + description = "The flow analysis rule run status.", required = true ) final FlowAnalysisRuleRunStatusEntity requestRunStatus) { @@ -981,19 +949,19 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules") - @ApiOperation( - value = "Gets all flow analysis rules", - response = FlowAnalysisRulesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets all flow analysis rules", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRulesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowAnalysisRules() { @@ -1025,25 +993,25 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}") - @ApiOperation( - value = "Gets a flow analysis rule", - response = FlowAnalysisRuleEntity.class, - authorizations = { - @Authorization(value = "Read - /flow-analysis-rules/{uuid}") + @Operation( + summary = "Gets a flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowAnalysisRule( - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") final String id @@ -1065,7 +1033,7 @@ public class ControllerResource extends ApplicationResource { /** * Returns the descriptor for the specified property. * - * @param id The id of the flow analysis rule. + * @param id The id of the flow analysis rule. * @param propertyName The property * @return a propertyDescriptorEntity */ @@ -1073,37 +1041,34 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/descriptors") - @ApiOperation( - value = "Gets a flow analysis rule property descriptor", - response = PropertyDescriptorEntity.class, - authorizations = { - @Authorization(value = "Read - /flow-analysis-rules/{uuid}") + @Operation( + summary = "Gets a flow analysis rule property descriptor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowAnalysisRulePropertyDescriptor( - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The property name.", + @Parameter( + description = "The property name.", required = true ) @QueryParam("propertyName") final String propertyName, - @ApiParam( - value = "Property Descriptor requested sensitive status", - defaultValue = "false" - ) + @Parameter(description = "Property Descriptor requested sensitive status") @QueryParam("sensitive") final boolean sensitive ) { @@ -1139,25 +1104,25 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/state") - @ApiOperation( - value = "Gets the state for a flow analysis rule", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /flow-analysis-rules/{uuid}") + @Operation( + summary = "Gets the state for a flow analysis rule", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowAnalysisRuleState( - @ApiParam( - value = "The flow analysis rule id.", + @Parameter( + description = "The flow analysis rule id.", required = true ) @PathParam("id") final String id) { @@ -1183,25 +1148,25 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/config/analysis") - @ApiOperation( - value = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - response = ConfigurationAnalysisEntity.class, - authorizations = { - @Authorization(value = "Read - /flow-analysis-rules/{uuid}") - } + @Operation( + summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response analyzeFlowAnalysisRuleConfiguration( - @ApiParam(value = "The flow analysis rules id.", required = true) @PathParam("id") final String flowAnalysisRuleId, - @ApiParam(value = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { + @Parameter(description = "The flow analysis rules id.", required = true) @PathParam("id") final String flowAnalysisRuleId, + @Parameter(description = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { if (configurationAnalysis == null || configurationAnalysis.getConfigurationAnalysis() == null) { throw new IllegalArgumentException("Flow Analysis Rules's configuration must be specified"); @@ -1225,15 +1190,16 @@ public class ControllerResource extends ApplicationResource { } return withWriteLock( - serviceFacade, - configurationAnalysis, - lookup -> authorizeController(RequestAction.READ), - () -> { }, - entity -> { - final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); - final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeFlowAnalysisRuleConfiguration(analysis.getComponentId(), analysis.getProperties()); - return generateOkResponse(resultsEntity).build(); - } + serviceFacade, + configurationAnalysis, + lookup -> authorizeController(RequestAction.READ), + () -> { + }, + entity -> { + final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); + final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeFlowAnalysisRuleConfiguration(analysis.getComponentId(), analysis.getProperties()); + return generateOkResponse(resultsEntity).build(); + } ); } @@ -1241,30 +1207,32 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/config/verification-requests") - @ApiOperation( - value = "Performs verification of the Flow Analysis Rule's configuration", - response = VerifyConfigRequestEntity.class, - notes = "This will initiate the process of verifying a given Flow Analysis Rule configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + - "FlowAnalysisRuleConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + - "The client may then periodically poll the status of the request by " + - "issuing a GET request to /flow-analysis-rules/{taskId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + - "/flow-analysis-rules/{serviceId}/verification-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /flow-analysis-rules/{uuid}") - } + @Operation( + summary = "Performs verification of the Flow Analysis Rule's configuration", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "This will initiate the process of verifying a given Flow Analysis Rule configuration. This may be a long-running task. As a result, this endpoint will immediately return " + + "a " + + "FlowAnalysisRuleConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + + "The client may then periodically poll the status of the request by " + + "issuing a GET request to /flow-analysis-rules/{taskId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/flow-analysis-rules/{serviceId}/verification-requests/{requestId}.", + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response submitFlowAnalysisRuleConfigVerificationRequest( - @ApiParam(value = "The flow analysis rules id.", required = true) @PathParam("id") final String flowAnalysisRuleId, - @ApiParam(value = "The flow analysis rules configuration verification request.", required = true) final VerifyConfigRequestEntity flowAnalysisRuleConfigRequest) { + @Parameter(description = "The flow analysis rules id.", required = true) + @PathParam("id") final String flowAnalysisRuleId, + @Parameter(description = "The flow analysis rules configuration verification request.", required = true) final VerifyConfigRequestEntity flowAnalysisRuleConfigRequest) { if (flowAnalysisRuleConfigRequest == null) { throw new IllegalArgumentException("Flow Analysis Rule's configuration must be specified"); @@ -1290,11 +1258,11 @@ public class ControllerResource extends ApplicationResource { final NiFiUser user = NiFiUserUtils.getNiFiUser(); return withWriteLock( - serviceFacade, - flowAnalysisRuleConfigRequest, - lookup -> authorizeController(RequestAction.READ), - () -> serviceFacade.verifyCanVerifyFlowAnalysisRuleConfig(flowAnalysisRuleId), - entity -> performAsyncFlowAnalysisRuleConfigVerification(entity, user) + serviceFacade, + flowAnalysisRuleConfigRequest, + lookup -> authorizeController(RequestAction.READ), + () -> serviceFacade.verifyCanVerifyFlowAnalysisRuleConfig(flowAnalysisRuleId), + entity -> performAsyncFlowAnalysisRuleConfigVerification(entity, user) ); } @@ -1302,25 +1270,30 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Returns the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getFlowAnalysisRuleVerificationRequest( - @ApiParam("The ID of the Flow Analysis Rule") @PathParam("id") final String flowAnalysisRuleId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Flow Analysis Rule") + @PathParam("id") final String flowAnalysisRuleId, + @Parameter(description = "The ID of the Verification Request") + @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -1340,25 +1313,30 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rules/{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Deletes the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteFlowAnalysisRuleVerificationRequest( - @ApiParam("The ID of the Flow Analysis Rule") @PathParam("id") final String flowAnalysisRuleId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Flow Analysis Rule") + @PathParam("id") final String flowAnalysisRuleId, + @Parameter(description = "The ID of the Verification Request") + @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -1406,7 +1384,7 @@ public class ControllerResource extends ApplicationResource { final List updateSteps = Collections.singletonList(new StandardUpdateStep("Verify Flow Analysis Rule Configuration")); final AsynchronousWebRequest> request = - new StandardAsynchronousWebRequest<>(requestId, configRequest, taskId, user, updateSteps); + new StandardAsynchronousWebRequest<>(requestId, configRequest, taskId, user, updateSteps); // Submit the request to be performed in the background final Consumer>> verificationTask = asyncRequest -> { @@ -1427,7 +1405,7 @@ public class ControllerResource extends ApplicationResource { } private VerifyConfigRequestEntity createVerifyFlowAnalysisRuleConfigRequestEntity( - final AsynchronousWebRequest> asyncRequest, final String requestId) { + final AsynchronousWebRequest> asyncRequest, final String requestId) { final VerifyConfigRequestDTO requestDto = asyncRequest.getRequest().getRequest(); final List resultsList = asyncRequest.getResults(); @@ -1464,16 +1442,22 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registry-clients") - @ApiOperation(value = "Gets the listing of available flow registry clients", response = FlowRegistryClientsEntity.class, authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Gets the listing of available flow registry clients", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getFlowRegistryClients() { authorizeController(RequestAction.READ); @@ -1492,7 +1476,6 @@ public class ControllerResource extends ApplicationResource { /** * Creates a new flow registry client. * - * @param httpServletRequest request * @param requestFlowRegistryClientEntity A registryClientEntity. * @return A FlowRegistryClientEntity. */ @@ -1500,28 +1483,26 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("registry-clients") - @ApiOperation( - value = "Creates a new flow registry client", - response = FlowRegistryClientEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Creates a new flow registry client", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createFlowRegistryClient( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The flow registry client configuration details.", + @Parameter( + description = "The flow registry client configuration details.", required = true ) final FlowRegistryClientEntity requestFlowRegistryClientEntity) { - // authorize access authorizeController(RequestAction.READ); if (requestFlowRegistryClientEntity == null || requestFlowRegistryClientEntity.getComponent() == null) { @@ -1591,25 +1572,25 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/registry-clients/{id}") - @ApiOperation( - value = "Gets a flow registry client", - response = FlowRegistryClientEntity.class, - authorizations = { - @Authorization(value = "Read - /controller") + @Operation( + summary = "Gets a flow registry client", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowRegistryClient( - @ApiParam( - value = "The flow registry client id.", + @Parameter( + description = "The flow registry client id.", required = true ) @PathParam("id") final String id) { @@ -1629,7 +1610,6 @@ public class ControllerResource extends ApplicationResource { /** * Updates the specified flow registry client. * - * @param httpServletRequest request * @param id The id of the flow registry client to update. * @param requestFlowRegistryClientEntity A flowRegistryClientEntity. * @return A flowRegistryClientEntity. @@ -1638,31 +1618,30 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/registry-clients/{id}") - @ApiOperation( - value = "Updates a flow registry client", - response = FlowRegistryClientEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Updates a flow registry client", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateFlowRegistryClient( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The flow registry client id.", + @Parameter( + description = "The flow registry client id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The flow registry client configuration details.", + @Parameter( + description = "The flow registry client configuration details.", required = true ) final FlowRegistryClientEntity requestFlowRegistryClientEntity) { @@ -1718,54 +1697,49 @@ public class ControllerResource extends ApplicationResource { /** * Removes the specified flow registry client. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the flow registry client to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the flow registry client to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/registry-clients/{id}") - @ApiOperation( - value = "Deletes a flow registry client", - response = FlowRegistryClientEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Deletes a flow registry client", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteFlowRegistryClient( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The flow registry client id.", + @Parameter( + description = "The flow registry client id.", required = true ) @PathParam("id") final String id) { @@ -1803,7 +1777,7 @@ public class ControllerResource extends ApplicationResource { /** * Returns the descriptor for the specified property. * - * @param id The id of the flow registry client. + * @param id The id of the flow registry client. * @param propertyName The property * @return a propertyDescriptorEntity */ @@ -1811,37 +1785,34 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/registry-clients/{id}/descriptors") - @ApiOperation( - value = "Gets a flow registry client property descriptor", - response = PropertyDescriptorEntity.class, - authorizations = { - @Authorization(value = "Read - /controller/registry-clients/{uuid}") + @Operation( + summary = "Gets a flow registry client property descriptor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller/registry-clients/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPropertyDescriptor( - @ApiParam( - value = "The flow registry client id.", + @Parameter( + description = "The flow registry client id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The property name.", + @Parameter( + description = "The property name.", required = true ) @QueryParam("propertyName") final String propertyName, - @ApiParam( - value = "Property Descriptor requested sensitive status", - defaultValue = "false" - ) + @Parameter(description = "Property Descriptor requested sensitive status") @QueryParam("sensitive") final boolean sensitive ) { @@ -1877,20 +1848,20 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registry-types") - @ApiOperation( - value = "Retrieves the types of flow that this NiFi supports", - notes = NON_GUARANTEED_ENDPOINT, - response = FlowRegistryClientTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of flow that this NiFi supports", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getRegistryClientTypes() { @@ -1937,7 +1908,6 @@ public class ControllerResource extends ApplicationResource { /** * Creates a Bulletin. * - * @param httpServletRequest request * @param requestBulletinEntity A bulletinEntity. * @return A bulletinEntity. */ @@ -1945,25 +1915,24 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("bulletin") - @ApiOperation( - value = "Creates a new bulletin", - response = BulletinEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Creates a new bulletin", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BulletinEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createBulletin( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The reporting task configuration details.", + @Parameter( + description = "The reporting task configuration details.", required = true ) final BulletinEntity requestBulletinEntity) { @@ -1993,7 +1962,7 @@ public class ControllerResource extends ApplicationResource { null, (bulletinEntity) -> { final BulletinDTO bulletin = bulletinEntity.getBulletin(); - final BulletinEntity entity = serviceFacade.createBulletin(bulletin,true); + final BulletinEntity entity = serviceFacade.createBulletin(bulletin, true); return generateOkResponse(entity).build(); } ); @@ -2006,7 +1975,6 @@ public class ControllerResource extends ApplicationResource { /** * Creates a new Controller Service. * - * @param httpServletRequest request * @param requestControllerServiceEntity A controllerServiceEntity. * @return A controllerServiceEntity. */ @@ -2014,27 +1982,26 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("controller-services") - @ApiOperation( - value = "Creates a new controller service", - response = ControllerServiceEntity.class, - authorizations = { - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @Authorization(value = "Write - if the Controller Service is restricted - /restricted-components") + @Operation( + summary = "Creates a new controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Controller Service is restricted - /restricted-components") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createControllerService( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The controller service configuration details.", + @Parameter( + description = "The controller service configuration details.", required = true ) final ControllerServiceEntity requestControllerServiceEntity) { @@ -2120,20 +2087,20 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("cluster") - @ApiOperation( - value = "Gets the contents of the cluster", - notes = "Returns the contents of the cluster including all nodes and their status.", - response = ClusterEntity.class, - authorizations = { - @Authorization(value = "Read - /controller") + @Operation( + summary = "Gets the contents of the cluster", + description = "Returns the contents of the cluster including all nodes and their status.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ClusterEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getCluster() { @@ -2169,25 +2136,25 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("cluster/nodes/{id}") - @ApiOperation( - value = "Gets a node in the cluster", - response = NodeEntity.class, - authorizations = { - @Authorization(value = "Read - /controller") + @Operation( + summary = "Gets a node in the cluster", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NodeEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getNode( - @ApiParam( - value = "The node id.", + @Parameter( + description = "The node id.", required = true ) @PathParam("id") String id) { @@ -2217,7 +2184,7 @@ public class ControllerResource extends ApplicationResource { /** * Updates the contents of the specified node in this NiFi cluster. * - * @param id The id of the node + * @param id The id of the node * @param nodeEntity A nodeEntity * @return A nodeEntity */ @@ -2225,30 +2192,30 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("cluster/nodes/{id}") - @ApiOperation( - value = "Updates a node in the cluster", - response = NodeEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Updates a node in the cluster", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NodeEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateNode( - @ApiParam( - value = "The node id.", + @Parameter( + description = "The node id.", required = true ) @PathParam("id") String id, - @ApiParam( - value = "The node configuration. The only configuration that will be honored at this endpoint is the status.", + @Parameter( + description = "The node configuration. The only configuration that will be honored at this endpoint is the status.", required = true ) NodeEntity nodeEntity) { @@ -2295,25 +2262,25 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("cluster/nodes/{id}") - @ApiOperation( - value = "Removes a node from the cluster", - response = NodeEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Removes a node from the cluster", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NodeEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteNode( - @ApiParam( - value = "The node id.", + @Parameter( + description = "The node id.", required = true ) @PathParam("id") String id) { @@ -2346,21 +2313,21 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("status/history") - @ApiOperation( - value = "Gets status history for the node", - notes = NON_GUARANTEED_ENDPOINT, - response = ComponentHistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /controller") + @Operation( + summary = "Gets status history for the node", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentHistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getNodeStatusHistory() { @@ -2385,25 +2352,24 @@ public class ControllerResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("history") - @ApiOperation( - value = "Purges history", - response = HistoryEntity.class, - authorizations = { - @Authorization(value = "Write - /controller") + @Operation( + summary = "Purges history", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = HistoryEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteHistory( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "Purge actions before this date/time.", + @Parameter( + description = "Purge actions before this date/time.", required = true ) @QueryParam("endDate") DateTimeParameter endDate) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java index d8aca6b360..ab8a292a53 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java @@ -16,14 +16,6 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -32,8 +24,16 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.stream.Collectors; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -97,13 +97,7 @@ import org.slf4j.LoggerFactory; * RESTful endpoint for managing a Controller Service. */ @Path("/controller-services") -@Api( - value = "/controller-services", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Controller Service.") -}) +@Tag(name = "Controller Services") public class ControllerServiceResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ControllerServiceResource.class); @@ -177,27 +171,28 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a controller service", - response = ControllerServiceEntity.class, - authorizations = { - @Authorization(value = "Read - /controller-services/{uuid}") + @Operation( + summary = "Gets a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") }, - notes = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As such, " + - "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." + description = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As " + + "such, " + + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerService( - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id, @@ -227,7 +222,7 @@ public class ControllerServiceResource extends ApplicationResource { /** * Returns the descriptor for the specified property. * - * @param id The id of the controller service. + * @param id The id of the controller service. * @param propertyName The property * @return a propertyDescriptorEntity */ @@ -235,36 +230,35 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/descriptors") - @ApiOperation( - value = "Gets a controller service property descriptor", - response = PropertyDescriptorEntity.class, - authorizations = { - @Authorization(value = "Read - /controller-services/{uuid}") + @Operation( + summary = "Gets a controller service property descriptor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPropertyDescriptor( - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The property name to return the descriptor for.", + @Parameter( + description = "The property name to return the descriptor for.", required = true ) @QueryParam("propertyName") final String propertyName, - @ApiParam( - value = "Property Descriptor requested sensitive status", - defaultValue = "false" + @Parameter( + description = "Property Descriptor requested sensitive status" ) @QueryParam("sensitive") final boolean sensitive ) { @@ -305,25 +299,25 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state") - @ApiOperation( - value = "Gets the state for a controller service", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /controller-services/{uuid}") + @Operation( + summary = "Gets the state for a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getState( - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id) { @@ -352,34 +346,32 @@ public class ControllerServiceResource extends ApplicationResource { /** * Clears the state for a controller service. * - * @param httpServletRequest servlet request - * @param id The id of the controller service + * @param id The id of the controller service * @return a componentStateEntity */ @POST @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state/clear-requests") - @ApiOperation( - value = "Clears the state for a controller service", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /controller-services/{uuid}") + @Operation( + summary = "Clears the state for a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response clearState( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id) { @@ -422,25 +414,25 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/references") - @ApiOperation( - value = "Gets a controller service", - response = ControllerServiceReferencingComponentsEntity.class, - authorizations = { - @Authorization(value = "Read - /controller-services/{uuid}") + @Operation( + summary = "Gets a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceReferencingComponentsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerServiceReferences( - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id) { @@ -464,7 +456,6 @@ public class ControllerServiceResource extends ApplicationResource { /** * Updates the references of the specified controller service. * - * @param httpServletRequest request * @param requestUpdateReferenceRequest The update request * @return A controllerServiceReferencingComponentsEntity. */ @@ -472,31 +463,30 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/references") - @ApiOperation( - value = "Updates a controller services references", - response = ControllerServiceReferencingComponentsEntity.class, - authorizations = { - @Authorization(value = "Write - /{component-type}/{uuid} or /operate/{component-type}/{uuid} - For each referencing component specified") + @Operation( + summary = "Updates a controller services references", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceReferencingComponentsEntity.class))), + security = { + @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operate/{component-type}/{uuid} - For each referencing component specified") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateControllerServiceReferences( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The controller service request update request.", + @Parameter( + description = "The controller service request update request.", required = true ) final UpdateControllerServiceReferenceRequestEntity requestUpdateReferenceRequest) { @@ -604,8 +594,7 @@ public class ControllerServiceResource extends ApplicationResource { /** * Updates the specified a new Controller Service. * - * @param httpServletRequest request - * @param id The id of the controller service to update. + * @param id The id of the controller service to update. * @param requestControllerServiceEntity A controllerServiceEntity. * @return A controllerServiceEntity. */ @@ -613,32 +602,31 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a controller service", - response = ControllerServiceEntity.class, - authorizations = { - @Authorization(value = "Write - /controller-services/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") + @Operation( + summary = "Updates a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateControllerService( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The controller service configuration details.", + @Parameter( + description = "The controller service configuration details.", required = true ) final ControllerServiceEntity requestControllerServiceEntity) { @@ -659,7 +647,7 @@ public class ControllerServiceResource extends ApplicationResource { if (isReplicateRequest()) { return replicate(HttpMethod.PUT, requestControllerServiceEntity); - } else if (isDisconnectedFromCluster()) { + } else if (isDisconnectedFromCluster()) { verifyDisconnectedNodeModification(requestControllerServiceEntity.isDisconnectedNodeAcknowledged()); } @@ -676,7 +664,7 @@ public class ControllerServiceResource extends ApplicationResource { // authorize any referenced services AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestControllerServiceDTO.getProperties(), authorizable, authorizer, lookup); - AuthorizeParameterReference.authorizeParameterReferences(requestControllerServiceDTO.getProperties(), authorizer, authorizable.getParameterContext(), + AuthorizeParameterReference.authorizeParameterReferences(requestControllerServiceDTO.getProperties(), authorizer, authorizable.getParameterContext(), NiFiUserUtils.getNiFiUser()); }, () -> serviceFacade.verifyUpdateControllerService(requestControllerServiceDTO), @@ -695,57 +683,52 @@ public class ControllerServiceResource extends ApplicationResource { /** * Removes the specified controller service. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the controller service to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the controller service to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a controller service", - response = ControllerServiceEntity.class, - authorizations = { - @Authorization(value = "Write - /controller-services/{uuid}"), - @Authorization(value = "Write - Parent Process Group if scoped by Process Group - /process-groups/{uuid}"), - @Authorization(value = "Write - Controller if scoped by Controller - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}") + @Operation( + summary = "Deletes a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group if scoped by Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - Controller if scoped by Controller - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeControllerService( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id) { @@ -789,40 +772,38 @@ public class ControllerServiceResource extends ApplicationResource { /** * Updates the operational status for the specified controller service with the specified values. * - * @param httpServletRequest request - * @param id The id of the controller service to update. - * @param requestRunStatus A runStatusEntity. + * @param id The id of the controller service to update. + * @param requestRunStatus A runStatusEntity. * @return A controllerServiceEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/run-status") - @ApiOperation( - value = "Updates run status of a controller service", - response = ControllerServiceEntity.class, - authorizations = { - @Authorization(value = "Write - /controller-services/{uuid} or /operation/controller-services/{uuid}") + @Operation( + summary = "Updates run status of a controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid} or /operation/controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRunStatus( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The controller service id.", + @Parameter( + description = "The controller service id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The controller service run status.", + @Parameter( + description = "The controller service run status.", required = true ) final ControllerServiceRunStatusEntity requestRunStatus) { @@ -838,7 +819,7 @@ public class ControllerServiceResource extends ApplicationResource { if (isReplicateRequest()) { return replicate(HttpMethod.PUT, requestRunStatus); - } else if (isDisconnectedFromCluster()) { + } else if (isDisconnectedFromCluster()) { verifyDisconnectedNodeModification(requestRunStatus.isDisconnectedNodeAcknowledged()); } @@ -872,25 +853,26 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/analysis") - @ApiOperation( - value = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - response = ConfigurationAnalysisEntity.class, - authorizations = { - @Authorization(value = "Read - /controller-services/{uuid}") - } + @Operation( + summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response analyzeConfiguration( - @ApiParam(value = "The controller service id.", required = true) @PathParam("id") final String controllerServiceId, - @ApiParam(value = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { + @Parameter(description = "The controller service id.", required = true) + @PathParam("id") final String controllerServiceId, + @Parameter(description = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { if (configurationAnalysis == null || configurationAnalysis.getConfigurationAnalysis() == null) { throw new IllegalArgumentException("Controller Service's configuration must be specified"); @@ -914,18 +896,19 @@ public class ControllerServiceResource extends ApplicationResource { } return withWriteLock( - serviceFacade, - configurationAnalysis, - lookup -> { - final ComponentAuthorizable controllerService = lookup.getControllerService(controllerServiceId); - controllerService.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> { }, - entity -> { - final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); - final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeControllerServiceConfiguration(analysis.getComponentId(), analysis.getProperties()); - return generateOkResponse(resultsEntity).build(); - } + serviceFacade, + configurationAnalysis, + lookup -> { + final ComponentAuthorizable controllerService = lookup.getControllerService(controllerServiceId); + controllerService.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + }, + entity -> { + final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); + final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeControllerServiceConfiguration(analysis.getComponentId(), analysis.getProperties()); + return generateOkResponse(resultsEntity).build(); + } ); } @@ -933,30 +916,32 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/verification-requests") - @ApiOperation( - value = "Performs verification of the Controller Service's configuration", - response = VerifyConfigRequestEntity.class, - notes = "This will initiate the process of verifying a given Controller Service configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + - "ControllerServiceConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + - "The client may then periodically poll the status of the request by " + - "issuing a GET request to /controller-services/{serviceId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + - "/controller-services/{serviceId}/verification-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /controller-services/{uuid}") - } + @Operation( + summary = "Performs verification of the Controller Service's configuration", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "This will initiate the process of verifying a given Controller Service configuration. This may be a long-running task. As a result, this endpoint will immediately return " + + "a " + + "ControllerServiceConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + + "The client may then periodically poll the status of the request by " + + "issuing a GET request to /controller-services/{serviceId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/controller-services/{serviceId}/verification-requests/{requestId}.", + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response submitConfigVerificationRequest( - @ApiParam(value = "The controller service id.", required = true) @PathParam("id") final String controllerServiceId, - @ApiParam(value = "The controller service configuration verification request.", required = true) final VerifyConfigRequestEntity controllerServiceConfigRequest) { + @Parameter(description = "The controller service id.", required = true) + @PathParam("id") final String controllerServiceId, + @Parameter(description = "The controller service configuration verification request.", required = true) final VerifyConfigRequestEntity controllerServiceConfigRequest) { if (controllerServiceConfigRequest == null) { throw new IllegalArgumentException("Controller Service's configuration must be specified"); @@ -982,16 +967,16 @@ public class ControllerServiceResource extends ApplicationResource { final NiFiUser user = NiFiUserUtils.getNiFiUser(); return withWriteLock( - serviceFacade, - controllerServiceConfigRequest, - lookup -> { - final ComponentAuthorizable controllerService = lookup.getControllerService(controllerServiceId); - controllerService.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> { - serviceFacade.verifyCanVerifyControllerServiceConfig(controllerServiceId); - }, - entity -> performAsyncConfigVerification(entity, user) + serviceFacade, + controllerServiceConfigRequest, + lookup -> { + final ComponentAuthorizable controllerService = lookup.getControllerService(controllerServiceId); + controllerService.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + serviceFacade.verifyCanVerifyControllerServiceConfig(controllerServiceId); + }, + entity -> performAsyncConfigVerification(entity, user) ); } @@ -999,25 +984,28 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Returns the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getVerificationRequest( - @ApiParam("The ID of the Controller Service") @PathParam("id") final String controllerServiceId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Controller Service") @PathParam("id") final String controllerServiceId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -1038,25 +1026,31 @@ public class ControllerServiceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Deletes the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteVerificationRequest( - @ApiParam("The ID of the Controller Service") @PathParam("id") final String controllerServiceId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Controller Service") + @PathParam("id") final String controllerServiceId, + @Parameter(description = "The ID of the Verification Request") + @PathParam("requestId") final String requestId + ) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -1105,7 +1099,7 @@ public class ControllerServiceResource extends ApplicationResource { final List updateSteps = Collections.singletonList(new StandardUpdateStep("Verify Controller Service Configuration")); final AsynchronousWebRequest> request = - new StandardAsynchronousWebRequest<>(requestId, configRequest, serviceId, user, updateSteps); + new StandardAsynchronousWebRequest<>(requestId, configRequest, serviceId, user, updateSteps); // Submit the request to be performed in the background final Consumer>> updateTask = asyncRequest -> { @@ -1127,7 +1121,7 @@ public class ControllerServiceResource extends ApplicationResource { } private VerifyConfigRequestEntity createVerifyControllerServiceConfigRequestEntity( - final AsynchronousWebRequest> asyncRequest, final String requestId) { + final AsynchronousWebRequest> asyncRequest, final String requestId) { final VerifyConfigRequestDTO requestDto = asyncRequest.getRequest().getRequest(); final List resultsList = asyncRequest.getResults(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java index f461d68de7..db65b9271b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java @@ -16,15 +16,14 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; -import jakarta.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.GET; @@ -34,7 +33,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.nifi.authorization.Authorizer; @@ -51,18 +49,11 @@ import org.apache.nifi.web.api.entity.ComponentEntity; import org.apache.nifi.web.api.entity.CounterEntity; import org.apache.nifi.web.api.entity.CountersEntity; - /** - * RESTful endpoint for managing a cluster. + * RESTful endpoint for managing Counters. */ @Path("/counters") -@Api( - value = "/counters", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing counters.") -}) +@Tag(name = "Counters") public class CountersResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -87,32 +78,30 @@ public class CountersResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @Path("") // necessary due to a bug in swagger - @ApiOperation( - value = "Gets the current counters for this NiFi", - notes = NON_GUARANTEED_ENDPOINT, - response = CountersEntity.class, - authorizations = { - @Authorization(value = "Read - /counters") + @Path("") + @Operation( + summary = "Gets the current counters for this NiFi", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CountersEntity.class))), + security = { + @SecurityRequirement(name = "Read - /counters") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getCounters( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false", - required = false + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) final Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status.", - required = false + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") final String clusterNodeId) throws InterruptedException { @@ -170,36 +159,32 @@ public class CountersResource extends ApplicationResource { /** * Update the specified counter. This will reset the counter value to 0. * - * @param httpServletRequest request - * @param id The id of the counter. + * @param id The id of the counter. * @return A counterEntity. */ @PUT @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates the specified counter. This will reset the counter value to 0", - notes = NON_GUARANTEED_ENDPOINT, - response = CounterEntity.class, - authorizations = { - @Authorization(value = "Write - /counters") + @Operation( + summary = "Updates the specified counter. This will reset the counter value to 0", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CounterEntity.class))), + security = { + @SecurityRequirement(name = "Write - /counters") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateCounter( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The id of the counter." - ) + @Parameter(description = "The id of the counter.") @PathParam("id") final String id) { if (isReplicateRequest()) { @@ -212,9 +197,7 @@ public class CountersResource extends ApplicationResource { return withWriteLock( serviceFacade, requestComponentEntity, - lookup -> { - authorizeCounters(RequestAction.WRITE); - }, + lookup -> authorizeCounters(RequestAction.WRITE), null, (componentEntity) -> { // reset the specified counter @@ -230,8 +213,6 @@ public class CountersResource extends ApplicationResource { ); } - // setters - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java index a14d5e470c..0b6e82fe19 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java @@ -16,20 +16,21 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.UnknownHostException; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -96,13 +97,7 @@ import static org.apache.nifi.remote.protocol.http.HttpHeaders.HANDSHAKE_PROPERT * RESTful endpoint for managing a SiteToSite connection. */ @Path("/data-transfer") -@Api( - value = "/data-transfer", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Supports data transfers with this NiFi using HTTP based site to site.") -}) +@Tag(name = "DataTransfer") public class DataTransferResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(DataTransferResource.class); @@ -120,7 +115,7 @@ public class DataTransferResource extends ApplicationResource { private final HttpRemoteSiteListener transactionManager; private final NiFiProperties nifiProperties; - public DataTransferResource(final NiFiProperties nifiProperties){ + public DataTransferResource(final NiFiProperties nifiProperties) { this.nifiProperties = nifiProperties; transactionManager = HttpRemoteSiteListener.getInstance(nifiProperties); } @@ -156,28 +151,27 @@ public class DataTransferResource extends ApplicationResource { @POST @Produces(MediaType.APPLICATION_JSON) @Path("{portType}/{portId}/transactions") - @ApiOperation( - value = "Create a transaction to the specified output port or input port", - response = TransactionResultEntity.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/{component-type}/{uuid}") + @Operation( + summary = "Create a transaction to the specified output port or input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful."), - @ApiResponse(code = 503, message = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), } ) public Response createPortTransaction( - @ApiParam( - value = "The port type.", - required = true, - allowableValues = "input-ports, output-ports" + @Parameter( + description = "The port type.", + required = true ) @PathParam("portType") String portType, @PathParam("portId") String portId, @@ -230,26 +224,26 @@ public class DataTransferResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.TEXT_PLAIN) @Path("input-ports/{portId}/transactions/{transactionId}/flow-files") - @ApiOperation( - value = "Transfer flow files to the input port", - response = String.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/input-ports/{uuid}") + @Operation( + summary = "Transfer flow files to the input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful."), - @ApiResponse(code = 503, message = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), } ) public Response receiveFlowFiles( - @ApiParam( - value = "The input port id.", + @Parameter( + description = "The input port id.", required = true ) @PathParam("portId") String portId, @@ -306,7 +300,7 @@ public class DataTransferResource extends ApplicationResource { VersionNegotiator versionNegotiator = new StandardVersionNegotiator(negotiatedTransportProtocolVersion.getTransactionProtocolVersion()); final String dataTransferUrl = req.getRequestURL().toString(); - ((HttpCommunicationsSession)peer.getCommunicationsSession()).setDataTransferUrl(dataTransferUrl); + ((HttpCommunicationsSession) peer.getCommunicationsSession()).setDataTransferUrl(dataTransferUrl); HttpFlowFileServerProtocol serverProtocol = getHttpFlowFileServerProtocol(versionNegotiator); HttpRemoteSiteListener.getInstance(nifiProperties).setupServerProtocol(serverProtocol); @@ -380,41 +374,41 @@ public class DataTransferResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) @Path("output-ports/{portId}/transactions/{transactionId}") - @ApiOperation( - value = "Commit or cancel the specified transaction", - response = TransactionResultEntity.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/output-ports/{uuid}") + @Operation( + summary = "Commit or cancel the specified transaction", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful."), - @ApiResponse(code = 503, message = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), } ) public Response commitOutputPortTransaction( - @ApiParam( - value = "The response code. Available values are CONFIRM_TRANSACTION(12) or CANCEL_TRANSACTION(15).", + @Parameter( + description = "The response code. Available values are CONFIRM_TRANSACTION(12) or CANCEL_TRANSACTION(15).", required = true ) @QueryParam(RESPONSE_CODE) Integer responseCode, - @ApiParam( - value = "A checksum calculated at client side using CRC32 to check flow file content integrity. It must match with the value calculated at server side.", + @Parameter( + description = "A checksum calculated at client side using CRC32 to check flow file content integrity. It must match with the value calculated at server side.", required = true ) @QueryParam(CHECK_SUM) @DefaultValue(StringUtils.EMPTY) String checksum, - @ApiParam( - value = "The output port id.", + @Parameter( + description = "The output port id.", required = true ) @PathParam("portId") String portId, - @ApiParam( - value = "The transaction id.", + @Parameter( + description = "The transaction id.", required = true ) @PathParam("transactionId") String transactionId, @@ -489,36 +483,36 @@ public class DataTransferResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) @Path("input-ports/{portId}/transactions/{transactionId}") - @ApiOperation( - value = "Commit or cancel the specified transaction", - response = TransactionResultEntity.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/input-ports/{uuid}") + @Operation( + summary = "Commit or cancel the specified transaction", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful."), - @ApiResponse(code = 503, message = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), } ) public Response commitInputPortTransaction( - @ApiParam( - value = "The response code. Available values are BAD_CHECKSUM(19), CONFIRM_TRANSACTION(12) or CANCEL_TRANSACTION(15).", + @Parameter( + description = "The response code. Available values are BAD_CHECKSUM(19), CONFIRM_TRANSACTION(12) or CANCEL_TRANSACTION(15).", required = true ) @QueryParam(RESPONSE_CODE) Integer responseCode, - @ApiParam( - value = "The input port id.", + @Parameter( + description = "The input port id.", required = true ) @PathParam("portId") String portId, - @ApiParam( - value = "The transaction id.", + @Parameter( + description = "The transaction id.", required = true ) @PathParam("transactionId") String transactionId, @@ -609,27 +603,27 @@ public class DataTransferResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_OCTET_STREAM) @Path("output-ports/{portId}/transactions/{transactionId}/flow-files") - @ApiOperation( - value = "Transfer flow files from the output port", - response = StreamingOutput.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/output-ports/{uuid}") + @Operation( + summary = "Transfer flow files from the output port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 200, message = "There is no flow file to return."), - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful."), - @ApiResponse(code = 503, message = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + @ApiResponse(responseCode = "200", description = "There is no flow file to return."), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), } ) public Response transferFlowFiles( - @ApiParam( - value = "The output port id.", + @Parameter( + description = "The output port id.", required = true ) @PathParam("portId") String portId, @@ -695,20 +689,20 @@ public class DataTransferResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("input-ports/{portId}/transactions/{transactionId}") - @ApiOperation( - value = "Extend transaction TTL", - response = TransactionResultEntity.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/input-ports/{uuid}") + @Operation( + summary = "Extend transaction TTL", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response extendInputPortTransactionTTL( @@ -732,21 +726,21 @@ public class DataTransferResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("output-ports/{portId}/transactions/{transactionId}") - @ApiOperation( - value = "Extend transaction TTL", - response = TransactionResultEntity.class, - authorizations = { - @Authorization(value = "Write - /data-transfer/output-ports/{uuid}") + @Operation( + summary = "Extend transaction TTL", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), + security = { + @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful."), - @ApiResponse(code = 503, message = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), + @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), } ) public Response extendOutputPortTransactionTTL( @@ -842,9 +836,6 @@ public class DataTransferResource extends ApplicationResource { return result; } - - // setters - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java index 92328828c9..2f87914ee3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java @@ -16,19 +16,19 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URI; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -40,7 +40,6 @@ import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response.Status; @@ -71,13 +70,7 @@ import org.apache.nifi.web.api.request.ClientIdParameter; * RESTful endpoint for managing a flowfile queue. */ @Path("/flowfile-queues") -@Api( - value = "/flowfile-queues", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a FlowFile Queue.") -}) +@Tag(name = "FlowFileQueues") public class FlowFileQueueResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -86,7 +79,7 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Populate the URIs for the specified flowfile listing. * - * @param connectionId connection + * @param connectionId connection * @param flowFileListing flowfile listing * @return dto */ @@ -107,7 +100,7 @@ public class FlowFileQueueResource extends ApplicationResource { * Populate the URIs for the specified flowfile. * * @param connectionId the connection id - * @param flowFile the flowfile + * @param flowFile the flowfile * @return the dto */ public FlowFileSummaryDTO populateRemainingFlowFileContent(final String connectionId, final FlowFileSummaryDTO flowFile) { @@ -118,8 +111,8 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Gets the specified flowfile from the specified connection. * - * @param connectionId The connection id - * @param flowFileUuid The flowfile uuid + * @param connectionId The connection id + * @param flowFileUuid The flowfile uuid * @param clusterNodeId The cluster node id where the flowfile resides * @return a flowFileDTO * @throws InterruptedException if interrupted @@ -128,36 +121,35 @@ public class FlowFileQueueResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/flowfiles/{flowfile-uuid}") - @ApiOperation( - value = "Gets a FlowFile from a Connection.", - response = FlowFileEntity.class, - authorizations = { - @Authorization(value = "Read Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets a FlowFile from a Connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowFileEntity.class))), + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowFile( - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String connectionId, - @ApiParam( - value = "The flowfile uuid.", + @Parameter( + description = "The flowfile uuid.", required = true ) @PathParam("flowfile-uuid") final String flowFileUuid, - @ApiParam( - value = "The id of the node where the content exists if clustered.", - required = false + @Parameter( + description = "The id of the node where the content exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId) throws InterruptedException { @@ -193,9 +185,9 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Gets the content for the specified flowfile in the specified connection. * - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param connectionId The connection id - * @param flowFileUuid The flowfile uuid + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param connectionId The connection id + * @param flowFileUuid The flowfile uuid * @param clusterNodeId The cluster node id * @return The content stream * @throws InterruptedException if interrupted @@ -204,43 +196,41 @@ public class FlowFileQueueResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("{id}/flowfiles/{flowfile-uuid}/content") - @ApiOperation( - value = "Gets the content for a FlowFile in a Connection.", - response = StreamingOutput.class, - authorizations = { - @Authorization(value = "Read Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets the content for a FlowFile in a Connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response downloadFlowFileContent( - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String connectionId, - @ApiParam( - value = "The flowfile uuid.", + @Parameter( + description = "The flowfile uuid.", required = true ) @PathParam("flowfile-uuid") final String flowFileUuid, - @ApiParam( - value = "The id of the node where the content exists if clustered.", - required = false + @Parameter( + description = "The id of the node where the content exists if clustered." ) - @QueryParam("clusterNodeId") final String clusterNodeId) throws InterruptedException { + @QueryParam("clusterNodeId") final String clusterNodeId) { // replicate if cluster manager if (isReplicateRequest()) { @@ -292,37 +282,32 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Creates a request to list the flowfiles in the queue of the specified connection. * - * @param httpServletRequest request - * @param id The id of the connection + * @param id The id of the connection * @return A listRequestEntity */ @POST @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/listing-requests") - @ApiOperation( - value = "Lists the contents of the queue in this connection.", - response = ListingRequestEntity.class, - authorizations = { - @Authorization(value = "Read Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Lists the contents of the queue in this connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 202, message = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled."), - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "202", description = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled."), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createFlowFileListing( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The connection id.", - required = true - ) + @Parameter(description = "The connection id.", required = true) @PathParam("id") final String id) { if (isReplicateRequest()) { @@ -363,7 +348,7 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Checks the status of an outstanding listing request. * - * @param connectionId The id of the connection + * @param connectionId The id of the connection * @param listingRequestId The id of the drop request * @return A dropRequestEntity */ @@ -371,30 +356,30 @@ public class FlowFileQueueResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/listing-requests/{listing-request-id}") - @ApiOperation( - value = "Gets the current status of a listing request for the specified connection.", - response = ListingRequestEntity.class, - authorizations = { - @Authorization(value = "Read Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets the current status of a listing request for the specified connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getListingRequest( - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String connectionId, - @ApiParam( - value = "The listing request id.", + @Parameter( + description = "The listing request id.", required = true ) @PathParam("listing-request-id") final String listingRequestId) { @@ -424,40 +409,38 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Deletes the specified listing request. * - * @param httpServletRequest request - * @param connectionId The connection id - * @param listingRequestId The drop request id + * @param connectionId The connection id + * @param listingRequestId The drop request id * @return A dropRequestEntity */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/listing-requests/{listing-request-id}") - @ApiOperation( - value = "Cancels and/or removes a request to list the contents of this connection.", - response = ListingRequestEntity.class, - authorizations = { - @Authorization(value = "Read Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Cancels and/or removes a request to list the contents of this connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteListingRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String connectionId, - @ApiParam( - value = "The listing request id.", + @Parameter( + description = "The listing request id.", required = true ) @PathParam("listing-request-id") final String listingRequestId) { @@ -515,35 +498,33 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Creates a request to delete the flowfiles in the queue of the specified connection. * - * @param httpServletRequest request - * @param id The id of the connection + * @param id The id of the connection * @return A dropRequestEntity */ @POST @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/drop-requests") - @ApiOperation( - value = "Creates a request to drop the contents of the queue in this connection.", - response = DropRequestEntity.class, - authorizations = { - @Authorization(value = "Write Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Creates a request to drop the contents of the queue in this connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), + security = { + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 202, message = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled."), - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "202", description = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled."), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createDropRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String id) { @@ -586,7 +567,7 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Checks the status of an outstanding drop request. * - * @param connectionId The id of the connection + * @param connectionId The id of the connection * @param dropRequestId The id of the drop request * @return A dropRequestEntity */ @@ -594,30 +575,30 @@ public class FlowFileQueueResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/drop-requests/{drop-request-id}") - @ApiOperation( - value = "Gets the current status of a drop request for the specified connection.", - response = DropRequestEntity.class, - authorizations = { - @Authorization(value = "Write Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets the current status of a drop request for the specified connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), + security = { + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getDropRequest( - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String connectionId, - @ApiParam( - value = "The drop request id.", + @Parameter( + description = "The drop request id.", required = true ) @PathParam("drop-request-id") final String dropRequestId) { @@ -647,40 +628,38 @@ public class FlowFileQueueResource extends ApplicationResource { /** * Deletes the specified drop request. * - * @param httpServletRequest request - * @param connectionId The connection id - * @param dropRequestId The drop request id + * @param connectionId The connection id + * @param dropRequestId The drop request id * @return A dropRequestEntity */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/drop-requests/{drop-request-id}") - @ApiOperation( - value = "Cancels and/or removes a request to drop the contents of this connection.", - response = DropRequestEntity.class, - authorizations = { - @Authorization(value = "Write Source Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Cancels and/or removes a request to drop the contents of this connection.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), + security = { + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeDropRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") final String connectionId, - @ApiParam( - value = "The drop request id.", + @Parameter( + description = "The drop request id.", required = true ) @PathParam("drop-request-id") final String dropRequestId) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java index 6ded4a5ecc..0b9402a678 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java @@ -18,14 +18,14 @@ package org.apache.nifi.web.api; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.exporter.common.TextFormat; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.authorization.Authorizer; import org.apache.nifi.authorization.RequestAction; @@ -129,7 +129,6 @@ import org.apache.nifi.web.api.request.FlowMetricsRegistry; import org.apache.nifi.web.api.request.IntegerParameter; import org.apache.nifi.web.api.request.LongParameter; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.GET; @@ -140,11 +139,11 @@ import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.StreamingOutput; + import java.text.Collator; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -171,16 +170,9 @@ import static org.apache.nifi.web.api.entity.ScheduleComponentsEntity.STATE_ENAB * RESTful endpoint for managing a Flow. */ @Path("/flow") -@Api( - value = "/flow", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for accessing the flow structure and component status.") -}) +@Tag(name = "Flow") public class FlowResource extends ApplicationResource { - private static final String NIFI_REGISTRY_TYPE = "org.apache.nifi.registry.flow.NifiRegistryFlowRegistryClient"; private static final String RECURSIVE = "false"; private static final String VERSIONED_REPORTING_TASK_SNAPSHOT_FILENAME_PATTERN = "VersionedReportingTaskSnapshot-%s.json"; @@ -262,19 +254,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("client-id") - @ApiOperation( - value = "Generates a client id.", - response = String.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Generates a client id.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response generateClientId() { @@ -291,19 +283,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("config") - @ApiOperation( - value = "Retrieves the configuration for this NiFi flow", - response = FlowConfigurationEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the configuration for this NiFi flow", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowConfigurationEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowConfig() { @@ -327,11 +319,11 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("current-user") - @ApiOperation( - value = "Retrieves the user identity of the user making the request", - response = CurrentUserEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the user identity of the user making the request", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CurrentUserEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getCurrentUser() { @@ -365,27 +357,28 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}") - @ApiOperation( - value = "Gets a process group", - response = ProcessGroupFlowEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupFlowEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") }, - notes = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As such, " + - "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." + description = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As " + + "such, " + + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlow( - @ApiParam( - value = "The process group id." + @Parameter( + description = "The process group id." ) @PathParam("id") final String groupId, @QueryParam("uiOnly") @DefaultValue("false") final boolean uiOnly) { @@ -406,26 +399,24 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}/breadcrumbs") - @ApiOperation( - value = "Gets the breadcrumbs for a process group", - response = FlowBreadcrumbEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets the breadcrumbs for a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowBreadcrumbEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getBreadcrumbs( - @ApiParam( - value = "The process group id." - ) + @Parameter(description = "The process group id.") @PathParam("id") final String groupId) { authorizeFlow(); @@ -448,44 +439,42 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("metrics/{producer}") - @ApiOperation( - value = "Gets all metrics for the flow from a particular node", - response = StreamingOutput.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets all metrics for the flow from a particular node", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowMetrics( - @ApiParam( - value = "The producer for flow file metrics. Each producer may have its own output format.", - required = true, - allowableValues = "prometheus" + @Parameter( + description = "The producer for flow file metrics. Each producer may have its own output format.", + required = true ) @PathParam("producer") final String producer, - @ApiParam( - value = "Set of included metrics registries", - allowableValues = "NIFI,JVM,BULLETIN,CONNECTION" + @Parameter( + description = "Set of included metrics registries" ) @QueryParam("includedRegistries") final Set includedRegistries, - @ApiParam( - value = "Regular Expression Pattern to be applied against the sample name field" + @Parameter( + description = "Regular Expression Pattern to be applied against the sample name field" ) @QueryParam("sampleName") final String sampleName, - @ApiParam( - value = "Regular Expression Pattern to be applied against the sample label value field" + @Parameter( + description = "Regular Expression Pattern to be applied against the sample label value field" ) @QueryParam("sampleLabelValue") final String sampleLabelValue, - @ApiParam( - value = "Name of the first field of JSON object. Applicable for JSON producer only." + @Parameter( + description = "Name of the first field of JSON object. Applicable for JSON producer only." ) @QueryParam("rootFieldName") final String rootFieldName ) { @@ -529,26 +518,27 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("controller/controller-services") - @ApiOperation( - value = "Gets controller services for reporting tasks", - response = ControllerServicesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets controller services for reporting tasks", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServicesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") }, - notes = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As such, " + - "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." + description = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As " + + "such, " + + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerServicesFromController(@QueryParam("uiOnly") @DefaultValue("false") final boolean uiOnly, @QueryParam("includeReferencingComponents") @DefaultValue("true") - @ApiParam("Whether or not to include services' referencing components in the response") boolean includeReferences) { + @Parameter(description = "Whether or not to include services' referencing components in the response") boolean includeReferences) { authorizeFlow(); @@ -582,29 +572,38 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}/controller-services") - @ApiOperation( - value = "Gets all controller services", - response = ControllerServicesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets all controller services", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServicesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") }, - notes = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As such, " + - "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." + description = "If the uiOnly query parameter is provided with a value of true, the returned entity may only contain fields that are necessary for rendering the NiFi User Interface. As " + + "such, " + + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerServicesFromGroup( - @ApiParam(value = "The process group id.", required = true) @PathParam("id") String groupId, - @ApiParam("Whether or not to include parent/ancestor process groups") @QueryParam("includeAncestorGroups") @DefaultValue("true") boolean includeAncestorGroups, - @ApiParam("Whether or not to include descendant process groups") @QueryParam("includeDescendantGroups") @DefaultValue("false") boolean includeDescendantGroups, - @ApiParam("Whether or not to include services' referencing components in the response") @QueryParam("includeReferencingComponents") @DefaultValue("true") boolean includeReferences, - @QueryParam("uiOnly") @DefaultValue("false") final boolean uiOnly) { + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "Whether or not to include parent/ancestor process groups") + @QueryParam("includeAncestorGroups") + @DefaultValue("true") final boolean includeAncestorGroups, + @Parameter(description = "Whether or not to include descendant process groups") + @QueryParam("includeDescendantGroups") + @DefaultValue("false") final boolean includeDescendantGroups, + @Parameter(description = "Whether or not to include services' referencing components in the response") + @QueryParam("includeReferencingComponents") + @DefaultValue("true") final boolean includeReferences, + @QueryParam("uiOnly") + @DefaultValue("false") final boolean uiOnly) { authorizeFlow(); @@ -642,19 +641,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("parameter-providers") - @ApiOperation( - value = "Gets all parameter providers", - response = ParameterProvidersEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets all parameter providers", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProvidersEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getParameterProviders() { @@ -690,19 +689,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("reporting-tasks") - @ApiOperation( - value = "Gets all reporting tasks", - response = ReportingTasksEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets all reporting tasks", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTasksEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getReportingTasks() { @@ -733,22 +732,22 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("reporting-tasks/snapshot") - @ApiOperation( - value = "Get a snapshot of the given reporting tasks and any controller services they use", - response = VersionedReportingTaskSnapshot.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Get a snapshot of the given reporting tasks and any controller services they use", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedReportingTaskSnapshot.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getReportingTaskSnapshot( - @ApiParam(value = "Specifies a reporting task id to export. If not specified, all reporting tasks will be exported.") + @Parameter(description = "Specifies a reporting task id to export. If not specified, all reporting tasks will be exported.") @QueryParam("reportingTaskId") final String reportingTaskId ) { @@ -772,22 +771,22 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("reporting-tasks/download") - @ApiOperation( - value = "Download a snapshot of the given reporting tasks and any controller services they use", - response = byte[].class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Download a snapshot of the given reporting tasks and any controller services they use", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response downloadReportingTaskSnapshot( - @ApiParam(value = "Specifies a reporting task id to export. If not specified, all reporting tasks will be exported.") + @Parameter(description = "Specifies a reporting task id to export. If not specified, all reporting tasks will be exported.") @QueryParam("reportingTaskId") final String reportingTaskId ) { @@ -809,8 +808,7 @@ public class FlowResource extends ApplicationResource { /** * Updates the specified process group. * - * @param httpServletRequest request - * @param id The id of the process group. + * @param id The id of the process group. * @param requestScheduleComponentsEntity A scheduleComponentsEntity. * @return A processGroupEntity. */ @@ -818,32 +816,31 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}") - @ApiOperation( - value = "Schedule or unschedule components in the specified Process Group.", - response = ScheduleComponentsEntity.class, - authorizations = { - @Authorization(value = "Read - /flow"), - @Authorization(value = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every component being scheduled/unscheduled") + @Operation( + summary = "Schedule or unschedule components in the specified Process Group.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ScheduleComponentsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every component being scheduled/unscheduled") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response scheduleComponents( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", + @Parameter( + description = "The process group id.", required = true ) @PathParam("id") String id, - @ApiParam( - value = "The request to schedule or unschedule. If the comopnents in the request are not specified, all authorized components will be considered.", + @Parameter( + description = "The request to schedule or unschedule. If the comopnents in the request are not specified, all authorized components will be considered.", required = true ) final ScheduleComponentsEntity requestScheduleComponentsEntity) { @@ -916,35 +913,35 @@ public class FlowResource extends ApplicationResource { // Any group that is configured to run as stateless whose parent is not stateless we will attempt to schedule group.findAllProcessGroups().stream() - .filter(child -> child.getExecutionEngine() == ExecutionEngine.STATELESS) - .filter(child -> child.getParent() == null || child.getParent().resolveExecutionEngine() == ExecutionEngine.STANDARD) - .filter(child -> OperationAuthorizable.isOperationAuthorized(child, authorizer, NiFiUserUtils.getNiFiUser())) - .forEach(child -> { - componentIds.add(child.getIdentifier()); - statelessGroupIdsToSchedule.add(child.getIdentifier()); - child.findAllProcessGroups().forEach(descendent -> statelessGroupIdsToSchedule.add(descendent.getIdentifier())); - }); + .filter(child -> child.getExecutionEngine() == ExecutionEngine.STATELESS) + .filter(child -> child.getParent() == null || child.getParent().resolveExecutionEngine() == ExecutionEngine.STANDARD) + .filter(child -> OperationAuthorizable.isOperationAuthorized(child, authorizer, NiFiUserUtils.getNiFiUser())) + .forEach(child -> { + componentIds.add(child.getIdentifier()); + statelessGroupIdsToSchedule.add(child.getIdentifier()); + child.findAllProcessGroups().forEach(descendent -> statelessGroupIdsToSchedule.add(descendent.getIdentifier())); + }); // ensure authorized for each processor we will attempt to schedule group.findAllProcessors().stream() - .filter(getProcessorFilter.get()) - .filter(processor -> !statelessGroupIdsToSchedule.contains(processor.getProcessGroupIdentifier())) - .filter(processor -> OperationAuthorizable.isOperationAuthorized(processor, authorizer, NiFiUserUtils.getNiFiUser())) - .forEach(processor -> componentIds.add(processor.getIdentifier())); + .filter(getProcessorFilter.get()) + .filter(processor -> !statelessGroupIdsToSchedule.contains(processor.getProcessGroupIdentifier())) + .filter(processor -> OperationAuthorizable.isOperationAuthorized(processor, authorizer, NiFiUserUtils.getNiFiUser())) + .forEach(processor -> componentIds.add(processor.getIdentifier())); // ensure authorized for each input port we will attempt to schedule group.findAllInputPorts().stream() - .filter(getPortFilter.get()) - .filter(processor -> !statelessGroupIdsToSchedule.contains(processor.getProcessGroupIdentifier())) - .filter(inputPort -> OperationAuthorizable.isOperationAuthorized(inputPort, authorizer, NiFiUserUtils.getNiFiUser())) - .forEach(inputPort -> componentIds.add(inputPort.getIdentifier())); + .filter(getPortFilter.get()) + .filter(processor -> !statelessGroupIdsToSchedule.contains(processor.getProcessGroupIdentifier())) + .filter(inputPort -> OperationAuthorizable.isOperationAuthorized(inputPort, authorizer, NiFiUserUtils.getNiFiUser())) + .forEach(inputPort -> componentIds.add(inputPort.getIdentifier())); // ensure authorized for each output port we will attempt to schedule group.findAllOutputPorts().stream() - .filter(getPortFilter.get()) - .filter(processor -> !statelessGroupIdsToSchedule.contains(processor.getProcessGroupIdentifier())) - .filter(outputPort -> OperationAuthorizable.isOperationAuthorized(outputPort, authorizer, NiFiUserUtils.getNiFiUser())) - .forEach(outputPort -> componentIds.add(outputPort.getIdentifier())); + .filter(getPortFilter.get()) + .filter(processor -> !statelessGroupIdsToSchedule.contains(processor.getProcessGroupIdentifier())) + .filter(outputPort -> OperationAuthorizable.isOperationAuthorized(outputPort, authorizer, NiFiUserUtils.getNiFiUser())) + .forEach(outputPort -> componentIds.add(outputPort.getIdentifier())); return componentIds; }); @@ -1025,26 +1022,27 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}/controller-services") - @ApiOperation(value = "Enable or disable Controller Services in the specified Process Group.", - response = ActivateControllerServicesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow"), - @Authorization(value = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every service being enabled/disabled") - }) + @Operation( + summary = "Enable or disable Controller Services in the specified Process Group.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ActivateControllerServicesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every service being enabled/disabled") + } + ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response activateControllerServices( - @Context HttpServletRequest httpServletRequest, - @ApiParam(value = "The process group id.", required = true) + @Parameter(description = "The process group id.", required = true) @PathParam("id") String id, - @ApiParam(value = "The request to schedule or unschedule. If the comopnents in the request are not specified, all authorized components will be considered.", required = true) + @Parameter(description = "The request to schedule or unschedule. If the comopnents in the request are not specified, all authorized components will be considered.", required = true) final ActivateControllerServicesEntity requestEntity) { if (requestEntity == null) { @@ -1054,7 +1052,7 @@ public class FlowResource extends ApplicationResource { // ensure the same id is being used if (!id.equals(requestEntity.getId())) { throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does " - + "not equal the process group id of the requested resource (%s).", requestEntity.getId(), id)); + + "not equal the process group id of the requested resource (%s).", requestEntity.getId(), id)); } final ControllerServiceState desiredState; @@ -1065,14 +1063,14 @@ public class FlowResource extends ApplicationResource { desiredState = ControllerServiceState.valueOf(requestEntity.getState()); } catch (final IllegalArgumentException iae) { throw new IllegalArgumentException(String.format("The controller service state must be one of [%s].", - StringUtils.join(EnumSet.of(ControllerServiceState.ENABLED, ControllerServiceState.DISABLED), ", "))); + StringUtils.join(EnumSet.of(ControllerServiceState.ENABLED, ControllerServiceState.DISABLED), ", "))); } } // ensure its a supported scheduled state if (ControllerServiceState.DISABLING.equals(desiredState) || ControllerServiceState.ENABLING.equals(desiredState)) { throw new IllegalArgumentException(String.format("The scheduled must be one of [%s].", - StringUtils.join(EnumSet.of(ControllerServiceState.ENABLED, ControllerServiceState.DISABLED), ", "))); + StringUtils.join(EnumSet.of(ControllerServiceState.ENABLED, ControllerServiceState.DISABLED), ", "))); } // if the components are not specified, gather all components and their current revision @@ -1089,10 +1087,10 @@ public class FlowResource extends ApplicationResource { } group.findAllControllerServices().stream() - .filter(filter) - .filter(service -> service.getProcessGroup().resolveExecutionEngine() == ExecutionEngine.STANDARD) - .filter(service -> OperationAuthorizable.isOperationAuthorized(service, authorizer, NiFiUserUtils.getNiFiUser())) - .forEach(service -> componentIds.add(service.getIdentifier())); + .filter(filter) + .filter(service -> service.getProcessGroup().resolveExecutionEngine() == ExecutionEngine.STANDARD) + .filter(service -> OperationAuthorizable.isOperationAuthorized(service, authorizer, NiFiUserUtils.getNiFiUser())) + .forEach(service -> componentIds.add(service.getIdentifier())); return componentIds; }); @@ -1163,20 +1161,20 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("search-results") - @ApiOperation( - value = "Performs a search against this NiFi using the specified search term", - notes = "Only search results from authorized components will be returned.", - response = SearchResultsEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Performs a search against this NiFi using the specified search term", + description = "Only search results from authorized components will be returned.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SearchResultsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response searchFlow( @@ -1206,19 +1204,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("status") - @ApiOperation( - value = "Gets the current status of this NiFi", - response = ControllerStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets the current status of this NiFi", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerStatus() throws InterruptedException { @@ -1248,19 +1246,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("cluster/summary") - @ApiOperation( - value = "The cluster summary for this NiFi", - response = ClusterSummaryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "The cluster summary for this NiFi", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ClusterSummaryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getClusterSummary() { @@ -1304,23 +1302,23 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("controller/bulletins") - @ApiOperation( - value = "Retrieves Controller level bulletins", - response = ControllerBulletinsEntity.class, - authorizations = { - @Authorization(value = "Read - /flow"), - @Authorization(value = "Read - /controller - For controller bulletins"), - @Authorization(value = "Read - /controller-services/{uuid} - For controller service bulletins"), - @Authorization(value = "Read - /reporting-tasks/{uuid} - For reporting task bulletins") + @Operation( + summary = "Retrieves Controller level bulletins", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerBulletinsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Read - /controller - For controller bulletins"), + @SecurityRequirement(name = "Read - /controller-services/{uuid} - For controller service bulletins"), + @SecurityRequirement(name = "Read - /reporting-tasks/{uuid} - For reporting task bulletins") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getBulletins() { @@ -1344,19 +1342,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("banners") - @ApiOperation( - value = "Retrieves the banners for this NiFi", - response = BannerEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the banners for this NiFi", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BannerEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getBanners() { @@ -1389,33 +1387,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("processor-types") - @ApiOperation( - value = "Retrieves the types of processors that this NiFi supports", - notes = NON_GUARANTEED_ENDPOINT, - response = ProcessorTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of processors that this NiFi supports", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProcessorTypes( - @ApiParam( - value = "If specified, will only return types that are a member of this bundle group." + @Parameter( + description = "If specified, will only return types that are a member of this bundle group." ) @QueryParam("bundleGroupFilter") String bundleGroupFilter, - @ApiParam( - value = "If specified, will only return types that are a member of this bundle artifact." + @Parameter( + description = "If specified, will only return types that are a member of this bundle artifact." ) @QueryParam("bundleArtifactFilter") String bundleArtifactFilter, - @ApiParam( - value = "If specified, will only return types whose fully qualified classname matches." + @Parameter( + description = "If specified, will only return types whose fully qualified classname matches." ) @QueryParam("type") String typeFilter) throws InterruptedException { @@ -1444,49 +1442,49 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("controller-service-types") - @ApiOperation( - value = "Retrieves the types of controller services that this NiFi supports", - notes = NON_GUARANTEED_ENDPOINT, - response = ControllerServiceTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of controller services that this NiFi supports", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getControllerServiceTypes( - @ApiParam( - value = "If specified, will only return controller services that are compatible with this type of service." + @Parameter( + description = "If specified, will only return controller services that are compatible with this type of service." ) @QueryParam("serviceType") String serviceType, - @ApiParam( - value = "If serviceType specified, is the bundle group of the serviceType." + @Parameter( + description = "If serviceType specified, is the bundle group of the serviceType." ) @QueryParam("serviceBundleGroup") String serviceBundleGroup, - @ApiParam( - value = "If serviceType specified, is the bundle artifact of the serviceType." + @Parameter( + description = "If serviceType specified, is the bundle artifact of the serviceType." ) @QueryParam("serviceBundleArtifact") String serviceBundleArtifact, - @ApiParam( - value = "If serviceType specified, is the bundle version of the serviceType." + @Parameter( + description = "If serviceType specified, is the bundle version of the serviceType." ) @QueryParam("serviceBundleVersion") String serviceBundleVersion, - @ApiParam( - value = "If specified, will only return types that are a member of this bundle group." + @Parameter( + description = "If specified, will only return types that are a member of this bundle group." ) @QueryParam("bundleGroupFilter") String bundleGroupFilter, - @ApiParam( - value = "If specified, will only return types that are a member of this bundle artifact." + @Parameter( + description = "If specified, will only return types that are a member of this bundle artifact." ) @QueryParam("bundleArtifactFilter") String bundleArtifactFilter, - @ApiParam( - value = "If specified, will only return types whose fully qualified classname matches." + @Parameter( + description = "If specified, will only return types whose fully qualified classname matches." ) @QueryParam("typeFilter") String typeFilter) throws InterruptedException { @@ -1521,33 +1519,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("reporting-task-types") - @ApiOperation( - value = "Retrieves the types of reporting tasks that this NiFi supports", - notes = NON_GUARANTEED_ENDPOINT, - response = ReportingTaskTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of reporting tasks that this NiFi supports", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getReportingTaskTypes( - @ApiParam( - value = "If specified, will only return types that are a member of this bundle group." + @Parameter( + description = "If specified, will only return types that are a member of this bundle group." ) @QueryParam("bundleGroupFilter") String bundleGroupFilter, - @ApiParam( - value = "If specified, will only return types that are a member of this bundle artifact." + @Parameter( + description = "If specified, will only return types that are a member of this bundle artifact." ) @QueryParam("bundleArtifactFilter") String bundleArtifactFilter, - @ApiParam( - value = "If specified, will only return types whose fully qualified classname matches." + @Parameter( + description = "If specified, will only return types whose fully qualified classname matches." ) @QueryParam("type") String typeFilter) throws InterruptedException { @@ -1569,20 +1567,20 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("runtime-manifest") - @ApiOperation( - value = "Retrieves the runtime manifest for this NiFi instance.", - notes = NON_GUARANTEED_ENDPOINT, - response = RuntimeManifestEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the runtime manifest for this NiFi instance.", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RuntimeManifestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getRuntimeManifest() throws InterruptedException { @@ -1611,36 +1609,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("parameter-provider-types") - @ApiOperation( - value = "Retrieves the types of parameter providers that this NiFi supports", - notes = NON_GUARANTEED_ENDPOINT, - response = ParameterProviderTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of parameter providers that this NiFi supports", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getParameterProviderTypes( - @ApiParam( - value = "If specified, will only return types that are a member of this bundle group.", - required = false + @Parameter( + description = "If specified, will only return types that are a member of this bundle group." ) @QueryParam("bundleGroupFilter") String bundleGroupFilter, - @ApiParam( - value = "If specified, will only return types that are a member of this bundle artifact.", - required = false + @Parameter( + description = "If specified, will only return types that are a member of this bundle artifact." ) @QueryParam("bundleArtifactFilter") String bundleArtifactFilter, - @ApiParam( - value = "If specified, will only return types whose fully qualified classname matches.", - required = false + @Parameter( + description = "If specified, will only return types whose fully qualified classname matches." ) @QueryParam("type") String typeFilter) throws InterruptedException { @@ -1668,36 +1663,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis-rule-types") - @ApiOperation( - value = "Retrieves the types of available Flow Analysis Rules", - notes = NON_GUARANTEED_ENDPOINT, - response = FlowAnalysisRuleTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of available Flow Analysis Rules", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFlowAnalysisRuleTypes( - @ApiParam( - value = "If specified, will only return types that are a member of this bundle group.", - required = false + @Parameter( + description = "If specified, will only return types that are a member of this bundle group." ) @QueryParam("bundleGroupFilter") String bundleGroupFilter, - @ApiParam( - value = "If specified, will only return types that are a member of this bundle artifact.", - required = false + @Parameter( + description = "If specified, will only return types that are a member of this bundle artifact." ) @QueryParam("bundleArtifactFilter") String bundleArtifactFilter, - @ApiParam( - value = "If specified, will only return types whose fully qualified classname matches.", - required = false + @Parameter( + description = "If specified, will only return types whose fully qualified classname matches." ) @QueryParam("type") String typeFilter) throws InterruptedException { @@ -1725,20 +1717,20 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("prioritizers") - @ApiOperation( - value = "Retrieves the types of prioritizers that this NiFi supports", - notes = NON_GUARANTEED_ENDPOINT, - response = PrioritizerTypesEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves the types of prioritizers that this NiFi supports", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PrioritizerTypesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPrioritizers() throws InterruptedException { @@ -1765,19 +1757,19 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("about") - @ApiOperation( - value = "Retrieves details about this NiFi to put in the About dialog", - response = AboutEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Retrieves details about this NiFi to put in the About dialog", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AboutEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getAboutInfo() { @@ -1823,16 +1815,22 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registries") - @ApiOperation(value = "Gets the listing of available flow registry clients", response = FlowRegistryClientsEntity.class, authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Gets the listing of available flow registry clients", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getRegistryClients() { authorizeFlow(); @@ -1871,19 +1869,25 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registries/{id}/buckets") - @ApiOperation(value = "Gets the buckets from the specified registry for the current user", response = FlowRegistryBucketsEntity.class, authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Gets the buckets from the specified registry for the current user", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryBucketsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getBuckets( - @ApiParam( - value = "The registry id.", + @Parameter( + description = "The registry id.", required = true ) @PathParam("id") String id) throws NiFiRegistryException { @@ -1914,24 +1918,30 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registries/{registry-id}/buckets/{bucket-id}/flows") - @ApiOperation(value = "Gets the flows from the specified registry and bucket for the current user", response = VersionedFlowsEntity.class, authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Gets the flows from the specified registry and bucket for the current user", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getFlows( - @ApiParam( - value = "The registry client id.", - required = true + @Parameter( + description = "The registry client id.", + required = true ) @PathParam("registry-id") String registryId, - @ApiParam( - value = "The bucket id.", + @Parameter( + description = "The bucket id.", required = true ) @PathParam("bucket-id") String bucketId) { @@ -1962,31 +1972,35 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registries/{registry-id}/buckets/{bucket-id}/flows/{flow-id}/details") - @ApiOperation(value = "Gets the details of a flow from the specified registry and bucket for the specified flow for the current user", - response = VersionedFlowEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Gets the details of a flow from the specified registry and bucket for the specified flow for the current user", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getDetails( - @ApiParam( - value = "The registry client id.", + @Parameter( + description = "The registry client id.", required = true ) @PathParam("registry-id") String registryId, - @ApiParam( - value = "The bucket id.", + @Parameter( + description = "The bucket id.", required = true ) @PathParam("bucket-id") String bucketId, - @ApiParam( - value = "The flow id.", + @Parameter( + description = "The flow id.", required = true ) @PathParam("flow-id") String flowId) { @@ -2001,31 +2015,35 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("registries/{registry-id}/buckets/{bucket-id}/flows/{flow-id}/versions") - @ApiOperation(value = "Gets the flow versions from the specified registry and bucket for the specified flow for the current user", - response = VersionedFlowSnapshotMetadataSetEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Gets the flow versions from the specified registry and bucket for the specified flow for the current user", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadataSetEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getVersions( - @ApiParam( - value = "The registry client id.", + @Parameter( + description = "The registry client id.", required = true ) @PathParam("registry-id") String registryId, - @ApiParam( - value = "The bucket id.", + @Parameter( + description = "The bucket id.", required = true ) @PathParam("bucket-id") String bucketId, - @ApiParam( - value = "The flow id.", + @Parameter( + description = "The flow id.", required = true ) @PathParam("flow-id") String flowId) { @@ -2047,13 +2065,13 @@ public class FlowResource extends ApplicationResource { /** * Retrieves all the of bulletins in this NiFi. * - * @param after Supporting querying for bulletins after a particular - * bulletin id. - * @param limit The max number of bulletins to return. + * @param after Supporting querying for bulletins after a particular + * bulletin id. + * @param limit The max number of bulletins to return. * @param sourceName Source name filter. Supports a regular expression. - * @param message Message filter. Supports a regular expression. - * @param sourceId Source id filter. Supports a regular expression. - * @param groupId Group id filter. Supports a regular expression. + * @param message Message filter. Supports a regular expression. + * @param sourceId Source id filter. Supports a regular expression. + * @param groupId Group id filter. Supports a regular expression. * @return A bulletinBoardEntity. * @throws InterruptedException if interrupted */ @@ -2061,45 +2079,45 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("bulletin-board") - @ApiOperation( - value = "Gets current bulletins", - response = BulletinBoardEntity.class, - authorizations = { - @Authorization(value = "Read - /flow"), - @Authorization(value = "Read - /{component-type}/{uuid} - For component specific bulletins") + @Operation( + summary = "Gets current bulletins", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BulletinBoardEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For component specific bulletins") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getBulletinBoard( - @ApiParam( - value = "Includes bulletins with an id after this value." + @Parameter( + description = "Includes bulletins with an id after this value." ) @QueryParam("after") LongParameter after, - @ApiParam( - value = "Includes bulletins originating from this sources whose name match this regular expression." + @Parameter( + description = "Includes bulletins originating from this sources whose name match this regular expression." ) @QueryParam("sourceName") BulletinBoardPatternParameter sourceName, - @ApiParam( - value = "Includes bulletins whose message that match this regular expression." + @Parameter( + description = "Includes bulletins whose message that match this regular expression." ) @QueryParam("message") BulletinBoardPatternParameter message, - @ApiParam( - value = "Includes bulletins originating from this sources whose id match this regular expression." + @Parameter( + description = "Includes bulletins originating from this sources whose id match this regular expression." ) @QueryParam("sourceId") BulletinBoardPatternParameter sourceId, - @ApiParam( - value = "Includes bulletins originating from this sources whose group id match this regular expression." + @Parameter( + description = "Includes bulletins originating from this sources whose group id match this regular expression." ) @QueryParam("groupId") BulletinBoardPatternParameter groupId, - @ApiParam( - value = "The number of bulletins to limit the response to." + @Parameter( + description = "The number of bulletins to limit the response to." ) @QueryParam("limit") IntegerParameter limit) throws InterruptedException { @@ -2158,33 +2176,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("processors/{id}/status") - @ApiOperation( - value = "Gets status for a processor", - response = ProcessorStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status for a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProcessorStatus( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status." + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2229,33 +2247,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("input-ports/{id}/status") - @ApiOperation( - value = "Gets status for an input port", - response = PortStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status for an input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getInputPortStatus( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status." + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The input port id.", + @Parameter( + description = "The input port id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2300,33 +2318,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("output-ports/{id}/status") - @ApiOperation( - value = "Gets status for an output port", - response = PortStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status for an output port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getOutputPortStatus( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status." + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The output port id.", + @Parameter( + description = "The output port id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2371,33 +2389,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("remote-process-groups/{id}/status") - @ApiOperation( - value = "Gets status for a remote process group", - response = RemoteProcessGroupStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status for a remote process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getRemoteProcessGroupStatus( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status." + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The remote process group id." + @Parameter( + description = "The remote process group id." ) @PathParam("id") String id) throws InterruptedException { @@ -2434,7 +2452,7 @@ public class FlowResource extends ApplicationResource { * Retrieves the status report for this NiFi. * * @param recursive Optional recursive flag that defaults to false. If set to true, all descendant groups and the status of their content will be included. - * @param groupId The group id + * @param groupId The group id * @return A processGroupStatusEntity. * @throws InterruptedException if interrupted */ @@ -2442,39 +2460,39 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}/status") - @ApiOperation( - value = "Gets the status for a process group", - notes = "The status for a process group includes status for all descendent components. When invoked on the root group with " + @Operation( + summary = "Gets the status for a process group", + description = "The status for a process group includes status for all descendent components. When invoked on the root group with " + "recursive set to true, it will return the current status of every component in the flow.", - response = ProcessGroupStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProcessGroupStatus( - @ApiParam( - value = "Whether all descendant groups and the status of their content will be included. Optional, defaults to false" + @Parameter( + description = "Whether all descendant groups and the status of their content will be included. Optional, defaults to false" ) @QueryParam("recursive") @DefaultValue(RECURSIVE) Boolean recursive, - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status." + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The process group id.", + @Parameter( + description = "The process group id.", required = true ) @PathParam("id") String groupId) throws InterruptedException { @@ -2519,33 +2537,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("connections/{id}/status") - @ApiOperation( - value = "Gets status for a connection", - response = ConnectionStatusEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status for a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionStatusEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getConnectionStatus( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the status." + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2590,33 +2608,33 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("connections/{id}/statistics") - @ApiOperation( - value = "Gets statistics for a connection", - response = ConnectionStatisticsEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets statistics for a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionStatisticsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getConnectionStatistics( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false" + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) Boolean nodewise, - @ApiParam( - value = "The id of the node where to get the statistics." + @Parameter( + description = "The id of the node where to get the statistics." ) @QueryParam("clusterNodeId") String clusterNodeId, - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2665,25 +2683,25 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("processors/{id}/status/history") - @ApiOperation( - value = "Gets status history for a processor", - response = StatusHistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status history for a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProcessorStatusHistory( - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2711,25 +2729,25 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("process-groups/{id}/status/history") - @ApiOperation( - value = "Gets status history for a remote process group", - response = StatusHistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets status history for a remote process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProcessGroupStatusHistory( - @ApiParam( - value = "The process group id.", + @Parameter( + description = "The process group id.", required = true ) @PathParam("id") String groupId) throws InterruptedException { @@ -2757,25 +2775,25 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("remote-process-groups/{id}/status/history") - @ApiOperation( - value = "Gets the status history", - response = StatusHistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets the status history", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getRemoteProcessGroupStatusHistory( - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2803,25 +2821,25 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("connections/{id}/status/history") - @ApiOperation( - value = "Gets the status history for a connection", - response = StatusHistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets the status history for a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getConnectionStatusHistory( - @ApiParam( - value = "The connection id.", + @Parameter( + description = "The connection id.", required = true ) @PathParam("id") String id) throws InterruptedException { @@ -2843,20 +2861,20 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("parameter-contexts") - @ApiOperation( - value = "Gets all Parameter Contexts", - response = ParameterContextsEntity.class, - authorizations = { - @Authorization(value = "Read - /parameter-contexts/{id} for each Parameter Context") - } + @Operation( + summary = "Gets all Parameter Contexts", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id} for each Parameter Context") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response getParameterContexts() { authorizeFlow(); @@ -2877,7 +2895,6 @@ public class FlowResource extends ApplicationResource { } - // ------- // history // ------- @@ -2885,81 +2902,81 @@ public class FlowResource extends ApplicationResource { /** * Queries the history of this Controller. * - * @param offset The offset into the data. This parameter is required and is - * used in conjunction with count. - * @param count The number of rows that should be returned. This parameter - * is required and is used in conjunction with page. - * @param sortColumn The column to sort on. This parameter is optional. If - * not specified the results will be returned with the most recent first. - * @param sortOrder The sort order. - * @param startDate The start date/time for the query. The start date/time - * must be formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional - * and must be specified in the timezone of the server. The server's - * timezone can be determined by inspecting the result of a status or - * history request. - * @param endDate The end date/time for the query. The end date/time must be - * formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional and must - * be specified in the timezone of the server. The server's timezone can be - * determined by inspecting the result of a status or history request. + * @param offset The offset into the data. This parameter is required and is + * used in conjunction with count. + * @param count The number of rows that should be returned. This parameter + * is required and is used in conjunction with page. + * @param sortColumn The column to sort on. This parameter is optional. If + * not specified the results will be returned with the most recent first. + * @param sortOrder The sort order. + * @param startDate The start date/time for the query. The start date/time + * must be formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional + * and must be specified in the timezone of the server. The server's + * timezone can be determined by inspecting the result of a status or + * history request. + * @param endDate The end date/time for the query. The end date/time must be + * formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional and must + * be specified in the timezone of the server. The server's timezone can be + * determined by inspecting the result of a status or history request. * @param userIdentity The user name of the user who's actions are being - * queried. This parameter is optional. - * @param sourceId The id of the source being queried (usually a processor - * id). This parameter is optional. + * queried. This parameter is optional. + * @param sourceId The id of the source being queried (usually a processor + * id). This parameter is optional. * @return A historyEntity. */ @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("history") - @ApiOperation( - value = "Gets configuration history", - notes = NON_GUARANTEED_ENDPOINT, - response = HistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets configuration history", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = HistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response queryHistory( - @ApiParam( - value = "The offset into the result set.", + @Parameter( + description = "The offset into the result set.", required = true ) @QueryParam("offset") IntegerParameter offset, - @ApiParam( - value = "The number of actions to return.", + @Parameter( + description = "The number of actions to return.", required = true ) @QueryParam("count") IntegerParameter count, - @ApiParam( - value = "The field to sort on." + @Parameter( + description = "The field to sort on." ) @QueryParam("sortColumn") String sortColumn, - @ApiParam( - value = "The direction to sort." + @Parameter( + description = "The direction to sort." ) @QueryParam("sortOrder") String sortOrder, - @ApiParam( - value = "Include actions after this date." + @Parameter( + description = "Include actions after this date." ) @QueryParam("startDate") DateTimeParameter startDate, - @ApiParam( - value = "Include actions before this date." + @Parameter( + description = "Include actions before this date." ) @QueryParam("endDate") DateTimeParameter endDate, - @ApiParam( - value = "Include actions performed by this user." + @Parameter( + description = "Include actions performed by this user." ) @QueryParam("userIdentity") String userIdentity, - @ApiParam( - value = "Include actions on this component." + @Parameter( + description = "Include actions on this component." ) @QueryParam("sourceId") String sourceId) { @@ -3043,26 +3060,26 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("history/{id}") - @ApiOperation( - value = "Gets an action", - notes = NON_GUARANTEED_ENDPOINT, - response = ActionEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Gets an action", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ActionEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getAction( - @ApiParam( - value = "The action id.", + @Parameter( + description = "The action id.", required = true ) @PathParam("id") IntegerParameter id) { @@ -3093,27 +3110,27 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("history/components/{componentId}") - @ApiOperation( - value = "Gets configuration history for a component", - notes = NON_GUARANTEED_ENDPOINT, - response = ComponentHistoryEntity.class, - authorizations = { - @Authorization(value = "Read - /flow"), - @Authorization(value = "Read underlying component - /{component-type}/{uuid}") + @Operation( + summary = "Gets configuration history for a component", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentHistoryEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Read underlying component - /{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getComponentHistory( - @ApiParam( - value = "The component id.", + @Parameter( + description = "The component id.", required = true ) @PathParam("componentId") final String componentId) { @@ -3184,27 +3201,28 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis/results/{processGroupId}") - @ApiOperation( - value = "Returns flow analysis results produced by the analysis of a given process group", - response = FlowAnalysisResultEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns flow analysis results produced by the analysis of a given process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisResultEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getFlowAnalysisResults( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The id of the process group representing (a part of) the flow to be analyzed.", - required = true - ) - @PathParam("processGroupId") - final String processGroupId + @Parameter( + description = "The id of the process group representing (a part of) the flow to be analyzed.", + required = true + ) + @PathParam("processGroupId") final String processGroupId ) { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -3226,19 +3244,22 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("flow-analysis/results") - @ApiOperation( - value = "Returns all flow analysis results currently in effect", - response = FlowAnalysisResultEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns all flow analysis results currently in effect", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisResultEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getAllFlowAnalysisResults() { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -3265,26 +3286,26 @@ public class FlowResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("cluster/search-results") - @ApiOperation( - value = "Searches the cluster for a node with the specified address", - notes = NON_GUARANTEED_ENDPOINT, - response = ClusterSearchResultsEntity.class, - authorizations = { - @Authorization(value = "Read - /flow") + @Operation( + summary = "Searches the cluster for a node with the specified address", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ClusterSearchResultsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /flow") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response searchCluster( - @ApiParam( - value = "Node address to search for.", + @Parameter( + description = "Node address to search for.", required = true ) @QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowUpdateResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowUpdateResource.java index f404a49492..30460073d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowUpdateResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowUpdateResource.java @@ -67,6 +67,7 @@ import jakarta.ws.rs.HttpMethod; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response.Status; + import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -85,8 +86,8 @@ import java.util.stream.Collectors; /** * Parameterized abstract resource for use in updating flows. * - * @param Entity to use for describing a process group for update purposes - * @param Entity to capture the status and result of an update request + * @param Entity to use for describing a process group for update purposes + * @param Entity to capture the status and result of an update request */ public abstract class FlowUpdateResource extends ApplicationResource { private static final String DISABLED_COMPONENT_STATE = "DISABLED"; @@ -128,15 +129,15 @@ public abstract class FlowUpdateResource * This is used by both import-based flow updates and registry-based flow updates. * - * @param groupId the id of the process group to update - * @param requestEntity the entity containing the request, either versioning info or the flow contents - * @param allowDirtyFlowUpdate allow updating a flow with versioned changes present - * @param requestType the type of request ("replace-requests" or "update-requests") - * @param replicateUriPath the uri path to use for replicating the request (differs from initial request uri) - * @param flowSnapshotContainerSupplier provides access to the flow snapshot to be used for replacement + * @param groupId the id of the process group to update + * @param requestEntity the entity containing the request, either versioning info or the flow contents + * @param allowDirtyFlowUpdate allow updating a flow with versioned changes present + * @param requestType the type of request ("replace-requests" or "update-requests") + * @param replicateUriPath the uri path to use for replicating the request (differs from initial request uri) + * @param flowSnapshotContainerSupplier provides access to the flow snapshot to be used for replacement * @return response containing status of the async request */ protected Response initiateFlowUpdate(final String groupId, final T requestEntity, final boolean allowDirtyFlowUpdate, @@ -201,7 +202,7 @@ public abstract class FlowUpdateResource * This is used by import-based flow replacements, registry-based flow updates and registry-based flow reverts * - * @param user the user that submitted the update request - * @param groupId the id of the process group to update - * @param revision a revision object representing a unique request to update a specific process group - * @param wrapper wrapper object containing many variables needed for performing the flow update - * @param allowDirtyFlowUpdate allow updating a flow with versioned changes present + * @param user the user that submitted the update request + * @param groupId the id of the process group to update + * @param revision a revision object representing a unique request to update a specific process group + * @param wrapper wrapper object containing many variables needed for performing the flow update + * @param allowDirtyFlowUpdate allow updating a flow with versioned changes present * @return response containing status of the update flow request */ protected Response submitFlowUpdateRequest(final NiFiUser user, final String groupId, final Revision revision, @@ -351,19 +353,19 @@ public abstract class FlowUpdateResource servicesToWaitFor = affectedComponents.stream() - .filter(dto -> AffectedComponentDTO.COMPONENT_TYPE_CONTROLLER_SERVICE.equals(dto.getComponent().getReferenceType())) - .filter(dto -> { - final String state = dto.getComponent().getState(); - return "Enabled".equalsIgnoreCase(state) || "Enabling".equalsIgnoreCase(state) || "Disabling".equalsIgnoreCase(state); - }) - .collect(Collectors.toSet()); + .filter(dto -> AffectedComponentDTO.COMPONENT_TYPE_CONTROLLER_SERVICE.equals(dto.getComponent().getReferenceType())) + .filter(dto -> { + final String state = dto.getComponent().getState(); + return "Enabled".equalsIgnoreCase(state) || "Enabling".equalsIgnoreCase(state) || "Disabling".equalsIgnoreCase(state); + }) + .collect(Collectors.toSet()); final Set enabledServices = servicesToWaitFor.stream() - .filter(dto -> { - final String state = dto.getComponent().getState(); - return "Enabling".equalsIgnoreCase(state) || "Enabled".equalsIgnoreCase(state); - }) - .collect(Collectors.toSet()); + .filter(dto -> { + final String state = dto.getComponent().getState(); + return "Enabling".equalsIgnoreCase(state) || "Enabled".equalsIgnoreCase(state); + }) + .collect(Collectors.toSet()); logger.info("Disabling {} Controller Services", enabledServices.size()); final CancellableTimedPause disableServicesPause = new CancellableTimedPause(250, Long.MAX_VALUE, TimeUnit.MILLISECONDS); @@ -462,7 +464,7 @@ public abstract class FlowUpdateResource headers = new HashMap<>(); headers.put("content-type", MediaType.APPLICATION_JSON); @@ -585,7 +587,7 @@ public abstract class FlowUpdateResource * This is used by import-based flow replacements, registry-based flow updates and registry-based flow reverts * - * @param requestType the type of request ("replace-requests", "update-requests" or "revert-requests") - * @param requestId the unique identifier for the update request + * @param requestType the type of request ("replace-requests", "update-requests" or "revert-requests") + * @param requestId the unique identifier for the update request * @return response containing the requested flow update request */ protected Response retrieveFlowUpdateRequest(final String requestType, final String requestId) { @@ -670,11 +672,11 @@ public abstract class FlowUpdateResource * This is used by import-based flow replacements, registry-based flow updates and registry-based flow reverts * - * @param requestType the type of request ("replace-requests", "update-requests" or "revert-requests") - * @param requestId the unique identifier for the update request + * @param requestType the type of request ("replace-requests", "update-requests" or "revert-requests") + * @param requestId the unique identifier for the update request * @param disconnectedNodeAcknowledged acknowledges that this node is disconnected to allow for mutable requests to proceed * @return response containing the deleted flow update request */ @@ -703,14 +705,14 @@ public abstract class FlowUpdateResource asyncRequest, + final AsynchronousWebRequest asyncRequest, final boolean finalizeCompletedRequest) { final String groupId = asyncRequest.getComponentId(); @@ -738,7 +740,7 @@ public abstract class FlowUpdateResource * This avoids having to hardcode the value as an argument to an update flow request. */ protected String getRequestPathFirstSegment() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java index 10158f3591..731cfe742f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java @@ -16,16 +16,16 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Set; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -36,7 +36,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -56,13 +55,7 @@ import org.apache.nifi.web.api.request.LongParameter; * RESTful endpoint for managing a Funnel. */ @Path("/funnels") -@Api( - value = "/funnel", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Funnel.") -}) +@Tag(name = "Funnels") public class FunnelResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -102,25 +95,25 @@ public class FunnelResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a funnel", - response = FunnelEntity.class, - authorizations = { - @Authorization(value = "Read - /funnels/{uuid}") + @Operation( + summary = "Gets a funnel", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), + security = { + @SecurityRequirement(name = "Read - /funnels/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getFunnel( - @ApiParam( - value = "The funnel id.", + @Parameter( + description = "The funnel id.", required = true ) @PathParam("id") final String id) { @@ -145,40 +138,38 @@ public class FunnelResource extends ApplicationResource { /** * Creates a new Funnel. * - * @param httpServletRequest request - * @param id The id of the funnel to update. - * @param requestFunnelEntity A funnelEntity. + * @param id The id of the funnel to update. + * @param requestFunnelEntity A funnelEntity. * @return A funnelEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a funnel", - response = FunnelEntity.class, - authorizations = { - @Authorization(value = "Write - /funnels/{uuid}") + @Operation( + summary = "Updates a funnel", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), + security = { + @SecurityRequirement(name = "Write - /funnels/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateFunnel( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The funnel id.", + @Parameter( + description = "The funnel id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The funnel configuration details.", + @Parameter( + description = "The funnel configuration details.", required = true ) final FunnelEntity requestFunnelEntity) { @@ -234,55 +225,50 @@ public class FunnelResource extends ApplicationResource { /** * Removes the specified funnel. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the funnel to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the funnel to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a funnel", - response = FunnelEntity.class, - authorizations = { - @Authorization(value = "Write - /funnels/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}") + @Operation( + summary = "Deletes a funnel", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), + security = { + @SecurityRequirement(name = "Write - /funnels/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeFunnel( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The funnel id.", + @Parameter( + description = "The funnel id.", required = true ) @PathParam("id") final String id) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java index dad2cad660..cf12c44564 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java @@ -16,16 +16,16 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Set; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -36,7 +36,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -60,13 +59,7 @@ import org.apache.nifi.web.api.request.LongParameter; * RESTful endpoint for managing an Input Port. */ @Path("/input-ports") -@Api( - value = "/input-ports", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing an Input Port.") -}) +@Tag(name = "InputPorts") public class InputPortResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -106,25 +99,25 @@ public class InputPortResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets an input port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Read - /input-ports/{uuid}") + @Operation( + summary = "Gets an input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Read - /input-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getInputPort( - @ApiParam( - value = "The input port id.", + @Parameter( + description = "The input port id.", required = true ) @PathParam("id") final String id) { @@ -149,40 +142,38 @@ public class InputPortResource extends ApplicationResource { /** * Updates the specified input port. * - * @param httpServletRequest request - * @param id The id of the input port to update. - * @param requestPortEntity A inputPortEntity. + * @param id The id of the input port to update. + * @param requestPortEntity A inputPortEntity. * @return A inputPortEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates an input port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Write - /input-ports/{uuid}") + @Operation( + summary = "Updates an input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /input-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateInputPort( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The input port id.", + @Parameter( + description = "The input port id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The input port configuration details.", + @Parameter( + description = "The input port configuration details.", required = true ) final PortEntity requestPortEntity) { @@ -240,52 +231,47 @@ public class InputPortResource extends ApplicationResource { /** * Removes the specified input port. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the input port to remove. + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the input port to remove. * @return A inputPortEntity. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes an input port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Write - /input-ports/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}") + @Operation( + summary = "Deletes an input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /input-ports/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeInputPort( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The input port id.", + @Parameter( + description = "The input port id.", required = true ) @PathParam("id") final String id) { @@ -326,40 +312,38 @@ public class InputPortResource extends ApplicationResource { /** * Updates the operational status for the specified input port with the specified values. * - * @param httpServletRequest request - * @param id The id of the port to update. - * @param requestRunStatus A portRunStatusEntity. + * @param id The id of the port to update. + * @param requestRunStatus A portRunStatusEntity. * @return A portEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/run-status") - @ApiOperation( - value = "Updates run status of an input-port", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Write - /input-ports/{uuid} or /operation/input-ports/{uuid}") + @Operation( + summary = "Updates run status of an input-port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /input-ports/{uuid} or /operation/input-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRunStatus( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The port id.", + @Parameter( + description = "The port id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The port run status.", + @Parameter( + description = "The port run status.", required = true ) final PortRunStatusEntity requestRunStatus) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java index 14da0083b1..c0060affbd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java @@ -16,16 +16,16 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Set; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -36,7 +36,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -56,13 +55,7 @@ import org.apache.nifi.web.api.request.LongParameter; * RESTful endpoint for managing a Label. */ @Path("/labels") -@Api( - value = "/labels", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Label.") -}) +@Tag(name = "Labels") public class LabelResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -102,25 +95,25 @@ public class LabelResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a label", - response = LabelEntity.class, - authorizations = { - @Authorization(value = "Read - /labels/{uuid}") + @Operation( + summary = "Gets a label", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), + security = { + @SecurityRequirement(name = "Read - /labels/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getLabel( - @ApiParam( - value = "The label id.", + @Parameter( + description = "The label id.", required = true ) @PathParam("id") final String id) { @@ -145,40 +138,38 @@ public class LabelResource extends ApplicationResource { /** * Updates the specified label. * - * @param httpServletRequest request - * @param id The id of the label to update. - * @param requestLabelEntity A labelEntity. + * @param id The id of the label to update. + * @param requestLabelEntity A labelEntity. * @return A labelEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a label", - response = LabelEntity.class, - authorizations = { - @Authorization(value = "Write - /labels/{uuid}") + @Operation( + summary = "Updates a label", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), + security = { + @SecurityRequirement(name = "Write - /labels/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateLabel( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The label id.", + @Parameter( + description = "The label id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The label configuration details.", + @Parameter( + description = "The label configuration details.", required = true ) final LabelEntity requestLabelEntity) { @@ -236,52 +227,47 @@ public class LabelResource extends ApplicationResource { /** * Removes the specified label. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the label to remove. + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the label to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a label", - response = LabelEntity.class, - authorizations = { - @Authorization(value = "Write - /labels/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}") + @Operation( + summary = "Deletes a label", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), + security = { + @SecurityRequirement(name = "Write - /labels/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeLabel( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The label id.", + @Parameter( + description = "The label id.", required = true ) @PathParam("id") final String id) { @@ -319,8 +305,6 @@ public class LabelResource extends ApplicationResource { ); } - // setters - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java index 0e88a332ce..38149c1565 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java @@ -16,16 +16,16 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Set; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -36,7 +36,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -60,13 +59,7 @@ import org.apache.nifi.web.api.request.LongParameter; * RESTful endpoint for managing an Output Port. */ @Path("/output-ports") -@Api( - value = "/output-ports", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing an Output Port.") -}) +@Tag(name = "OutputPorts") public class OutputPortResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -106,25 +99,25 @@ public class OutputPortResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets an output port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Read - /output-ports/{uuid}") + @Operation( + summary = "Gets an output port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Read - /output-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getOutputPort( - @ApiParam( - value = "The output port id.", + @Parameter( + description = "The output port id.", required = true ) @PathParam("id") final String id) { @@ -149,40 +142,38 @@ public class OutputPortResource extends ApplicationResource { /** * Updates the specified output port. * - * @param httpServletRequest request - * @param id The id of the output port to update. - * @param requestPortEntity A outputPortEntity. + * @param id The id of the output port to update. + * @param requestPortEntity A outputPortEntity. * @return A outputPortEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates an output port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Write - /output-ports/{uuid}") + @Operation( + summary = "Updates an output port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /output-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateOutputPort( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The output port id.", + @Parameter( + description = "The output port id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The output port configuration details.", + @Parameter( + description = "The output port configuration details.", required = true ) final PortEntity requestPortEntity) { @@ -240,52 +231,47 @@ public class OutputPortResource extends ApplicationResource { /** * Removes the specified output port. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the output port to remove. + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the output port to remove. * @return A outputPortEntity. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes an output port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Write - /output-ports/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}") + @Operation( + summary = "Deletes an output port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /output-ports/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeOutputPort( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The output port id.", + @Parameter( + description = "The output port id.", required = true ) @PathParam("id") final String id) { @@ -327,40 +313,38 @@ public class OutputPortResource extends ApplicationResource { /** * Updates the operational status for the specified input port with the specified values. * - * @param httpServletRequest request - * @param id The id of the port to update. - * @param requestRunStatus A portRunStatusEntity. + * @param id The id of the port to update. + * @param requestRunStatus A portRunStatusEntity. * @return A portEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/run-status") - @ApiOperation( - value = "Updates run status of an output-port", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Write - /output-ports/{uuid} or /operation/output-ports/{uuid}") + @Operation( + summary = "Updates run status of an output-port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /output-ports/{uuid} or /operation/output-ports/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRunStatus( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The port id.", + @Parameter( + description = "The port id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The port run status.", + @Parameter( + description = "The port run status.", required = true ) final PortRunStatusEntity requestRunStatus) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java index 76c48740fe..4755dd61b7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java @@ -16,14 +16,6 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; @@ -39,6 +31,15 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.regex.Pattern; import java.util.stream.Collectors; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -62,7 +63,6 @@ import org.apache.nifi.authorization.user.NiFiUser; import org.apache.nifi.authorization.user.NiFiUserUtils; import org.apache.nifi.controller.ControllerService; import org.apache.nifi.controller.service.StandardControllerServiceNode; -import org.apache.nifi.parameter.Parameter; import org.apache.nifi.parameter.ParameterContext; import org.apache.nifi.parameter.ParameterReferencedControllerServiceData; import org.apache.nifi.web.NiFiServiceFacade; @@ -98,15 +98,8 @@ import org.apache.nifi.web.util.ParameterUpdateManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - @Path("/parameter-contexts") -@Api( - value = "/parameter-contexts", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing version control for a flow.") -}) +@Tag(name = "ParameterContexts") public class ParameterContextResource extends AbstractParameterResource { private static final Logger logger = LoggerFactory.getLogger(ParameterContextResource.class); private static final Pattern VALID_PARAMETER_NAME_PATTERN = Pattern.compile("[A-Za-z0-9 ._\\-]+"); @@ -121,7 +114,7 @@ public class ParameterContextResource extends AbstractParameterResource { private RequestManager, List> updateRequestManager = new AsyncRequestManager<>(100, TimeUnit.MINUTES.toMillis(1L), "Parameter Context Update Thread"); private RequestManager validationRequestManager = new AsyncRequestManager<>(100, TimeUnit.MINUTES.toMillis(1L), - "Parameter Context Validation Thread"); + "Parameter Context Validation Thread"); public void init() { parameterUpdateManager = new ParameterUpdateManager(serviceFacade, dtoFactory, authorizer, this); @@ -142,24 +135,31 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Returns the Parameter Context with the given ID", - response = ParameterContextEntity.class, - notes = "Returns the Parameter Context with the given ID.", - authorizations = { - @Authorization(value = "Read - /parameter-contexts/{id}") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response getParameterContext(@ApiParam("The ID of the Parameter Context") @PathParam("id") final String parameterContextId, - @ApiParam("Whether or not to include inherited parameters from other parameter contexts, and therefore also overridden values. " + - "If true, the result will be the 'effective' parameter context.") @QueryParam("includeInheritedParameters") - @DefaultValue("false") final boolean includeInheritedParameters) { + @Operation( + summary = "Returns the Parameter Context with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + description = "Returns the Parameter Context with the given ID.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getParameterContext( + @Parameter(description = "The ID of the Parameter Context") + @PathParam("id") final String parameterContextId, + @Parameter( + description = "Whether or not to include inherited parameters from other parameter contexts, and therefore also overridden values. " + + "If true, the result will be the 'effective' parameter context." + ) @QueryParam("includeInheritedParameters") + @DefaultValue("false") final boolean includeInheritedParameters) { // authorize access authorizeReadParameterContext(parameterContextId); @@ -179,22 +179,25 @@ public class ParameterContextResource extends AbstractParameterResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create a Parameter Context", - response = ParameterContextEntity.class, - authorizations = { - @Authorization(value = "Write - /parameter-contexts"), - @Authorization(value = "Read - for every inherited parameter context") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Create a Parameter Context", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + security = { + @SecurityRequirement(name = "Write - /parameter-contexts"), + @SecurityRequirement(name = "Read - for every inherited parameter context") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response createParameterContext( - @ApiParam(value = "The Parameter Context.", required = true) final ParameterContextEntity requestEntity) { + @Parameter(description = "The Parameter Context.", required = true) final ParameterContextEntity requestEntity) { if (requestEntity == null || requestEntity.getComponent() == null) { throw new IllegalArgumentException("Parameter Context must be specified"); @@ -218,25 +221,25 @@ public class ParameterContextResource extends AbstractParameterResource { } return withWriteLock( - serviceFacade, - requestEntity, - lookup -> { - final Authorizable parameterContexts = lookup.getParameterContexts(); - parameterContexts.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - () -> serviceFacade.verifyCreateParameterContext(requestEntity.getComponent()), - entity -> { - final String contextId = generateUuid(); - entity.getComponent().setId(contextId); + serviceFacade, + requestEntity, + lookup -> { + final Authorizable parameterContexts = lookup.getParameterContexts(); + parameterContexts.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + () -> serviceFacade.verifyCreateParameterContext(requestEntity.getComponent()), + entity -> { + final String contextId = generateUuid(); + entity.getComponent().setId(contextId); - final Revision revision = getRevision(entity.getRevision(), contextId); - final ParameterContextEntity contextEntity = serviceFacade.createParameterContext(revision, entity.getComponent()); + final Revision revision = getRevision(entity.getRevision(), contextId); + final ParameterContextEntity contextEntity = serviceFacade.createParameterContext(revision, entity.getComponent()); - // generate a 201 created response - final String uri = generateResourceUri("parameter-contexts", contextEntity.getId()); - contextEntity.setUri(uri); - return generateCreatedResponse(URI.create(uri), contextEntity).build(); - }); + // generate a 201 created response + final String uri = generateResourceUri("parameter-contexts", contextEntity.getId()); + contextEntity.setUri(uri); + return generateCreatedResponse(URI.create(uri), contextEntity).build(); + }); } @@ -244,27 +247,30 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Modifies a Parameter Context", - response = ParameterContextEntity.class, - notes = "This endpoint will update a Parameter Context to match the provided entity. However, this request will fail if any component is running and is referencing a Parameter in the " + - "Parameter Context. Generally, this endpoint is not called directly. Instead, an update request should be submitted by making a POST to the " + - "/parameter-contexts/update-requests endpoint. That endpoint will, in turn, call this endpoint.", - authorizations = { - @Authorization(value = "Read - /parameter-contexts/{id}"), - @Authorization(value = "Write - /parameter-contexts/{id}") - } + @Operation( + summary = "Modifies a Parameter Context", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + description = "This endpoint will update a Parameter Context to match the provided entity. However, this request will fail if any component is running and is referencing a Parameter in " + + "the " + + "Parameter Context. Generally, this endpoint is not called directly. Instead, an update request should be submitted by making a POST to the " + + "/parameter-contexts/update-requests endpoint. That endpoint will, in turn, call this endpoint.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id}"), + @SecurityRequirement(name = "Write - /parameter-contexts/{id}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) public Response updateParameterContext( - @PathParam("id") String contextId, - @ApiParam(value = "The updated Parameter Context", required = true) ParameterContextEntity requestEntity) { + @PathParam("id") String contextId, + @Parameter(description = "The updated Parameter Context", required = true) final ParameterContextEntity requestEntity) { // Validate request if (requestEntity.getId() == null) { @@ -293,21 +299,21 @@ public class ParameterContextResource extends AbstractParameterResource { final Revision requestRevision = getRevision(requestEntity.getRevision(), updateDto.getId()); return withWriteLock( - serviceFacade, - requestEntity, - requestRevision, - lookup -> { - final Authorizable parameterContext = lookup.getParameterContext(contextId); - parameterContext.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - parameterContext.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - () -> serviceFacade.verifyUpdateParameterContext(updateDto, true), - (rev, entity) -> { - final ParameterContextEntity updatedEntity = serviceFacade.updateParameterContext(rev, entity.getComponent()); + serviceFacade, + requestEntity, + requestRevision, + lookup -> { + final Authorizable parameterContext = lookup.getParameterContext(contextId); + parameterContext.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + parameterContext.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + () -> serviceFacade.verifyUpdateParameterContext(updateDto, true), + (rev, entity) -> { + final ParameterContextEntity updatedEntity = serviceFacade.updateParameterContext(rev, entity.getComponent()); - updatedEntity.setUri(generateResourceUri("parameter-contexts", entity.getId())); - return generateOkResponse(updatedEntity).build(); - } + updatedEntity.setUri(generateResourceUri("parameter-contexts", entity.getId())); + return generateOkResponse(updatedEntity).build(); + } ); } @@ -316,32 +322,36 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{contextId}/update-requests") - @ApiOperation( - value = "Initiate the Update Request of a Parameter Context", - response = ParameterContextUpdateRequestEntity.class, - notes = "This will initiate the process of updating a Parameter Context. Changing the value of a Parameter may require that one or more components be stopped and " + - "restarted, so this action may take significantly more time than many other REST API actions. As a result, this endpoint will immediately return a ParameterContextUpdateRequestEntity, " + - "and the process of updating the necessary components will occur asynchronously in the background. The client may then periodically poll the status of the request by " + - "issuing a GET request to /parameter-contexts/update-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + - "/parameter-contexts/update-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /parameter-contexts/{parameterContextId}"), - @Authorization(value = "Write - /parameter-contexts/{parameterContextId}"), - @Authorization(value = "Read - for every component that is affected by the update"), - @Authorization(value = "Write - for every component that is affected by the update"), - @Authorization(value = "Read - for every currently inherited parameter context"), - @Authorization(value = "Read - for any new inherited parameter context") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Initiate the Update Request of a Parameter Context", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), + description = "This will initiate the process of updating a Parameter Context. Changing the value of a Parameter may require that one or more components be stopped and " + + "restarted, so this action may take significantly more time than many other REST API actions. As a result, this endpoint will immediately return a " + + "ParameterContextUpdateRequestEntity, " + + "and the process of updating the necessary components will occur asynchronously in the background. The client may then periodically poll the status of the request by " + + "issuing a GET request to /parameter-contexts/update-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/parameter-contexts/update-requests/{requestId}.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{parameterContextId}"), + @SecurityRequirement(name = "Write - /parameter-contexts/{parameterContextId}"), + @SecurityRequirement(name = "Read - for every component that is affected by the update"), + @SecurityRequirement(name = "Write - for every component that is affected by the update"), + @SecurityRequirement(name = "Read - for every currently inherited parameter context"), + @SecurityRequirement(name = "Read - for any new inherited parameter context") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response submitParameterContextUpdate( - @PathParam("contextId") final String contextId, - @ApiParam(value = "The updated version of the parameter context.", required = true) final ParameterContextEntity requestEntity) { + @PathParam("contextId") final String contextId, + @Parameter(description = "The updated version of the parameter context.", required = true) final ParameterContextEntity requestEntity) { if (requestEntity == null) { throw new IllegalArgumentException("Parameter Context must be specified."); @@ -390,80 +400,80 @@ public class ParameterContextResource extends AbstractParameterResource { logger.debug("Received Update Request for Parameter Context: {}; the following {} components will be affected: {}", requestEntity, affectedComponents.size(), affectedComponents); final InitiateChangeParameterContextRequestWrapper requestWrapper = new InitiateChangeParameterContextRequestWrapper(requestEntity, componentLifecycle, getAbsolutePath(), - affectedComponents, replicateRequest, user); + affectedComponents, replicateRequest, user); final Revision requestRevision = getRevision(requestEntity.getRevision(), contextDto.getId()); return withWriteLock( - serviceFacade, - requestWrapper, - requestRevision, - lookup -> { - // Verify READ and WRITE permissions for user, for the Parameter Context itself - final ParameterContext parameterContext = lookup.getParameterContext(contextId); - parameterContext.authorize(authorizer, RequestAction.READ, user); - parameterContext.authorize(authorizer, RequestAction.WRITE, user); + serviceFacade, + requestWrapper, + requestRevision, + lookup -> { + // Verify READ and WRITE permissions for user, for the Parameter Context itself + final ParameterContext parameterContext = lookup.getParameterContext(contextId); + parameterContext.authorize(authorizer, RequestAction.READ, user); + parameterContext.authorize(authorizer, RequestAction.WRITE, user); - // Verify READ and WRITE permissions for user, for every component that is affected - affectedComponents.forEach(component -> parameterUpdateManager.authorizeAffectedComponent(component, lookup, user, true, true)); + // Verify READ and WRITE permissions for user, for every component that is affected + affectedComponents.forEach(component -> parameterUpdateManager.authorizeAffectedComponent(component, lookup, user, true, true)); - Set parametersEntities = requestEntity.getComponent().getParameters(); - for (ParameterEntity parameterEntity : parametersEntities) { - String parameterName = parameterEntity.getParameter().getName(); - List referencedControllerServiceDataSet = parameterContext - .getParameterReferenceManager() - .getReferencedControllerServiceData(parameterContext, parameterName); + Set parametersEntities = requestEntity.getComponent().getParameters(); + for (ParameterEntity parameterEntity : parametersEntities) { + String parameterName = parameterEntity.getParameter().getName(); + List referencedControllerServiceDataSet = parameterContext + .getParameterReferenceManager() + .getReferencedControllerServiceData(parameterContext, parameterName); - Set> referencedControllerServiceTypes = referencedControllerServiceDataSet - .stream() - .map(ParameterReferencedControllerServiceData::getReferencedControllerServiceType) - .collect(Collectors.toSet()); + Set> referencedControllerServiceTypes = referencedControllerServiceDataSet + .stream() + .map(ParameterReferencedControllerServiceData::getReferencedControllerServiceType) + .collect(Collectors.toSet()); - if (referencedControllerServiceTypes.size() > 1) { - throw new IllegalStateException("Parameter is used by multiple different types of controller service references"); - } else if (!referencedControllerServiceTypes.isEmpty()) { - Optional parameterOptional = parameterContext.getParameter(parameterName); - if (parameterOptional.isPresent()) { - String currentParameterValue = parameterOptional.get().getValue(); - if (currentParameterValue != null) { - ComponentAuthorizable currentControllerService = lookup.getControllerService(currentParameterValue); - if (currentControllerService != null) { - Authorizable currentControllerServiceAuthorizable = currentControllerService.getAuthorizable(); - if (currentControllerServiceAuthorizable != null) { - currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.READ, user); - currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.WRITE, user); + if (referencedControllerServiceTypes.size() > 1) { + throw new IllegalStateException("Parameter is used by multiple different types of controller service references"); + } else if (!referencedControllerServiceTypes.isEmpty()) { + Optional parameterOptional = parameterContext.getParameter(parameterName); + if (parameterOptional.isPresent()) { + String currentParameterValue = parameterOptional.get().getValue(); + if (currentParameterValue != null) { + ComponentAuthorizable currentControllerService = lookup.getControllerService(currentParameterValue); + if (currentControllerService != null) { + Authorizable currentControllerServiceAuthorizable = currentControllerService.getAuthorizable(); + if (currentControllerServiceAuthorizable != null) { + currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.READ, user); + currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.WRITE, user); + } } } } - } - String newParameterValue = parameterEntity.getParameter().getValue(); - if (newParameterValue != null) { - ComponentAuthorizable newControllerService = lookup.getControllerService(newParameterValue); - if (newControllerService != null) { - Authorizable newControllerServiceAuthorizable = newControllerService.getAuthorizable(); - if (newControllerServiceAuthorizable != null) { - newControllerServiceAuthorizable.authorize(authorizer, RequestAction.READ, user); - newControllerServiceAuthorizable.authorize(authorizer, RequestAction.WRITE, user); + String newParameterValue = parameterEntity.getParameter().getValue(); + if (newParameterValue != null) { + ComponentAuthorizable newControllerService = lookup.getControllerService(newParameterValue); + if (newControllerService != null) { + Authorizable newControllerServiceAuthorizable = newControllerService.getAuthorizable(); + if (newControllerServiceAuthorizable != null) { + newControllerServiceAuthorizable.authorize(authorizer, RequestAction.READ, user); + newControllerServiceAuthorizable.authorize(authorizer, RequestAction.WRITE, user); - if ( - !referencedControllerServiceTypes.iterator().next() - .isAssignableFrom( - ((StandardControllerServiceNode) newControllerServiceAuthorizable).getComponent().getClass() - ) - ) { - throw new IllegalArgumentException("New Parameter value attempts to reference an incompatible controller service"); + if ( + !referencedControllerServiceTypes.iterator().next() + .isAssignableFrom( + ((StandardControllerServiceNode) newControllerServiceAuthorizable).getComponent().getClass() + ) + ) { + throw new IllegalArgumentException("New Parameter value attempts to reference an incompatible controller service"); + } } } } } } - } - }, - () -> { - // Verify Request - serviceFacade.verifyUpdateParameterContext(contextDto, false); - }, - this::submitUpdateRequest + }, + () -> { + // Verify Request + serviceFacade.verifyUpdateParameterContext(contextDto, false); + }, + this::submitUpdateRequest ); } @@ -487,25 +497,30 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{contextId}/update-requests/{requestId}") - @ApiOperation( - value = "Returns the Update Request with the given ID", - response = ParameterContextUpdateRequestEntity.class, - notes = "Returns the Update Request with the given ID. Once an Update Request has been created by performing a POST to /nifi-api/parameter-contexts, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns the Update Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), + description = "Returns the Update Request with the given ID. Once an Update Request has been created by performing a POST to /nifi-api/parameter-contexts, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getParameterContextUpdate( - @ApiParam("The ID of the Parameter Context") @PathParam("contextId") final String contextId, - @ApiParam("The ID of the Update Request") @PathParam("requestId") final String updateRequestId) { + @Parameter(description = "The ID of the Parameter Context") + @PathParam("contextId") final String contextId, + @Parameter(description = "The ID of the Update Request") + @PathParam("requestId") final String updateRequestId) { authorizeReadParameterContext(contextId); @@ -517,73 +532,79 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{contextId}/update-requests/{requestId}") - @ApiOperation( - value = "Deletes the Update Request with the given ID", - response = ParameterContextUpdateRequestEntity.class, - notes = "Deletes the Update Request with the given ID. After a request is created via a POST to /nifi-api/parameter-contexts/update-requests, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Update process has completed. If the request is deleted before the request " - + "completes, then the Update request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Update Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), + description = "Deletes the Update Request with the given ID. After a request is created via a POST to /nifi-api/parameter-contexts/update-requests, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Update process has completed. If the request is deleted before the request " + + "completes, then the Update request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteUpdateRequest( - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false - ) - @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam("The ID of the ParameterContext") @PathParam("contextId") final String contextId, - @ApiParam("The ID of the Update Request") @PathParam("requestId") final String updateRequestId) { + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + ) + @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, + @Parameter(description = "The ID of the ParameterContext") + @PathParam("contextId") final String contextId, + @Parameter(description = "The ID of the Update Request") + @PathParam("requestId") final String updateRequestId) { authorizeReadParameterContext(contextId); return deleteUpdateRequest("update-requests", contextId, updateRequestId, disconnectedNodeAcknowledged.booleanValue()); } - @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes the Parameter Context with the given ID", - response = ParameterContextEntity.class, - notes = "Deletes the Parameter Context with the given ID.", - authorizations = { - @Authorization(value = "Read - /parameter-contexts/{uuid}"), - @Authorization(value = "Write - /parameter-contexts/{uuid}"), - @Authorization(value = "Read - /process-groups/{uuid}, for any Process Group that is currently bound to the Parameter Context"), - @Authorization(value = "Write - /process-groups/{uuid}, for any Process Group that is currently bound to the Parameter Context") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Parameter Context with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + description = "Deletes the Parameter Context with the given ID.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{uuid}"), + @SecurityRequirement(name = "Write - /parameter-contexts/{uuid}"), + @SecurityRequirement(name = "Read - /process-groups/{uuid}, for any Process Group that is currently bound to the Parameter Context"), + @SecurityRequirement(name = "Write - /process-groups/{uuid}, for any Process Group that is currently bound to the Parameter Context") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteParameterContext( - @ApiParam( - value = "The version is used to verify the client is working with the latest version of the flow.", - required = false) - @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response.", - required = false) - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false - ) - @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam("The Parameter Context ID.") @PathParam("id") final String parameterContextId) { - + @Parameter( + description = "The version is used to verify the client is working with the latest version of the flow." + ) + @QueryParam(VERSION) final LongParameter version, + @Parameter( + description = "If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response." + ) + @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." + ) + @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) + @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, + @Parameter(description = "The Parameter Context ID.") + @PathParam("id") final String parameterContextId) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -593,32 +614,32 @@ public class ParameterContextResource extends AbstractParameterResource { final Revision requestRevision = new Revision(version == null ? null : version.getLong(), clientId.getClientId(), parameterContextId); return withWriteLock( - serviceFacade, - null, - requestRevision, - lookup -> { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); + serviceFacade, + null, + requestRevision, + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); - final Authorizable parameterContext = lookup.getParameterContext(parameterContextId); - parameterContext.authorize(authorizer, RequestAction.READ, user); - parameterContext.authorize(authorizer, RequestAction.WRITE, user); + final Authorizable parameterContext = lookup.getParameterContext(parameterContextId); + parameterContext.authorize(authorizer, RequestAction.READ, user); + parameterContext.authorize(authorizer, RequestAction.WRITE, user); - final ParameterContextEntity contextEntity = serviceFacade.getParameterContext(parameterContextId, false, user); - for (final ProcessGroupEntity boundGroupEntity : contextEntity.getComponent().getBoundProcessGroups()) { - final String groupId = boundGroupEntity.getId(); - final Authorizable groupAuthorizable = lookup.getProcessGroup(groupId).getAuthorizable(); - groupAuthorizable.authorize(authorizer, RequestAction.READ, user); - groupAuthorizable.authorize(authorizer, RequestAction.WRITE, user); - } - }, - () -> serviceFacade.verifyDeleteParameterContext(parameterContextId), - (revision, groupEntity) -> { - // disconnect from version control - final ParameterContextEntity entity = serviceFacade.deleteParameterContext(revision, parameterContextId); + final ParameterContextEntity contextEntity = serviceFacade.getParameterContext(parameterContextId, false, user); + for (final ProcessGroupEntity boundGroupEntity : contextEntity.getComponent().getBoundProcessGroups()) { + final String groupId = boundGroupEntity.getId(); + final Authorizable groupAuthorizable = lookup.getProcessGroup(groupId).getAuthorizable(); + groupAuthorizable.authorize(authorizer, RequestAction.READ, user); + groupAuthorizable.authorize(authorizer, RequestAction.WRITE, user); + } + }, + () -> serviceFacade.verifyDeleteParameterContext(parameterContextId), + (revision, groupEntity) -> { + // disconnect from version control + final ParameterContextEntity entity = serviceFacade.deleteParameterContext(revision, parameterContextId); - // generate the response - return generateOkResponse(entity).build(); - }); + // generate the response + return generateOkResponse(entity).build(); + }); } @@ -627,28 +648,31 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{contextId}/validation-requests") - @ApiOperation( - value = "Initiate a Validation Request to determine how the validity of components will change if a Parameter Context were to be updated", - response = ParameterContextValidationRequestEntity.class, - notes = "This will initiate the process of validating all components whose Process Group is bound to the specified Parameter Context. Performing validation against " + - "an arbitrary number of components may be expect and take significantly more time than many other REST API actions. As a result, this endpoint will immediately return " + - "a ParameterContextValidationRequestEntity, " + - "and the process of validating the necessary components will occur asynchronously in the background. The client may then periodically poll the status of the request by " + - "issuing a GET request to /parameter-contexts/validation-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + - "/parameter-contexts/validation-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /parameter-contexts/{parameterContextId}") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Initiate a Validation Request to determine how the validity of components will change if a Parameter Context were to be updated", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), + description = "This will initiate the process of validating all components whose Process Group is bound to the specified Parameter Context. Performing validation against " + + "an arbitrary number of components may be expect and take significantly more time than many other REST API actions. As a result, this endpoint will immediately return " + + "a ParameterContextValidationRequestEntity, " + + "and the process of validating the necessary components will occur asynchronously in the background. The client may then periodically poll the status of the request by " + + "issuing a GET request to /parameter-contexts/validation-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/parameter-contexts/validation-requests/{requestId}.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{parameterContextId}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response submitValidationRequest( - @PathParam("contextId") final String contextId, - @ApiParam(value = "The validation request", required=true) final ParameterContextValidationRequestEntity requestEntity) { + @PathParam("contextId") final String contextId, + @Parameter(description = "The validation request", required = true) final ParameterContextValidationRequestEntity requestEntity) { if (requestEntity == null) { throw new IllegalArgumentException("Parameter Context must be specified."); @@ -673,16 +697,17 @@ public class ParameterContextResource extends AbstractParameterResource { } return withWriteLock( - serviceFacade, - requestEntity, - lookup -> { - final Authorizable parameterContext = lookup.getParameterContext(contextId); - parameterContext.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + serviceFacade, + requestEntity, + lookup -> { + final Authorizable parameterContext = lookup.getParameterContext(contextId); + parameterContext.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - authorizeReferencingComponents(requestEntity.getRequest().getParameterContext().getId(), lookup, NiFiUserUtils.getNiFiUser()); - }, - () -> {}, - entity -> performAsyncValidation(entity, NiFiUserUtils.getNiFiUser()) + authorizeReferencingComponents(requestEntity.getRequest().getParameterContext().getId(), lookup, NiFiUserUtils.getNiFiUser()); + }, + () -> { + }, + entity -> performAsyncValidation(entity, NiFiUserUtils.getNiFiUser()) ); } @@ -705,25 +730,30 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{contextId}/validation-requests/{id}") - @ApiOperation( - value = "Returns the Validation Request with the given ID", - response = ParameterContextValidationRequestEntity.class, - notes = "Returns the Validation Request with the given ID. Once a Validation Request has been created by performing a POST to /nifi-api/validation-contexts, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns the Validation Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), + description = "Returns the Validation Request with the given ID. Once a Validation Request has been created by performing a POST to /nifi-api/validation-contexts, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getValidationRequest( - @ApiParam("The ID of the Parameter Context") @PathParam("contextId") final String contextId, - @ApiParam("The ID of the Validation Request") @PathParam("id") final String validationRequestId) { + @Parameter(description = "The ID of the Parameter Context") + @PathParam("contextId") final String contextId, + @Parameter(description = "The ID of the Validation Request") + @PathParam("id") final String validationRequestId) { authorizeReadParameterContext(contextId); @@ -738,30 +768,33 @@ public class ParameterContextResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{contextId}/validation-requests/{id}") - @ApiOperation( - value = "Deletes the Validation Request with the given ID", - response = ParameterContextValidationRequestEntity.class, - notes = "Deletes the Validation Request with the given ID. After a request is created via a POST to /nifi-api/validation-contexts, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the validation process has completed. If the request is deleted before the request " - + "completes, then the Validation request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Validation Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), + description = "Deletes the Validation Request with the given ID. After a request is created via a POST to /nifi-api/validation-contexts, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the validation process has completed. If the request is deleted before the request " + + "completes, then the Validation request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteValidationRequest( - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false - ) - @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam("The ID of the Parameter Context") @PathParam("contextId") final String contextId, - @ApiParam("The ID of the Update Request") @PathParam("id") final String validationRequestId) { + @Parameter(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.") + @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) + @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, + @Parameter(description = "The ID of the Parameter Context") + @PathParam("contextId") final String contextId, + @Parameter(description = "The ID of the Update Request") + @PathParam("id") final String validationRequestId) { authorizeReadParameterContext(contextId); @@ -775,13 +808,12 @@ public class ParameterContextResource extends AbstractParameterResource { } - private Response performAsyncValidation(final ParameterContextValidationRequestEntity requestEntity, final NiFiUser user) { // Create an asynchronous request that will occur in the background, because this request may // result in stopping components, which can take an indeterminate amount of time. final String requestId = generateUuid(); final AsynchronousWebRequest request = new StandardAsynchronousWebRequest<>(requestId, requestEntity, null, user, - getValidationSteps()); + getValidationSteps()); // Submit the request to be performed in the background final Consumer> validationTask = asyncRequest -> { @@ -837,7 +869,7 @@ public class ParameterContextResource extends AbstractParameterResource { try { final List updatedParameterContextEntities = parameterUpdateManager .updateParameterContexts(asyncRequest, requestWrapper.getComponentLifecycle(), requestWrapper.getExampleUri(), - requestWrapper.getReferencingComponents(), requestWrapper.isReplicateRequest(), requestRevision, + requestWrapper.getReferencingComponents(), requestWrapper.isReplicateRequest(), requestRevision, Collections.singletonList(requestWrapper.getParameterContextEntity())); asyncRequest.markStepComplete(updatedParameterContextEntities); @@ -861,10 +893,10 @@ public class ParameterContextResource extends AbstractParameterResource { private List getUpdateSteps() { return Arrays.asList(new StandardUpdateStep("Stopping Affected Processors"), - new StandardUpdateStep("Disabling Affected Controller Services"), - new StandardUpdateStep("Updating Parameter Context"), - new StandardUpdateStep("Re-Enabling Affected Controller Services"), - new StandardUpdateStep("Restarting Affected Processors")); + new StandardUpdateStep("Disabling Affected Controller Services"), + new StandardUpdateStep("Updating Parameter Context"), + new StandardUpdateStep("Re-Enabling Affected Controller Services"), + new StandardUpdateStep("Restarting Affected Processors")); } private Response retrieveValidationRequest(final String requestType, final String contextId, final String requestId) { @@ -1053,7 +1085,6 @@ public class ParameterContextResource extends AbstractParameterResource { } - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java index 558c613d61..b7b2601773 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java @@ -17,14 +17,7 @@ package org.apache.nifi.web.api; import com.google.common.base.Functions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; + import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -41,8 +34,16 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.stream.Collectors; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -129,13 +130,7 @@ import org.slf4j.LoggerFactory; * RESTful endpoint for managing a Parameter Provider. */ @Path("/parameter-providers") -@Api( - value = "/parameter-providers", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Parameter Provider.") -}) +@Tag(name = "ParameterProviders") public class ParameterProviderResource extends AbstractParameterResource { private static final Logger logger = LoggerFactory.getLogger(ParameterProviderResource.class); @@ -234,25 +229,25 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a parameter provider", - response = ParameterProviderEntity.class, - authorizations = { - @Authorization(value = "Read - /parameter-providers/{uuid}") + @Operation( + summary = "Gets a parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getParameterProvider( - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String id) { @@ -284,25 +279,25 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/references") - @ApiOperation( - value = "Gets all references to a parameter provider", - response = ParameterProviderReferencingComponentsEntity.class, - authorizations = { - @Authorization(value = "Read - /parameter-providers/{uuid}") + @Operation( + summary = "Gets all references to a parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderReferencingComponentsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getParameterProviderReferences( - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String id) { @@ -326,7 +321,7 @@ public class ParameterProviderResource extends AbstractParameterResource { /** * Returns the descriptor for the specified property. * - * @param id The id of the parameter provider. + * @param id The id of the parameter provider. * @param propertyName The property * @return a propertyDescriptorEntity */ @@ -334,30 +329,30 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/descriptors") - @ApiOperation( - value = "Gets a parameter provider property descriptor", - response = PropertyDescriptorEntity.class, - authorizations = { - @Authorization(value = "Read - /parameter-providers/{uuid}") + @Operation( + summary = "Gets a parameter provider property descriptor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPropertyDescriptor( - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The property name.", + @Parameter( + description = "The property name.", required = true ) @QueryParam("propertyName") final String propertyName) { @@ -398,25 +393,25 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state") - @ApiOperation( - value = "Gets the state for a parameter provider", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /parameter-providers/{uuid}") + @Operation( + summary = "Gets the state for a parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getState( - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String id) { @@ -445,34 +440,32 @@ public class ParameterProviderResource extends AbstractParameterResource { /** * Clears the state for a parameter provider. * - * @param httpServletRequest servlet request - * @param id The id of the parameter provider + * @param id The id of the parameter provider * @return a componentStateEntity */ @POST @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state/clear-requests") - @ApiOperation( - value = "Clears the state for a parameter provider", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /parameter-providers/{uuid}") + @Operation( + summary = "Clears the state for a parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response clearState( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String id) { @@ -508,8 +501,7 @@ public class ParameterProviderResource extends AbstractParameterResource { /** * Updates the specified a Parameter Provider. * - * @param httpServletRequest request - * @param id The id of the parameter provider to update. + * @param id The id of the parameter provider to update. * @param requestParameterProviderEntity A parameterProviderEntity. * @return A parameterProviderEntity. */ @@ -517,32 +509,31 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a parameter provider", - response = ParameterProviderEntity.class, - authorizations = { - @Authorization(value = "Write - /parameter-providers/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") + @Operation( + summary = "Updates a parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateParameterProvider( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The parameter provider configuration details.", + @Parameter( + description = "The parameter provider configuration details.", required = true ) final ParameterProviderEntity requestParameterProviderEntity) { @@ -597,56 +588,51 @@ public class ParameterProviderResource extends AbstractParameterResource { /** * Removes the specified parameter provider. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the parameter provider to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the parameter provider to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a parameter provider", - response = ParameterProviderEntity.class, - authorizations = { - @Authorization(value = "Write - /parameter-providers/{uuid}"), - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}") + @Operation( + summary = "Deletes a parameter provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}"), + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeParameterProvider( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") String id) { @@ -691,7 +677,6 @@ public class ParameterProviderResource extends AbstractParameterResource { * Tells the Parameter Provider to fetch its parameters. This will temporarily cache the fetched parameters, * but the changes will not be applied to the flow until an "apply-parameters-requests" request is created. * - * @param httpServletRequest request * @param parameterProviderId The id of the parameter provider. * @return A parameterProviderEntity. */ @@ -699,31 +684,30 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/parameters/fetch-requests") - @ApiOperation( - value = "Fetches and temporarily caches the parameters for a provider", - response = ParameterProviderEntity.class, - authorizations = { - @Authorization(value = "Write - /parameter-providers/{uuid} or or /operation/parameter-providers/{uuid}") + @Operation( + summary = "Fetches and temporarily caches the parameters for a provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid} or or /operation/parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response fetchParameters( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The parameter provider id.", + @Parameter( + description = "The parameter provider id.", required = true ) @PathParam("id") final String parameterProviderId, - @ApiParam( - value = "The parameter fetch request.", + @Parameter( + description = "The parameter fetch request.", required = true ) final ParameterProviderParameterFetchEntity fetchParametersEntity) { @@ -837,30 +821,33 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{providerId}/apply-parameters-requests") - @ApiOperation( - value = "Initiate a request to apply the fetched parameters of a Parameter Provider", - response = ParameterProviderApplyParametersRequestEntity.class, - notes = "This will initiate the process of applying fetched parameters to all referencing Parameter Contexts. Changing the value of a Parameter may require that one or more " + + @Operation( + summary = "Initiate a request to apply the fetched parameters of a Parameter Provider", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), + description = "This will initiate the process of applying fetched parameters to all referencing Parameter Contexts. Changing the value of a Parameter may require that one or more " + "components be stopped and restarted, so this action may take significantly more time than many other REST API actions. As a result, this endpoint will immediately return a " + "ParameterProviderApplyParametersRequestEntity, and the process of updating the necessary components will occur asynchronously in the background. The client may then " + "periodically poll the status of the request by issuing a GET request to /parameter-providers/apply-parameters-requests/{requestId}. Once the request is completed, the client " + "is expected to issue a DELETE request to /parameter-providers/apply-parameters-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /parameter-providers/{parameterProviderId}"), - @Authorization(value = "Write - /parameter-providers/{parameterProviderId}"), - @Authorization(value = "Read - for every component that is affected by the update"), - @Authorization(value = "Write - for every component that is affected by the update") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{parameterProviderId}"), + @SecurityRequirement(name = "Write - /parameter-providers/{parameterProviderId}"), + @SecurityRequirement(name = "Read - for every component that is affected by the update"), + @SecurityRequirement(name = "Write - for every component that is affected by the update") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response submitApplyParameters( @PathParam("providerId") final String parameterProviderId, - @ApiParam(value = "The apply parameters request.", required = true) final ParameterProviderParameterApplicationEntity requestEntity) { + @Parameter(description = "The apply parameters request.", required = true) final ParameterProviderParameterApplicationEntity requestEntity) { if (requestEntity == null) { throw new IllegalArgumentException("Apply Parameters Request must be specified."); @@ -903,13 +890,13 @@ public class ParameterProviderResource extends AbstractParameterResource { parameterGroupConfigurations.stream() .filter(parameterGroupConfiguration -> requiresNewParameterContext(parameterGroupConfiguration, user)) .forEach(parameterGroupConfiguration -> { - final ParameterContextEntity newParameterContext = getNewParameterContextEntity(parameterProviderId, parameterGroupConfiguration); - try { - performParameterContextCreate(user, getAbsolutePath(), replicateRequest, newParameterContext); - } catch (final LifecycleManagementException e) { - throw new RuntimeException("Failed to create Parameter Context " + parameterGroupConfiguration.getGroupName(), e); - } - }); + final ParameterContextEntity newParameterContext = getNewParameterContextEntity(parameterProviderId, parameterGroupConfiguration); + try { + performParameterContextCreate(user, getAbsolutePath(), replicateRequest, newParameterContext); + } catch (final LifecycleManagementException e) { + throw new RuntimeException("Failed to create Parameter Context " + parameterGroupConfiguration.getGroupName(), e); + } + }); // Get a list of parameter context entities representing changes needed in order to apply the fetched parameters final List parameterContextUpdates = serviceFacade.getParameterContextUpdatesForAppliedParameters(parameterProviderId, parameterGroupConfigurations); @@ -1027,25 +1014,28 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{providerId}/apply-parameters-requests/{requestId}") - @ApiOperation( - value = "Returns the Apply Parameters Request with the given ID", - response = ParameterProviderApplyParametersRequestEntity.class, - notes = "Returns the Apply Parameters Request with the given ID. Once an Apply Parameters Request has been created by performing a POST to /nifi-api/parameter-providers, " + @Operation( + summary = "Returns the Apply Parameters Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), + description = "Returns the Apply Parameters Request with the given ID. Once an Apply Parameters Request has been created by performing a POST to /nifi-api/parameter-providers, " + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the state, such as percent complete, the " + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getParameterProviderApplyParametersRequest( - @ApiParam("The ID of the Parameter Provider") @PathParam("providerId") final String parameterProviderId, - @ApiParam("The ID of the Apply Parameters Request") @PathParam("requestId") final String applyParametersRequestId) { + @Parameter(description = "The ID of the Parameter Provider") @PathParam("providerId") final String parameterProviderId, + @Parameter(description = "The ID of the Apply Parameters Request") @PathParam("requestId") final String applyParametersRequestId) { authorizeReadParameterProvider(parameterProviderId); @@ -1056,30 +1046,32 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{providerId}/apply-parameters-requests/{requestId}") - @ApiOperation( - value = "Deletes the Apply Parameters Request with the given ID", - response = ParameterProviderApplyParametersRequestEntity.class, - notes = "Deletes the Apply Parameters Request with the given ID. After a request is created via a POST to /nifi-api/parameter-providers/apply-parameters-requests, it is expected " + @Operation( + summary = "Deletes the Apply Parameters Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), + description = "Deletes the Apply Parameters Request with the given ID. After a request is created via a POST to /nifi-api/parameter-providers/apply-parameters-requests, it is expected " + "that the client will properly clean up the request by DELETE'ing it, once the Apply process has completed. If the request is deleted before the request " + "completes, then the Apply Parameters Request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteApplyParametersRequest( - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam("The ID of the Parameter Provider") @PathParam("providerId") final String parameterProviderId, - @ApiParam("The ID of the Apply Parameters Request") @PathParam("requestId") final String applyParametersRequestId) { + @Parameter(description = "The ID of the Parameter Provider") @PathParam("providerId") final String parameterProviderId, + @Parameter(description = "The ID of the Apply Parameters Request") @PathParam("requestId") final String applyParametersRequestId) { authorizeReadParameterProvider(parameterProviderId); return deleteApplyParametersRequest("apply-parameters-requests", parameterProviderId, applyParametersRequestId, disconnectedNodeAcknowledged.booleanValue()); @@ -1089,25 +1081,25 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/analysis") - @ApiOperation( - value = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - response = ConfigurationAnalysisEntity.class, - authorizations = { - @Authorization(value = "Read - /parameter-providers/{uuid}") + @Operation( + summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response analyzeConfiguration( - @ApiParam(value = "The parameter provider id.", required = true) @PathParam("id") final String parameterProviderId, - @ApiParam(value = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { + @Parameter(description = "The parameter provider id.", required = true) @PathParam("id") final String parameterProviderId, + @Parameter(description = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { if (configurationAnalysis == null || configurationAnalysis.getConfigurationAnalysis() == null) { throw new IllegalArgumentException("Parameter Provider's configuration must be specified"); @@ -1137,7 +1129,8 @@ public class ParameterProviderResource extends AbstractParameterResource { final ComponentAuthorizable parameterProvider = lookup.getParameterProvider(parameterProviderId); parameterProvider.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); }, - () -> { }, + () -> { + }, entity -> { final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeParameterProviderConfiguration(analysis.getComponentId(), analysis.getProperties()); @@ -1150,30 +1143,31 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/verification-requests") - @ApiOperation( - value = "Performs verification of the Parameter Provider's configuration", - response = VerifyConfigRequestEntity.class, - notes = "This will initiate the process of verifying a given Parameter Provider configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + + @Operation( + summary = "Performs verification of the Parameter Provider's configuration", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "This will initiate the process of verifying a given Parameter Provider configuration. This may be a long-running task. As a result, this endpoint will immediately return " + + "a " + "ParameterProviderConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + "The client may then periodically poll the status of the request by " + "issuing a GET request to /parameter-providers/{serviceId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + "/parameter-providers/{providerId}/verification-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /parameter-providers/{uuid}") + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response submitConfigVerificationRequest( - @ApiParam(value = "The parameter provider id.", required = true) @PathParam("id") final String parameterProviderId, - @ApiParam(value = "The parameter provider configuration verification request.", required = true) final VerifyConfigRequestEntity parameterProviderConfigRequest) { + @Parameter(description = "The parameter provider id.", required = true) @PathParam("id") final String parameterProviderId, + @Parameter(description = "The parameter provider configuration verification request.", required = true) final VerifyConfigRequestEntity parameterProviderConfigRequest) { if (parameterProviderConfigRequest == null) { throw new IllegalArgumentException("Parameter Provider's configuration must be specified"); @@ -1216,25 +1210,28 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Returns the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + @Operation( + summary = "Returns the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getVerificationRequest( - @ApiParam("The ID of the Parameter Provider") @PathParam("id") final String parameterProviderId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Parameter Provider") @PathParam("id") final String parameterProviderId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -1254,25 +1251,28 @@ public class ParameterProviderResource extends AbstractParameterResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Deletes the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + @Operation( + summary = "Deletes the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteVerificationRequest( - @ApiParam("The ID of the Parameter Provider") @PathParam("id") final String parameterProviderId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Parameter Provider") @PathParam("id") final String parameterProviderId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -1432,7 +1432,7 @@ public class ParameterProviderResource extends AbstractParameterResource { final List parameterContextUpdates = new ArrayList<>(); applyParametersRequestDTO.setParameterContextUpdates(parameterContextUpdates); final List initialRequestList = asyncRequest.getRequest(); - for(final ParameterContextEntity parameterContextEntity : initialRequestList) { + for (final ParameterContextEntity parameterContextEntity : initialRequestList) { // The AffectedComponentEntity itself does not evaluate equality based on component information. As a result, we want to de-dupe the entities based on their identifiers. final Map affectedComponents = new HashMap<>(); for (final ParameterEntity entity : parameterContextEntity.getComponent().getParameters()) { @@ -1696,6 +1696,7 @@ public class ParameterProviderResource extends AbstractParameterResource { public void setAuthorizer(final Authorizer authorizer) { this.authorizer = authorizer; } + public ComponentLifecycle getClusterComponentLifecycle() { return clusterComponentLifecycle; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index cf4fa98e85..765a536f39 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -20,14 +20,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; + import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -41,6 +34,15 @@ import java.util.Objects; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -147,3381 +149,3273 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** -* RESTful endpoint for managing a Group. -*/ + * RESTful endpoint for managing a Group. + */ @Path("/process-groups") -@Api( - value = "/process-groups", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Process Group.") -}) +@Tag(name = "ProcessGroups") public class ProcessGroupResource extends FlowUpdateResource { - private static final Logger logger = LoggerFactory.getLogger(ProcessGroupResource.class); - - private static final String FLOW_ANALYSIS_REQUEST_TYPE = "flow-analysis-requests"; - - private ProcessorResource processorResource; - private InputPortResource inputPortResource; - private OutputPortResource outputPortResource; - private FunnelResource funnelResource; - private LabelResource labelResource; - private RemoteProcessGroupResource remoteProcessGroupResource; - private ConnectionResource connectionResource; - private ControllerServiceResource controllerServiceResource; - private ParameterContextReplacer parameterContextReplacer; - - - public RequestManager flowAnalysisAsyncRequestManager = - new AsyncRequestManager<>(100, TimeUnit.MINUTES.toMillis(1L), "On-demand Flow Analysis"); - - private static final ObjectMapper MAPPER = new ObjectMapper(); - static { - MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); - MAPPER.setDefaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL)); - MAPPER.setAnnotationIntrospector(new JakartaXmlBindAnnotationIntrospector(MAPPER.getTypeFactory())); - MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } - - /** - * Populates the remaining fields in the specified process groups. - * - * @param processGroupEntities groups - * @return group dto - */ - public Set populateRemainingProcessGroupEntitiesContent(Set processGroupEntities) { - for (ProcessGroupEntity processGroupEntity : processGroupEntities) { - populateRemainingProcessGroupEntityContent(processGroupEntity); - } - return processGroupEntities; - } - - /** - * Populates the remaining fields in the specified process group. - * - * @param processGroupEntity group - * @return group dto - */ - public ProcessGroupEntity populateRemainingProcessGroupEntityContent(ProcessGroupEntity processGroupEntity) { - processGroupEntity.setUri(generateResourceUri("process-groups", processGroupEntity.getId())); - return processGroupEntity; - } - - - /** - * Populates the remaining content of the specified snippet. - */ - private FlowDTO populateRemainingSnippetContent(FlowDTO flow) { - processorResource.populateRemainingProcessorEntitiesContent(flow.getProcessors()); - connectionResource.populateRemainingConnectionEntitiesContent(flow.getConnections()); - inputPortResource.populateRemainingInputPortEntitiesContent(flow.getInputPorts()); - outputPortResource.populateRemainingOutputPortEntitiesContent(flow.getOutputPorts()); - remoteProcessGroupResource.populateRemainingRemoteProcessGroupEntitiesContent(flow.getRemoteProcessGroups()); - funnelResource.populateRemainingFunnelEntitiesContent(flow.getFunnels()); - labelResource.populateRemainingLabelEntitiesContent(flow.getLabels()); - - // go through each process group child and populate its uri - if (flow.getProcessGroups() != null) { - populateRemainingProcessGroupEntitiesContent(flow.getProcessGroups()); - } - - return flow; - } - - /** - * Retrieves the contents of the specified group. - * - * @param groupId The id of the process group. - * @return A processGroupEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}") - @ApiOperation( - value = "Gets a process group", - response = ProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getProcessGroup( - @ApiParam( - value = "The process group id.", - required = false - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get this process group contents - final ProcessGroupEntity entity = serviceFacade.getProcessGroup(groupId); - populateRemainingProcessGroupEntityContent(entity); - - if (entity.getComponent() != null) { - entity.getComponent().setContents(null); - } - - return generateOkResponse(entity).build(); - } - - /** - * Retrieves the specified group as a versioned flow snapshot for download. - * - * @param groupId The id of the process group - * @return A processGroupEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/download") - @ApiOperation( - value = "Gets a process group for download", - response = String.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response exportProcessGroup( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "If referenced services from outside the target group should be included", - required = false - ) - @QueryParam("includeReferencedServices") - @DefaultValue("false") boolean includeReferencedServices) { - // authorize access - serviceFacade.authorizeAccess(lookup -> { - // ensure access to process groups (nested), encapsulated controller services and referenced parameter contexts - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.READ, true, - false, false, true); - }); - - // get the versioned flow - final RegisteredFlowSnapshot currentVersionedFlowSnapshot = includeReferencedServices - ? serviceFacade.getCurrentFlowSnapshotByGroupIdWithReferencedControllerServices(groupId) - : serviceFacade.getCurrentFlowSnapshotByGroupId(groupId); - - // determine the name of the attachment - possible issues with spaces in file names - final VersionedProcessGroup currentVersionedProcessGroup = currentVersionedFlowSnapshot.getFlowContents(); - final String flowName = currentVersionedProcessGroup.getName(); - final String filename = flowName.replaceAll("\\s", "_") + ".json"; - - return generateOkResponse(currentVersionedFlowSnapshot).header(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=\"%s\"", filename)).build(); - } - - /** - * Retrieves a list of local modifications to the Process Group since it was last synchronized with the Flow Registry - * - * @param groupId The id of the process group. - * @return A processGroupEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/local-modifications") - @ApiOperation( - value = "Gets a list of local modifications to the Process Group since it was last synchronized with the Flow Registry", - response = FlowComparisonEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}"), - @Authorization(value = "Read - /{component-type}/{uuid} - For all encapsulated components") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getLocalModifications( - @ApiParam( - value = "The process group id.", - required = false - ) - @PathParam("id") final String groupId) throws IOException, NiFiRegistryException { - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.READ, false, false, false, false); - }); - - final FlowComparisonEntity entity = serviceFacade.getLocalModifications(groupId); - return generateOkResponse(entity).build(); - } - - /** - * Updates the specified process group. - * - * @param httpServletRequest request - * @param id The id of the process group. - * @param requestProcessGroupEntity A processGroupEntity. - * @return A processGroupEntity or the parent processGroupEntity for recursive requests. - */ - @PUT - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}") - @ApiOperation( - value = "Updates a process group", - response = ProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response updateProcessGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String id, - @ApiParam( - value = "The process group configuration details.", - required = true - ) final ProcessGroupEntity requestProcessGroupEntity) { - - if (requestProcessGroupEntity == null || requestProcessGroupEntity.getComponent() == null) { - throw new IllegalArgumentException("Process group details must be specified."); - } - - if (requestProcessGroupEntity.getRevision() == null) { - throw new IllegalArgumentException("Revision must be specified."); - } - - // ensure the same id is being used - final ProcessGroupDTO requestProcessGroupDTO = requestProcessGroupEntity.getComponent(); - if (!id.equals(requestProcessGroupDTO.getId())) { - throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does " - + "not equal the process group id of the requested resource (%s).", requestProcessGroupDTO.getId(), id)); - } - - final PositionDTO proposedPosition = requestProcessGroupDTO.getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - final String processGroupUpdateStrategy = requestProcessGroupEntity.getProcessGroupUpdateStrategy(); - final ProcessGroupRecursivity updateStrategy; - if (processGroupUpdateStrategy == null) { - updateStrategy = ProcessGroupRecursivity.DIRECT_CHILDREN; - } else { - updateStrategy = ProcessGroupRecursivity.valueOf(processGroupUpdateStrategy); - } - - final String executionEngine = requestProcessGroupDTO.getExecutionEngine(); - if (executionEngine != null) { - try { - ExecutionEngine.valueOf(executionEngine); - } catch (final IllegalArgumentException iae) { - throw new IllegalArgumentException("Illegal value proposed for Execution Engine: " + executionEngine); - } - } - - final String statelessTimeout = requestProcessGroupDTO.getStatelessFlowTimeout(); - if (statelessTimeout != null) { - try { - FormatUtils.getPreciseTimeDuration(statelessTimeout, TimeUnit.MILLISECONDS); - } catch (final Exception e) { - throw new IllegalArgumentException("Illegal value proposed for Stateless Flow Timeout: " + statelessTimeout); - } - } - - final Integer maxConcurrentTasks = requestProcessGroupDTO.getMaxConcurrentTasks(); - if (maxConcurrentTasks != null && maxConcurrentTasks < 1) { - throw new IllegalArgumentException("Illegal value proposed for Max Concurrent Tasks: " + maxConcurrentTasks); - } - - if (isReplicateRequest()) { - return replicate(HttpMethod.PUT, requestProcessGroupEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestProcessGroupEntity.isDisconnectedNodeAcknowledged()); - } - - // handle expects request (usually from the cluster manager) - final ParameterContextReferenceEntity requestParamContext = requestProcessGroupDTO.getParameterContext(); - final String requestGroupId = requestProcessGroupDTO.getId(); - final Map updatableProcessGroups = new HashMap<>(); - - updatableProcessGroups.put(requestProcessGroupEntity, getRevision(requestProcessGroupEntity, requestGroupId)); - - if (updateStrategy == ProcessGroupRecursivity.ALL_DESCENDANTS) { - for (ProcessGroupEntity processGroupEntity : serviceFacade.getProcessGroups(requestGroupId, updateStrategy)) { - final ProcessGroupDTO processGroupDTO = processGroupEntity.getComponent(); - final String processGroupId = processGroupDTO == null ? processGroupEntity.getId() : processGroupDTO.getId(); - if (processGroupDTO != null) { - processGroupDTO.setParameterContext(requestParamContext); - } - updatableProcessGroups.put(processGroupEntity, getRevision(processGroupEntity, processGroupId)); - } - } - - return withWriteLock( - serviceFacade, - requestProcessGroupEntity, - new HashSet<>(updatableProcessGroups.values()), - lookup -> { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - - for (final ProcessGroupEntity updatableGroupEntity : updatableProcessGroups.keySet()) { - final ProcessGroupDTO updatableGroupDto = updatableGroupEntity.getComponent(); - final String groupId = updatableGroupDto == null ? updatableGroupEntity.getId() : updatableGroupDto.getId(); - - Authorizable authorizable = lookup.getProcessGroup(groupId).getAuthorizable(); - authorizable.authorize(authorizer, RequestAction.WRITE, user); - - // Ensure that user has READ permission on current Parameter Context (if any) because user is un-binding. - final ParameterContextReferenceEntity referencedParamContext = updatableGroupDto.getParameterContext(); - if (referencedParamContext != null) { - // Lookup the current Parameter Context and determine whether or not the Parameter Context is changing - final ProcessGroupEntity currentGroupEntity = serviceFacade.getProcessGroup(groupId); - final ProcessGroupDTO groupDto = currentGroupEntity.getComponent(); - final ParameterContextReferenceEntity currentParamContext = groupDto.getParameterContext(); - final String currentParamContextId = currentParamContext == null ? null : currentParamContext.getId(); - final boolean parameterContextChanging = !Objects.equals(referencedParamContext.getId(), currentParamContextId); - - // If Parameter Context is changing... - if (parameterContextChanging) { - // In order to bind to a Parameter Context, the user must have the READ policy to that Parameter Context. - if (referencedParamContext.getId() != null) { - lookup.getParameterContext(referencedParamContext.getId()).authorize(authorizer, RequestAction.READ, user); - } - - // If currently referencing a Parameter Context, we must authorize that the user has READ permissions on the Parameter Context in order to un-bind to it. - if (currentParamContextId != null) { - lookup.getParameterContext(currentParamContextId).authorize(authorizer, RequestAction.READ, user); - } - - // Because the user will be changing the behavior of any component in this group that is currently referencing any Parameter, we must ensure that the user has - // both READ and WRITE policies for each of those components. - for (final AffectedComponentEntity affectedComponentEntity : serviceFacade.getProcessorsReferencingParameter(groupId)) { - final Authorizable processorAuthorizable = lookup.getProcessor(affectedComponentEntity.getId()).getAuthorizable(); - processorAuthorizable.authorize(authorizer, RequestAction.READ, user); - processorAuthorizable.authorize(authorizer, RequestAction.WRITE, user); - } - - for (final AffectedComponentEntity affectedComponentEntity : serviceFacade.getControllerServicesReferencingParameter(groupId)) { - final Authorizable serviceAuthorizable = lookup.getControllerService(affectedComponentEntity.getId()).getAuthorizable(); - serviceAuthorizable.authorize(authorizer, RequestAction.READ, user); - serviceAuthorizable.authorize(authorizer, RequestAction.WRITE, user); - } - } - } - } - }, - () -> { - for (final ProcessGroupEntity entity : updatableProcessGroups.keySet()) { - serviceFacade.verifyUpdateProcessGroup(entity.getComponent()); - } - }, - (revisions, entities) -> { - ProcessGroupEntity responseEntity = null; - for (Map.Entry entry : updatableProcessGroups.entrySet()) { - // update the process group - final Revision revision = entry.getValue(); - final ProcessGroupDTO groupDTO = entry.getKey().getComponent(); - final ProcessGroupEntity entity = serviceFacade.updateProcessGroup(revision, groupDTO); - - if (requestGroupId.equals(entity.getId())) { - responseEntity = entity; - populateRemainingProcessGroupEntityContent(responseEntity); - - // prune response as necessary - if (responseEntity.getComponent() != null) { - responseEntity.getComponent().setContents(null); - } - } - } - return generateOkResponse(responseEntity).build(); - } - ); - } - - /** - * Extracts the response entity from the specified node response. - * - * @param nodeResponse node response - * @param clazz class - * @param type of class - * @return the response entity - */ - @Override - @SuppressWarnings("unchecked") - protected T getResponseEntity(final NodeResponse nodeResponse, final Class clazz) { - T entity = (T) nodeResponse.getUpdatedEntity(); - if (entity == null) { - entity = nodeResponse.getClientResponse().readEntity(clazz); - } - return entity; - } - - /** - * Creates a request to drop the flowfiles from all connection queues within a process group (recursively). - * - * @param httpServletRequest request - * @param processGroupId The id of the process group to be removed. - * @return A dropRequestEntity. - */ - @POST - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/empty-all-connections-requests") - @ApiOperation( - value = "Creates a request to drop all flowfiles of all connection queues in this process group.", - response = DropRequestEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid} - For this and all encapsulated process groups"), - @Authorization(value = "Write Source Data - /data/{component-type}/{uuid} - For all encapsulated connections") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 202, message = "The request has been accepted. An HTTP response header will contain the URI where the status can be polled."), - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createEmptyAllConnectionsRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String processGroupId - ) { - if (isReplicateRequest()) { - return replicate(HttpMethod.POST); - } - - final ProcessGroupEntity requestProcessGroupEntity = new ProcessGroupEntity(); - requestProcessGroupEntity.setId(processGroupId); - - return withWriteLock( - serviceFacade, - requestProcessGroupEntity, - lookup -> authorizeHandleDropAllFlowFilesRequest(processGroupId, lookup), - null, - (processGroupEntity) -> { - // ensure the id is the same across the cluster - final String dropRequestId = generateUuid(); - - // submit the drop request - final DropRequestDTO dropRequest = serviceFacade.createDropAllFlowFilesInProcessGroup(processGroupEntity.getId(), dropRequestId); - dropRequest.setUri(generateResourceUri("process-groups", processGroupEntity.getId(), "empty-all-connections-requests", dropRequest.getId())); - - // create the response entity - final DropRequestEntity entity = new DropRequestEntity(); - entity.setDropRequest(dropRequest); - - // generate the URI where the response will be - final URI location = URI.create(dropRequest.getUri()); - return Response.status(Status.ACCEPTED).location(location).entity(entity).build(); - } - ); - } - - /** - * Checks the status of an outstanding request for dropping all flowfiles within a process group. - * - * @param processGroupId The id of the process group - * @param dropRequestId The id of the drop request - * @return A dropRequestEntity - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/empty-all-connections-requests/{drop-request-id}") - @ApiOperation( - value = "Gets the current status of a drop all flowfiles request.", - response = DropRequestEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid} - For this and all encapsulated process groups"), - @Authorization(value = "Write Source Data - /data/{component-type}/{uuid} - For all encapsulated connections") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getDropAllFlowfilesRequest( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String processGroupId, - @ApiParam( - value = "The drop request id.", - required = true - ) - @PathParam("drop-request-id") final String dropRequestId - ) { - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> authorizeHandleDropAllFlowFilesRequest(processGroupId, lookup)); - - // get the drop request - final DropRequestDTO dropRequest = serviceFacade.getDropAllFlowFilesRequest(processGroupId, dropRequestId); - dropRequest.setUri(generateResourceUri("process-groups", processGroupId, "empty-all-connections-requests", dropRequest.getId())); - - // create the response entity - final DropRequestEntity entity = new DropRequestEntity(); - entity.setDropRequest(dropRequest); - - return generateOkResponse(entity).build(); - } - - /** - * Cancels the specified request for dropping all flowfiles within a process group. - * - * @param httpServletRequest request - * @param processGroupId The process group id - * @param dropRequestId The drop request id - * @return A dropRequestEntity - */ - @DELETE - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/empty-all-connections-requests/{drop-request-id}") - @ApiOperation( - value = "Cancels and/or removes a request to drop all flowfiles.", - response = DropRequestEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid} - For this and all encapsulated process groups"), - @Authorization(value = "Write Source Data - /data/{component-type}/{uuid} - For all encapsulated connections") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response removeDropRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String processGroupId, - @ApiParam( - value = "The drop request id.", - required = true - ) - @PathParam("drop-request-id") final String dropRequestId - ) { - if (isReplicateRequest()) { - return replicate(HttpMethod.DELETE); - } - - return withWriteLock( - serviceFacade, - new DropEntity(processGroupId, dropRequestId), - lookup -> authorizeHandleDropAllFlowFilesRequest(processGroupId, lookup), - null, - (dropEntity) -> { - // delete the drop request - final DropRequestDTO dropRequest = serviceFacade.deleteDropAllFlowFilesRequest(dropEntity.getEntityId(), dropEntity.getDropRequestId()); - dropRequest.setUri(generateResourceUri("process-groups", dropEntity.getEntityId(), "empty-all-connections-requests", dropRequest.getId())); - - // create the response entity - final DropRequestEntity entity = new DropRequestEntity(); - entity.setDropRequest(dropRequest); - - return generateOkResponse(entity).build(); - } - ); - } - - private void authorizeHandleDropAllFlowFilesRequest(String processGroupId, AuthorizableLookup lookup) { - final ProcessGroupAuthorizable processGroup = lookup.getProcessGroup(processGroupId); - - authorizeProcessGroup(processGroup, authorizer, lookup, RequestAction.READ, false, false, false, false); - - processGroup.getEncapsulatedProcessGroups() - .forEach(encapsulatedProcessGroup -> authorizeProcessGroup(encapsulatedProcessGroup, authorizer, lookup, RequestAction.READ, false, false, false, false)); - - processGroup.getEncapsulatedConnections().stream() - .map(ConnectionAuthorizable::getSourceData) - .forEach(connectionSourceData -> connectionSourceData.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser())); - } - - /** - * Removes the specified process group reference. - * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the process group to be removed. - * @return A processGroupEntity. - */ - @DELETE - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}") - @ApiOperation( - value = "Deletes a process group", - response = ProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services by any encapsulated components - /controller-services/{uuid}"), - @Authorization(value = "Write - /{component-type}/{uuid} - For all encapsulated components") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response removeProcessGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false - ) - @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false - ) - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false - ) - @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String id) { - - // replicate if cluster manager - if (isReplicateRequest()) { - return replicate(HttpMethod.DELETE); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(disconnectedNodeAcknowledged); - } - - final ProcessGroupEntity requestProcessGroupEntity = new ProcessGroupEntity(); - requestProcessGroupEntity.setId(id); - - // handle expects request (usually from the cluster manager) - final Revision requestRevision = new Revision(version == null ? null : version.getLong(), clientId.getClientId(), id); - return withWriteLock( - serviceFacade, - requestProcessGroupEntity, - requestRevision, - lookup -> { - final ProcessGroupAuthorizable processGroupAuthorizable = lookup.getProcessGroup(id); - - // ensure write to this process group and all encapsulated components including controller services. additionally, ensure - // read to any referenced services by encapsulated components - authorizeProcessGroup(processGroupAuthorizable, authorizer, lookup, RequestAction.WRITE, true, true, false, false); - - // ensure write permission to the parent process group, if applicable... if this is the root group the - // request will fail later but still need to handle authorization here - final Authorizable parentAuthorizable = processGroupAuthorizable.getAuthorizable().getParentAuthorizable(); - if (parentAuthorizable != null) { - parentAuthorizable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - } - }, - () -> serviceFacade.verifyDeleteProcessGroup(id), - (revision, processGroupEntity) -> { - // delete the process group - final ProcessGroupEntity entity = serviceFacade.deleteProcessGroup(revision, processGroupEntity.getId()); - - // prune response as necessary - if (entity.getComponent() != null) { - entity.getComponent().setContents(null); - } - - // create the response - return generateOkResponse(entity).build(); - } - ); - } - - /** - * Adds the specified process group. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestProcessGroupEntity A processGroupEntity - * @return A processGroupEntity - * @throws IOException if the request indicates that the Process Group should be imported from a Flow Registry and NiFi is unable to communicate with the Flow Registry - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/process-groups") - @ApiOperation( - value = "Creates a process group", - response = ProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createProcessGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The process group configuration details.", - required = true - ) - final ProcessGroupEntity requestProcessGroupEntity, - @ApiParam( - value = "Handling Strategy controls whether to keep or replace Parameter Contexts", - defaultValue = "KEEP_EXISTING" - ) - @QueryParam("parameterContextHandlingStrategy") - @DefaultValue("KEEP_EXISTING") - final ParameterContextHandlingStrategy parameterContextHandlingStrategy - ) { - if (requestProcessGroupEntity == null || requestProcessGroupEntity.getComponent() == null) { - throw new IllegalArgumentException("Process group details must be specified."); - } - - if (requestProcessGroupEntity.getRevision() == null || (requestProcessGroupEntity.getRevision().getVersion() == null || requestProcessGroupEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Process group."); - } - - if (requestProcessGroupEntity.getComponent().getId() != null) { - throw new IllegalArgumentException("Process group ID cannot be specified."); - } - - final PositionDTO proposedPosition = requestProcessGroupEntity.getComponent().getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - // if the group name isn't specified, ensure the group is being imported from version control - if (StringUtils.isBlank(requestProcessGroupEntity.getComponent().getName()) && requestProcessGroupEntity.getComponent().getVersionControlInformation() == null) { - throw new IllegalArgumentException("The group name is required when the group is not imported from version control."); - } - - if (requestProcessGroupEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestProcessGroupEntity.getComponent().getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestProcessGroupEntity.getComponent().getParentGroupId(), groupId)); - } - requestProcessGroupEntity.getComponent().setParentGroupId(groupId); - - // Step 1: Ensure that user has write permissions to the Process Group. If not, then immediately fail. - // Step 2: Retrieve flow from Flow Registry - // Step 3: Resolve Bundle info - // Step 4: Update contents of the ProcessGroupDTO passed in to include the components that need to be added. - // Step 5: If any of the components is a Restricted Component, then we must authorize the user - // for write access to the RestrictedComponents resource - // Step 6: Replicate the request or call serviceFacade.updateProcessGroup - - final VersionControlInformationDTO versionControlInfo = requestProcessGroupEntity.getComponent().getVersionControlInformation(); - if (versionControlInfo != null && requestProcessGroupEntity.getVersionedFlowSnapshot() == null) { - // Step 1: Ensure that user has write permissions to the Process Group. If not, then immediately fail. - // Step 2: Retrieve flow from Flow Registry - final FlowSnapshotContainer flowSnapshotContainer = getFlowFromRegistry(versionControlInfo); - final RegisteredFlowSnapshot flowSnapshot = flowSnapshotContainer.getFlowSnapshot(); - - // Step 3: Enrich version control info came from UI - if (flowSnapshot.getFlowContents() != null) { - final VersionedFlowCoordinates versionedFlowCoordinates = flowSnapshot.getFlowContents().getVersionedFlowCoordinates(); - if (versionedFlowCoordinates != null) { - versionControlInfo.setStorageLocation(versionedFlowCoordinates.getStorageLocation()); - } - } - - // Step 4: Replace parameter contexts if necessary - if (ParameterContextHandlingStrategy.REPLACE.equals(parameterContextHandlingStrategy)) { - parameterContextReplacer.replaceParameterContexts(flowSnapshot, serviceFacade.getParameterContexts()); - } - - // Step 5: Resolve Bundle info - serviceFacade.discoverCompatibleBundles(flowSnapshot.getFlowContents()); - - // If there are any Controller Services referenced that are inherited from the parent group, resolve those to point to the appropriate Controller Service, if we are able to. - serviceFacade.resolveInheritedControllerServices(flowSnapshotContainer, groupId, NiFiUserUtils.getNiFiUser()); - - // If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to. - serviceFacade.resolveParameterProviders(flowSnapshot, NiFiUserUtils.getNiFiUser()); - - // Step 6: Update contents of the ProcessGroupDTO passed in to include the components that need to be added. - requestProcessGroupEntity.setVersionedFlowSnapshot(flowSnapshot); - } - - if (versionControlInfo != null) { - final RegisteredFlowSnapshot flowSnapshot = requestProcessGroupEntity.getVersionedFlowSnapshot(); - serviceFacade.verifyImportProcessGroup(versionControlInfo, flowSnapshot.getFlowContents(), groupId); - } - - // Step 7: Replicate the request or call serviceFacade.updateProcessGroup - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestProcessGroupEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestProcessGroupEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestProcessGroupEntity, - lookup -> authorizeAccess(groupId, requestProcessGroupEntity, lookup), - () -> { - final RegisteredFlowSnapshot versionedFlowSnapshot = requestProcessGroupEntity.getVersionedFlowSnapshot(); - if (versionedFlowSnapshot != null) { - serviceFacade.verifyComponentTypes(versionedFlowSnapshot.getFlowContents()); - } - }, - processGroupEntity -> { - final ProcessGroupDTO processGroup = processGroupEntity.getComponent(); - - // set the processor id as appropriate - processGroup.setId(generateUuid()); - - // ensure the group name comes from the versioned flow - final RegisteredFlowSnapshot flowSnapshot = processGroupEntity.getVersionedFlowSnapshot(); - if (flowSnapshot != null && StringUtils.isNotBlank(flowSnapshot.getFlowContents().getName()) && StringUtils.isBlank(processGroup.getName())) { - processGroup.setName(flowSnapshot.getFlowContents().getName()); - } - - // create the process group contents - final Revision revision = getRevision(processGroupEntity, processGroup.getId()); - ProcessGroupEntity entity = serviceFacade.createProcessGroup(revision, groupId, processGroup); - - if (flowSnapshot != null) { - final RevisionDTO revisionDto = entity.getRevision(); - final String newGroupId = entity.getComponent().getId(); - final Revision newGroupRevision = new Revision(revisionDto.getVersion(), revisionDto.getClientId(), newGroupId); - - // We don't want the Process Group's position to be updated because we want to keep the position where the user - // placed the Process Group. However, we do want to use the name of the Process Group that is in the Flow Contents. - // To accomplish this, we call updateProcessGroupContents() passing 'true' for the updateSettings flag but null out the position. - flowSnapshot.getFlowContents().setPosition(null); - entity = serviceFacade.updateProcessGroupContents(newGroupRevision, newGroupId, versionControlInfo, flowSnapshot, - getIdGenerationSeed().orElse(null), false, true, true); - } - - populateRemainingProcessGroupEntityContent(entity); - - // generate a 201 created response - String uri = entity.getUri(); - return generateCreatedResponse(URI.create(uri), entity).build(); - } - ); - } - - private FlowSnapshotContainer getFlowFromRegistry(final VersionControlInformationDTO versionControlInfo) { - final FlowSnapshotContainer flowSnapshotContainer = serviceFacade.getVersionedFlowSnapshot(versionControlInfo, true); - final RegisteredFlowSnapshot flowSnapshot = flowSnapshotContainer.getFlowSnapshot(); - final FlowRegistryBucket bucket = flowSnapshot.getBucket(); - final RegisteredFlow flow = flowSnapshot.getFlow(); - - versionControlInfo.setBucketName(bucket.getName()); - versionControlInfo.setFlowName(flow.getName()); - versionControlInfo.setFlowDescription(flow.getDescription()); - - versionControlInfo.setRegistryName(serviceFacade.getFlowRegistryName(versionControlInfo.getRegistryId())); - final VersionedFlowState flowState = flowSnapshot.isLatest() ? VersionedFlowState.UP_TO_DATE : VersionedFlowState.STALE; - versionControlInfo.setState(flowState.name()); - - return flowSnapshotContainer; - } - - - /** - * Retrieves all the child process groups of the process group with the given id. - * - * @param groupId the parent process group id - * @return An entity containing all the child process group entities. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/process-groups") - @ApiOperation( - value = "Gets all process groups", - response = ProcessGroupsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getProcessGroups( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get the process groups - final Set entities = serviceFacade.getProcessGroups(groupId, ProcessGroupRecursivity.DIRECT_CHILDREN); - - // always prune the contents - for (final ProcessGroupEntity entity : entities) { - if (entity.getComponent() != null) { - entity.getComponent().setContents(null); - } - } - - // create the response entity - final ProcessGroupsEntity entity = new ProcessGroupsEntity(); - entity.setProcessGroups(populateRemainingProcessGroupEntitiesContent(entities)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ---------- - // processors - // ---------- - - /** - * Creates a new processor. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestProcessorEntity A processorEntity. - * @return A processorEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/processors") - @ApiOperation( - value = "Creates a new processor", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @Authorization(value = "Write - if the Processor is restricted - /restricted-components") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createProcessor( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The processor configuration details.", - required = true - ) final ProcessorEntity requestProcessorEntity) { - - if (requestProcessorEntity == null || requestProcessorEntity.getComponent() == null) { - throw new IllegalArgumentException("Processor details must be specified."); - } - - if (requestProcessorEntity.getRevision() == null || (requestProcessorEntity.getRevision().getVersion() == null || requestProcessorEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Processor."); - } - - final ProcessorDTO requestProcessor = requestProcessorEntity.getComponent(); - if (requestProcessor.getId() != null) { - throw new IllegalArgumentException("Processor ID cannot be specified."); - } - - if (StringUtils.isBlank(requestProcessor.getType())) { - throw new IllegalArgumentException("The type of processor to create must be specified."); - } - - final PositionDTO proposedPosition = requestProcessor.getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - if (requestProcessor.getParentGroupId() != null && !groupId.equals(requestProcessor.getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestProcessor.getParentGroupId(), groupId)); - } - requestProcessor.setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestProcessorEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestProcessorEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestProcessorEntity, - lookup -> { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - final Authorizable processGroup = groupAuthorizable.getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, user); - - final Authorizable parameterContext = groupAuthorizable.getProcessGroup().getParameterContext(); - final ProcessorConfigDTO configDto = requestProcessor.getConfig(); - if (parameterContext != null && configDto != null) { - AuthorizeParameterReference.authorizeParameterReferences(configDto.getProperties(), authorizer, parameterContext, user); - } - - ComponentAuthorizable authorizable = null; - try { - authorizable = lookup.getConfigurableComponent(requestProcessor.getType(), requestProcessor.getBundle()); - - if (authorizable.isRestricted()) { - authorizeRestrictions(authorizer, authorizable); - } - - final ProcessorConfigDTO config = requestProcessor.getConfig(); - if (config != null && config.getProperties() != null) { - AuthorizeControllerServiceReference.authorizeControllerServiceReferences(config.getProperties(), authorizable, authorizer, lookup); - } - } finally { - if (authorizable != null) { - authorizable.cleanUpResources(); - } - } - }, - () -> serviceFacade.verifyCreateProcessor(requestProcessor), - processorEntity -> { - final ProcessorDTO processor = processorEntity.getComponent(); - - // set the processor id as appropriate - processor.setId(generateUuid()); - - // create the new processor - final Revision revision = getRevision(processorEntity, processor.getId()); - final ProcessorEntity entity = serviceFacade.createProcessor(revision, groupId, processor); - processorResource.populateRemainingProcessorEntityContent(entity); - - // generate a 201 created response - String uri = entity.getUri(); - return generateCreatedResponse(URI.create(uri), entity).build(); - } - ); - } - - /** - * Retrieves all the processors in this NiFi. - * - * @param groupId group id - * @return A processorsEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/processors") - @ApiOperation( - value = "Gets all processors", - response = ProcessorsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getProcessors( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam("Whether or not to include processors from descendant process groups") @QueryParam("includeDescendantGroups") @DefaultValue("false") boolean includeDescendantGroups) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get the processors - final Set processors = serviceFacade.getProcessors(groupId, includeDescendantGroups); - - // create the response entity - final ProcessorsEntity entity = new ProcessorsEntity(); - entity.setProcessors(processorResource.populateRemainingProcessorEntitiesContent(processors)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ----------- - // input ports - // ----------- - - /** - * Creates a new input port. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestPortEntity A inputPortEntity. - * @return A inputPortEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/input-ports") - @ApiOperation( - value = "Creates an input port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createInputPort( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The input port configuration details.", - required = true - ) final PortEntity requestPortEntity) { - - if (requestPortEntity == null || requestPortEntity.getComponent() == null) { - throw new IllegalArgumentException("Port details must be specified."); - } - - if (requestPortEntity.getRevision() == null || (requestPortEntity.getRevision().getVersion() == null || requestPortEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Input port."); - } - - if (requestPortEntity.getComponent().getId() != null) { - throw new IllegalArgumentException("Input port ID cannot be specified."); - } - - final PositionDTO proposedPosition = requestPortEntity.getComponent().getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - if (requestPortEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestPortEntity.getComponent().getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestPortEntity.getComponent().getParentGroupId(), groupId)); - } - requestPortEntity.getComponent().setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestPortEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestPortEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestPortEntity, - lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - null, - portEntity -> { - // set the processor id as appropriate - portEntity.getComponent().setId(generateUuid()); - - // create the input port and generate the json - final Revision revision = getRevision(portEntity, portEntity.getComponent().getId()); - final PortEntity entity = serviceFacade.createInputPort(revision, groupId, portEntity.getComponent()); - inputPortResource.populateRemainingInputPortEntityContent(entity); - - // build the response - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } - ); - } - - /** - * Retrieves all the of input ports in this NiFi. - * - * @return A inputPortsEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/input-ports") - @ApiOperation( - value = "Gets all input ports", - response = InputPortsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getInputPorts( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get all the input ports - final Set inputPorts = serviceFacade.getInputPorts(groupId); - - final InputPortsEntity entity = new InputPortsEntity(); - entity.setInputPorts(inputPortResource.populateRemainingInputPortEntitiesContent(inputPorts)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ------------ - // output ports - // ------------ - - /** - * Creates a new output port. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestPortEntity A outputPortEntity. - * @return A outputPortEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/output-ports") - @ApiOperation( - value = "Creates an output port", - response = PortEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createOutputPort( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The output port configuration.", - required = true - ) final PortEntity requestPortEntity) { - - if (requestPortEntity == null || requestPortEntity.getComponent() == null) { - throw new IllegalArgumentException("Port details must be specified."); - } - - if (requestPortEntity.getRevision() == null || (requestPortEntity.getRevision().getVersion() == null || requestPortEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Output port."); - } - - if (requestPortEntity.getComponent().getId() != null) { - throw new IllegalArgumentException("Output port ID cannot be specified."); - } - - final PositionDTO proposedPosition = requestPortEntity.getComponent().getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - if (requestPortEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestPortEntity.getComponent().getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestPortEntity.getComponent().getParentGroupId(), groupId)); - } - requestPortEntity.getComponent().setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestPortEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestPortEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestPortEntity, - lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - null, - portEntity -> { - // set the processor id as appropriate - portEntity.getComponent().setId(generateUuid()); - - // create the output port and generate the json - final Revision revision = getRevision(portEntity, portEntity.getComponent().getId()); - final PortEntity entity = serviceFacade.createOutputPort(revision, groupId, portEntity.getComponent()); - outputPortResource.populateRemainingOutputPortEntityContent(entity); - - // build the response - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } - ); - } - - /** - * Retrieves all the of output ports in this NiFi. - * - * @return A outputPortsEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/output-ports") - @ApiOperation( - value = "Gets all output ports", - response = OutputPortsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getOutputPorts( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get all the output ports - final Set outputPorts = serviceFacade.getOutputPorts(groupId); - - // create the response entity - final OutputPortsEntity entity = new OutputPortsEntity(); - entity.setOutputPorts(outputPortResource.populateRemainingOutputPortEntitiesContent(outputPorts)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ------- - // funnels - // ------- - - /** - * Creates a new Funnel. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestFunnelEntity A funnelEntity. - * @return A funnelEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/funnels") - @ApiOperation( - value = "Creates a funnel", - response = FunnelEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createFunnel( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The funnel configuration details.", - required = true - ) final FunnelEntity requestFunnelEntity) { - - if (requestFunnelEntity == null || requestFunnelEntity.getComponent() == null) { - throw new IllegalArgumentException("Funnel details must be specified."); - } - - if (requestFunnelEntity.getRevision() == null || (requestFunnelEntity.getRevision().getVersion() == null || requestFunnelEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Funnel."); - } - - if (requestFunnelEntity.getComponent().getId() != null) { - throw new IllegalArgumentException("Funnel ID cannot be specified."); - } - - final PositionDTO proposedPosition = requestFunnelEntity.getComponent().getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - if (requestFunnelEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestFunnelEntity.getComponent().getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestFunnelEntity.getComponent().getParentGroupId(), groupId)); - } - requestFunnelEntity.getComponent().setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestFunnelEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestFunnelEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestFunnelEntity, - lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - null, - funnelEntity -> { - // set the processor id as appropriate - funnelEntity.getComponent().setId(generateUuid()); - - // create the funnel and generate the json - final Revision revision = getRevision(funnelEntity, funnelEntity.getComponent().getId()); - final FunnelEntity entity = serviceFacade.createFunnel(revision, groupId, funnelEntity.getComponent()); - funnelResource.populateRemainingFunnelEntityContent(entity); - - // build the response - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } - ); - } - - /** - * Retrieves all the of funnels in this NiFi. - * - * @return A funnelsEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/funnels") - @ApiOperation( - value = "Gets all funnels", - response = FunnelsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getFunnels( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get all the funnels - final Set funnels = serviceFacade.getFunnels(groupId); - - // create the response entity - final FunnelsEntity entity = new FunnelsEntity(); - entity.setFunnels(funnelResource.populateRemainingFunnelEntitiesContent(funnels)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ------ - // labels - // ------ - - /** - * Creates a new Label. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestLabelEntity A labelEntity. - * @return A labelEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/labels") - @ApiOperation( - value = "Creates a label", - response = LabelEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createLabel( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The label configuration details.", - required = true - ) final LabelEntity requestLabelEntity) { - - if (requestLabelEntity == null || requestLabelEntity.getComponent() == null) { - throw new IllegalArgumentException("Label details must be specified."); - } - - if (requestLabelEntity.getRevision() == null || (requestLabelEntity.getRevision().getVersion() == null || requestLabelEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Label."); - } - - if (requestLabelEntity.getComponent().getId() != null) { - throw new IllegalArgumentException("Label ID cannot be specified."); - } - - final PositionDTO proposedPosition = requestLabelEntity.getComponent().getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - if (requestLabelEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestLabelEntity.getComponent().getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestLabelEntity.getComponent().getParentGroupId(), groupId)); - } - requestLabelEntity.getComponent().setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestLabelEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestLabelEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestLabelEntity, - lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - null, - labelEntity -> { - // set the processor id as appropriate - labelEntity.getComponent().setId(generateUuid()); - - // create the label and generate the json - final Revision revision = getRevision(labelEntity, labelEntity.getComponent().getId()); - final LabelEntity entity = serviceFacade.createLabel(revision, groupId, labelEntity.getComponent()); - labelResource.populateRemainingLabelEntityContent(entity); - - // build the response - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } - ); - } - - /** - * Retrieves all the of labels in this NiFi. - * - * @return A labelsEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/labels") - @ApiOperation( - value = "Gets all labels", - response = LabelsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getLabels( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get all the labels - final Set labels = serviceFacade.getLabels(groupId); - - // create the response entity - final LabelsEntity entity = new LabelsEntity(); - entity.setLabels(labelResource.populateRemainingLabelEntitiesContent(labels)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // --------------------- - // remote process groups - // --------------------- - - /** - * Creates a new remote process group. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestRemoteProcessGroupEntity A remoteProcessGroupEntity. - * @return A remoteProcessGroupEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/remote-process-groups") - @ApiOperation( - value = "Creates a new process group", - response = RemoteProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createRemoteProcessGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The remote process group configuration details.", - required = true - ) final RemoteProcessGroupEntity requestRemoteProcessGroupEntity) { - - if (requestRemoteProcessGroupEntity == null || requestRemoteProcessGroupEntity.getComponent() == null) { - throw new IllegalArgumentException("Remote process group details must be specified."); - } - - if (requestRemoteProcessGroupEntity.getRevision() == null - || (requestRemoteProcessGroupEntity.getRevision().getVersion() == null || requestRemoteProcessGroupEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Remote process group."); - } - - final RemoteProcessGroupDTO requestRemoteProcessGroupDTO = requestRemoteProcessGroupEntity.getComponent(); - - if (requestRemoteProcessGroupDTO.getId() != null) { - throw new IllegalArgumentException("Remote process group ID cannot be specified."); - } - - if (requestRemoteProcessGroupDTO.getTargetUri() == null) { - throw new IllegalArgumentException("The URI of the process group must be specified."); - } - - final PositionDTO proposedPosition = requestRemoteProcessGroupDTO.getPosition(); - if (proposedPosition != null) { - if (proposedPosition.getX() == null || proposedPosition.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); - } - } - - if (requestRemoteProcessGroupDTO.getParentGroupId() != null && !groupId.equals(requestRemoteProcessGroupDTO.getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestRemoteProcessGroupDTO.getParentGroupId(), groupId)); - } - requestRemoteProcessGroupDTO.setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestRemoteProcessGroupEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestRemoteProcessGroupEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestRemoteProcessGroupEntity, - lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - null, - remoteProcessGroupEntity -> { - final RemoteProcessGroupDTO remoteProcessGroupDTO = remoteProcessGroupEntity.getComponent(); - - // set the processor id as appropriate - remoteProcessGroupDTO.setId(generateUuid()); - - // parse the uri to check if the uri is valid - final String targetUris = remoteProcessGroupDTO.getTargetUris(); - SiteToSiteRestApiClient.parseClusterUrls(targetUris); - - // since the uri is valid, use it - remoteProcessGroupDTO.setTargetUris(targetUris); - - // create the remote process group - final Revision revision = getRevision(remoteProcessGroupEntity, remoteProcessGroupDTO.getId()); - final RemoteProcessGroupEntity entity = serviceFacade.createRemoteProcessGroup(revision, groupId, remoteProcessGroupDTO); - remoteProcessGroupResource.populateRemainingRemoteProcessGroupEntityContent(entity); - - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } - ); - } - - /** - * Retrieves all the of remote process groups in this NiFi. - * - * @return A remoteProcessGroupEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/remote-process-groups") - @ApiOperation( - value = "Gets all remote process groups", - response = RemoteProcessGroupsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getRemoteProcessGroups( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // get all the remote process groups - final Set remoteProcessGroups = serviceFacade.getRemoteProcessGroups(groupId); - - // prune response as necessary - for (RemoteProcessGroupEntity remoteProcessGroupEntity : remoteProcessGroups) { - if (remoteProcessGroupEntity.getComponent() != null) { - remoteProcessGroupEntity.getComponent().setContents(null); - } - } - - // create the response entity - final RemoteProcessGroupsEntity entity = new RemoteProcessGroupsEntity(); - entity.setRemoteProcessGroups(remoteProcessGroupResource.populateRemainingRemoteProcessGroupEntitiesContent(remoteProcessGroups)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ----------- - // connections - // ----------- - - /** - * Creates a new connection. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestConnectionEntity A connectionEntity. - * @return A connectionEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/connections") - @ApiOperation( - value = "Creates a connection", - response = ConnectionEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Write Source - /{component-type}/{uuid}"), - @Authorization(value = "Write Destination - /{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createConnection( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The connection configuration details.", - required = true - ) final ConnectionEntity requestConnectionEntity) { - - if (requestConnectionEntity == null || requestConnectionEntity.getComponent() == null) { - throw new IllegalArgumentException("Connection details must be specified."); - } - - if (requestConnectionEntity.getRevision() == null || (requestConnectionEntity.getRevision().getVersion() == null || requestConnectionEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Connection."); - } - - if (requestConnectionEntity.getComponent().getId() != null) { - throw new IllegalArgumentException("Connection ID cannot be specified."); - } - - final List proposedBends = requestConnectionEntity.getComponent().getBends(); - if (proposedBends != null) { - for (final PositionDTO proposedBend : proposedBends) { - if (proposedBend.getX() == null || proposedBend.getY() == null) { - throw new IllegalArgumentException("The x and y coordinate of the each bend must be specified."); - } - } - } - - if (requestConnectionEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestConnectionEntity.getComponent().getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestConnectionEntity.getComponent().getParentGroupId(), groupId)); - } - requestConnectionEntity.getComponent().setParentGroupId(groupId); - - // get the connection - final ConnectionDTO requestConnection = requestConnectionEntity.getComponent(); - - if (requestConnection.getSource() == null || requestConnection.getSource().getId() == null) { - throw new IllegalArgumentException("The source of the connection must be specified."); - } - - if (requestConnection.getSource().getType() == null) { - throw new IllegalArgumentException("The type of the source of the connection must be specified."); - } - - final ConnectableType sourceConnectableType; - try { - sourceConnectableType = ConnectableType.valueOf(requestConnection.getSource().getType()); - } catch (final IllegalArgumentException e) { - throw new IllegalArgumentException(String.format("Unrecognized source type %s. Expected values are [%s]", - requestConnection.getSource().getType(), StringUtils.join(ConnectableType.values(), ", "))); - } - - if (requestConnection.getDestination() == null || requestConnection.getDestination().getId() == null) { - throw new IllegalArgumentException("The destination of the connection must be specified."); - } - - if (requestConnection.getDestination().getType() == null) { - throw new IllegalArgumentException("The type of the destination of the connection must be specified."); - } - - final ConnectableType destinationConnectableType; - try { - destinationConnectableType = ConnectableType.valueOf(requestConnection.getDestination().getType()); - } catch (final IllegalArgumentException e) { - throw new IllegalArgumentException(String.format("Unrecognized destination type %s. Expected values are [%s]", - requestConnection.getDestination().getType(), StringUtils.join(ConnectableType.values(), ", "))); - } - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestConnectionEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestConnectionEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestConnectionEntity, - lookup -> { - // ensure write access to the group - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - - // explicitly handle RPGs differently as the connectable id can be ambiguous if self referencing - final Authorizable source; - if (ConnectableType.REMOTE_OUTPUT_PORT.equals(sourceConnectableType)) { - source = lookup.getRemoteProcessGroup(requestConnection.getSource().getGroupId()); - } else { - source = lookup.getLocalConnectable(requestConnection.getSource().getId()); - } - - // ensure write access to the source - if (source == null) { - throw new ResourceNotFoundException("Cannot find source component with ID [" + requestConnection.getSource().getId() + "]"); - } - source.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - - // explicitly handle RPGs differently as the connectable id can be ambiguous if self referencing - final Authorizable destination; - if (ConnectableType.REMOTE_INPUT_PORT.equals(destinationConnectableType)) { - destination = lookup.getRemoteProcessGroup(requestConnection.getDestination().getGroupId()); - } else { - destination = lookup.getLocalConnectable(requestConnection.getDestination().getId()); - } - - // ensure write access to the destination - if (destination == null) { - throw new ResourceNotFoundException("Cannot find destination component with ID [" + requestConnection.getDestination().getId() + "]"); - } - - destination.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - () -> serviceFacade.verifyCreateConnection(groupId, requestConnection), - connectionEntity -> { - final ConnectionDTO connection = connectionEntity.getComponent(); - - // set the connection id as appropriate - connection.setId(generateUuid()); - - // create the new relationship target - final Revision revision = getRevision(connectionEntity, connection.getId()); - final ConnectionEntity entity = serviceFacade.createConnection(revision, groupId, connection); - connectionResource.populateRemainingConnectionEntityContent(entity); - - // extract the href and build the response - String uri = entity.getUri(); - return generateCreatedResponse(URI.create(uri), entity).build(); - } - ); - } - - /** - * Gets all the connections. - * - * @return A connectionsEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/connections") - @ApiOperation( - value = "Gets all connections", - response = ConnectionsEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getConnections( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") String groupId) { - - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - // authorize access - serviceFacade.authorizeAccess(lookup -> { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }); - - // all of the relationships for the specified source processor - Set connections = serviceFacade.getConnections(groupId); - - // create the client response entity - ConnectionsEntity entity = new ConnectionsEntity(); - entity.setConnections(connectionResource.populateRemainingConnectionEntitiesContent(connections)); - - // generate the response - return generateOkResponse(entity).build(); - } - - // ---------------- - // snippet instance - // ---------------- - - /** - * Copies the specified snippet within this ProcessGroup. The snippet instance that is instantiated cannot be referenced at a later time, therefore there is no - * corresponding URI. Instead the request URI is returned. - *

- * Alternatively, we could have performed a PUT request. However, PUT requests are supposed to be idempotent and this endpoint is certainly not. - * - * @param httpServletRequest request - * @param groupId The group id - * @param requestCopySnippetEntity The copy snippet request - * @return A flowSnippetEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/snippet-instance") - @ApiOperation( - value = "Copies a snippet and discards it.", - response = FlowEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Read - /{component-type}/{uuid} - For each component in the snippet and their descendant components"), - @Authorization(value = "Write - if the snippet contains any restricted Processors - /restricted-components") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response copySnippet( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") String groupId, - @ApiParam( - value = "The copy snippet request.", - required = true - ) CopySnippetRequestEntity requestCopySnippetEntity) { - - // ensure the position has been specified - if (requestCopySnippetEntity == null || requestCopySnippetEntity.getOriginX() == null || requestCopySnippetEntity.getOriginY() == null) { - throw new IllegalArgumentException("The origin position (x, y) must be specified"); - } - - if (requestCopySnippetEntity.getSnippetId() == null) { - throw new IllegalArgumentException("The snippet id must be specified."); - } - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestCopySnippetEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestCopySnippetEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestCopySnippetEntity, - lookup -> { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - final SnippetAuthorizable snippet = authorizeSnippetUsage(lookup, groupId, requestCopySnippetEntity.getSnippetId(), false, true); - - final Consumer authorizeRestricted = authorizable -> { - if (authorizable.isRestricted()) { - authorizeRestrictions(authorizer, authorizable); - } - }; - - // consider each processor. note - this request will not create new controller services so we do not need to check - // for if there are not restricted controller services. it will however, need to authorize the user has access - // to any referenced services and this is done within authorizeSnippetUsage above. - // Also ensure that user has READ permissions to the Parameter Contexts in order to copy them. - snippet.getSelectedProcessors().forEach(authorizeRestricted); - for (final ProcessGroupAuthorizable groupAuthorizable : snippet.getSelectedProcessGroups()) { - groupAuthorizable.getEncapsulatedProcessors().forEach(authorizeRestricted); - - final ParameterContext parameterContext = groupAuthorizable.getProcessGroup().getParameterContext(); - if (parameterContext != null) { - parameterContext.authorize(authorizer, RequestAction.READ, user); - } - - for (final ProcessGroupAuthorizable encapsulatedGroupAuth : groupAuthorizable.getEncapsulatedProcessGroups()) { - final ParameterContext encapsulatedGroupParameterContext = encapsulatedGroupAuth.getProcessGroup().getParameterContext(); - if (encapsulatedGroupParameterContext != null) { - encapsulatedGroupParameterContext.authorize(authorizer, RequestAction.READ, user); - } - - } - } - }, - null, - copySnippetRequestEntity -> { - // copy the specified snippet - final FlowEntity flowEntity = serviceFacade.copySnippet( - groupId, copySnippetRequestEntity.getSnippetId(), copySnippetRequestEntity.getOriginX(), copySnippetRequestEntity.getOriginY(), getIdGenerationSeed().orElse(null)); - - // get the snippet - final FlowDTO flow = flowEntity.getFlow(); - - // prune response as necessary - for (ProcessGroupEntity childGroupEntity : flow.getProcessGroups()) { - childGroupEntity.getComponent().setContents(null); - } - - // create the response entity - populateRemainingSnippetContent(flow); - - // generate the response - return generateCreatedResponse(getAbsolutePath(), flowEntity).build(); - } - ); - } - - private SnippetAuthorizable authorizeSnippetUsage(final AuthorizableLookup lookup, final String groupId, final String snippetId, - final boolean authorizeTransitiveServices, final boolean authorizeParameterReferences) { - - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - - // ensure write access to the target process group - lookup.getProcessGroup(groupId).getAuthorizable().authorize(authorizer, RequestAction.WRITE, user); - - // ensure read permission to every component in the snippet including referenced services - final SnippetAuthorizable snippet = lookup.getSnippet(snippetId); - authorizeSnippet(snippet, authorizer, lookup, RequestAction.READ, true, authorizeTransitiveServices, authorizeParameterReferences); - return snippet; - } - - // ------------------- - // controller services - // ------------------- - - /** - * Creates a new Controller Service. - * - * @param httpServletRequest request - * @param requestControllerServiceEntity A controllerServiceEntity. - * @return A controllerServiceEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/controller-services") - @ApiOperation( - value = "Creates a new controller service", - response = ControllerServiceEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @Authorization(value = "Write - if the Controller Service is restricted - /restricted-components") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response createControllerService( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The controller service configuration details.", - required = true - ) final ControllerServiceEntity requestControllerServiceEntity) { - - if (requestControllerServiceEntity == null || requestControllerServiceEntity.getComponent() == null) { - throw new IllegalArgumentException("Controller service details must be specified."); - } - - if (requestControllerServiceEntity.getRevision() == null - || (requestControllerServiceEntity.getRevision().getVersion() == null || requestControllerServiceEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Controller service."); - } - - final ControllerServiceDTO requestControllerService = requestControllerServiceEntity.getComponent(); - if (requestControllerService.getId() != null) { - throw new IllegalArgumentException("Controller service ID cannot be specified."); - } - - if (StringUtils.isBlank(requestControllerService.getType())) { - throw new IllegalArgumentException("The type of controller service to create must be specified."); - } - - if (requestControllerService.getParentGroupId() != null && !groupId.equals(requestControllerService.getParentGroupId())) { - throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", - requestControllerService.getParentGroupId(), groupId)); - } - requestControllerService.setParentGroupId(groupId); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, requestControllerServiceEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(requestControllerServiceEntity.isDisconnectedNodeAcknowledged()); - } - - return withWriteLock( - serviceFacade, - requestControllerServiceEntity, - lookup -> { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - final Authorizable processGroup = groupAuthorizable.getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, user); - - final Authorizable parameterContext = groupAuthorizable.getProcessGroup().getParameterContext(); - if (parameterContext != null) { - AuthorizeParameterReference.authorizeParameterReferences(requestControllerService.getProperties(), authorizer, parameterContext, user); - } - - ComponentAuthorizable authorizable = null; - try { - authorizable = lookup.getConfigurableComponent(requestControllerService.getType(), requestControllerService.getBundle()); - - if (authorizable.isRestricted()) { - authorizeRestrictions(authorizer, authorizable); - } - - if (requestControllerService.getProperties() != null) { - AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestControllerService.getProperties(), authorizable, authorizer, lookup); - } - } finally { - if (authorizable != null) { - authorizable.cleanUpResources(); - } - } - }, - () -> serviceFacade.verifyCreateControllerService(requestControllerService), - controllerServiceEntity -> { - final ControllerServiceDTO controllerService = controllerServiceEntity.getComponent(); - - // set the processor id as appropriate - controllerService.setId(generateUuid()); - - // create the controller service and generate the json - final Revision revision = getRevision(controllerServiceEntity, controllerService.getId()); - final ControllerServiceEntity entity = serviceFacade.createControllerService(revision, groupId, controllerService); - controllerServiceResource.populateRemainingControllerServiceEntityContent(entity); - - // build the response - return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); - } - ); - } - - /** - * Initiates the request to replace the Process Group with the given ID with the Process Group in the given import entity - * - * @param groupId The id of the process group to replace - * @param importEntity A request entity containing revision info and the process group to replace with - * @return A ProcessGroupReplaceRequestEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/replace-requests") - @ApiOperation( - value = "Initiate the Replace Request of a Process Group with the given ID", - response = ProcessGroupReplaceRequestEntity.class, - notes = "This will initiate the action of replacing a process group with the given process group. This can be a lengthy " - + "process, as it will stop any Processors and disable any Controller Services necessary to perform the action and then restart them. As a result, " - + "the endpoint will immediately return a ProcessGroupReplaceRequestEntity, and the process of replacing the flow will occur " - + "asynchronously in the background. The client may then periodically poll the status of the request by issuing a GET request to " - + "/process-groups/replace-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " - + "/process-groups/replace-requests/{requestId}. " + NON_GUARANTEED_ENDPOINT, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}"), - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Read - /{component-type}/{uuid} - For all encapsulated components"), - @Authorization(value = "Write - /{component-type}/{uuid} - For all encapsulated components"), - @Authorization(value = "Write - if the snapshot contains any restricted components - /restricted-components"), - @Authorization(value = "Read - /parameter-contexts/{uuid} - For any Parameter Context that is referenced by a Property that is changed, added, or removed") - } - ) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response initiateReplaceProcessGroup(@ApiParam(value = "The process group id.", required = true) @PathParam("id") final String groupId, - @ApiParam(value = "The process group replace request entity", required = true) final ProcessGroupImportEntity importEntity) { - if (importEntity == null) { - throw new IllegalArgumentException("Process Group Import Entity is required"); - } - - // replacing a flow under version control is not permitted via import. Versioned flows have additional requirements to allow - // them only to be replaced by a different version of the same flow. - if (serviceFacade.isAnyProcessGroupUnderVersionControl(groupId)) { - throw new IllegalStateException("Cannot replace a Process Group via import while it or its descendants are under Version Control."); - } - - final RegisteredFlowSnapshot versionedFlowSnapshot = importEntity.getVersionedFlowSnapshot(); - if (versionedFlowSnapshot == null) { - throw new IllegalArgumentException("Versioned Flow Snapshot must be supplied"); - } - - // remove any registry-specific versioning content which could be present if the flow was exported from registry - versionedFlowSnapshot.setFlow(null); - versionedFlowSnapshot.setBucket(null); - versionedFlowSnapshot.setSnapshotMetadata(null); - sanitizeRegistryInfo(versionedFlowSnapshot.getFlowContents()); - - final FlowSnapshotContainer flowSnapshotContainer = new FlowSnapshotContainer(versionedFlowSnapshot); - return initiateFlowUpdate(groupId, importEntity, true, "replace-requests", - "/nifi-api/process-groups/" + groupId + "/flow-contents", () -> flowSnapshotContainer); - } - - /** - * Recursively clear the registry info in the given versioned process group and all nested versioned process groups - * - * @param versionedProcessGroup the process group to sanitize - */ - private void sanitizeRegistryInfo(final VersionedProcessGroup versionedProcessGroup) { - versionedProcessGroup.setVersionedFlowCoordinates(null); - - for (final VersionedProcessGroup innerVersionedProcessGroup : versionedProcessGroup.getProcessGroups()) { - sanitizeRegistryInfo(innerVersionedProcessGroup); - } - } - - /** - * Uploads the specified versioned flow definition and adds it to a new process group. - * - * @param in The flow definition stream - * @return A processGroupEntity - * @throws IOException if there is an error during deserialization of the InputStream - */ - @POST - @Consumes(MediaType.MULTIPART_FORM_DATA) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/process-groups/upload") - @ApiOperation( - value = "Uploads a versioned flow definition and creates a process group", - response = ProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response uploadProcessGroup( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - @ApiParam( - value = "The process group name.", - required = true - ) - @FormDataParam("groupName") final String groupName, - @ApiParam( - value = "The process group X position.", - required = true - ) - @FormDataParam("positionX") final Double positionX, - @ApiParam( - value = "The process group Y position.", - required = true - ) - @FormDataParam("positionY") final Double positionY, - @ApiParam( - value = "The client id.", - required = true - ) - @FormDataParam("clientId") final String clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false - ) - @FormDataParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @FormDataParam("file") final InputStream in) throws InterruptedException { - - // ensure the group name is specified - if (StringUtils.isBlank(groupName)) { - throw new IllegalArgumentException("The process group name is required."); - } - - if (StringUtils.isBlank(groupId)) { - throw new IllegalArgumentException("The parent process group id is required"); - } - - if (positionX == null) { - throw new IllegalArgumentException("The x coordinate of the proposed position must be specified."); - } - - if (positionY == null) { - throw new IllegalArgumentException("The y coordinate of the proposed position must be specified."); - } - - if (StringUtils.isBlank(clientId)) { - throw new IllegalArgumentException("The client id must be specified"); - } - - // deserialize InputStream to a VersionedFlowSnapshot - RegisteredFlowSnapshot deserializedSnapshot; - - try { - deserializedSnapshot = MAPPER.readValue(in, RegisteredFlowSnapshot.class); - } catch (IOException e) { - logger.warn("Deserialization of uploaded JSON failed", e); - throw new IllegalArgumentException("Deserialization of uploaded JSON failed", e); - } - - // clear Registry info - sanitizeRegistryInfo(deserializedSnapshot.getFlowContents()); - - // resolve Bundle info - serviceFacade.discoverCompatibleBundles(deserializedSnapshot.getFlowContents()); - - // if there are any Controller Services referenced that are inherited from the parent group, - // resolve those to point to the appropriate Controller Service, if we are able to. - final FlowSnapshotContainer flowSnapshotContainer = new FlowSnapshotContainer(deserializedSnapshot); - serviceFacade.resolveInheritedControllerServices(flowSnapshotContainer, groupId, NiFiUserUtils.getNiFiUser()); - - // If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to. - serviceFacade.resolveParameterProviders(deserializedSnapshot, NiFiUserUtils.getNiFiUser()); - - if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(disconnectedNodeAcknowledged); - } - - // create a PositionDTO - final PositionDTO positionDTO = new PositionDTO(); - positionDTO.setX(positionX); - positionDTO.setY(positionY); - - // create a RevisionDTO - RevisionDTO revisionDTO = new RevisionDTO(); - revisionDTO.setClientId(clientId); - revisionDTO.setVersion((long) 0); - - // build the response entity for a replicate request - ProcessGroupUploadEntity pgUploadEntity = new ProcessGroupUploadEntity(); - pgUploadEntity.setGroupId(groupId); - pgUploadEntity.setGroupName(groupName); - pgUploadEntity.setDisconnectedNodeAcknowledged(disconnectedNodeAcknowledged); - pgUploadEntity.setFlowSnapshot(deserializedSnapshot); - pgUploadEntity.setPositionDTO(positionDTO); - pgUploadEntity.setRevisionDTO(revisionDTO); - - // replicate the request - if (isReplicateRequest()) { - // convert request accordingly - final UriBuilder uriBuilder = uriInfo.getBaseUriBuilder(); - uriBuilder.segment("process-groups", groupId, "process-groups", "import"); - final URI importUri = uriBuilder.build(); - - final Map headersToOverride = new HashMap<>(); - headersToOverride.put("content-type", MediaType.APPLICATION_JSON); - - // Determine whether we should replicate only to the cluster coordinator, or if we should replicate directly - // to the cluster nodes themselves. - if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) { - return getRequestReplicator().replicate(HttpMethod.POST, importUri, pgUploadEntity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse(); - } else { - return getRequestReplicator().forwardToCoordinator( - getClusterCoordinatorNode(), HttpMethod.POST, importUri, pgUploadEntity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse(); - } - } - - // otherwise import the process group locally - return importProcessGroup(groupId, pgUploadEntity); - } - - /** - * Imports the specified process group. - * - * @param processGroupUploadEntity A ProcessGroupUploadEntity. - * @return A processGroupEntity. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/process-groups/import") - @ApiOperation( - value = "Imports a specified process group", - response = ProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response importProcessGroup( - @ApiParam( - value = "The process group id.", - required = true - ) - @PathParam("id") final String groupId, - final ProcessGroupUploadEntity processGroupUploadEntity) { - - // verify the process group was specified - if (processGroupUploadEntity == null || processGroupUploadEntity.getFlowSnapshot() == null) { - throw new IllegalArgumentException("Process group details must be specified."); - } - - final RegisteredFlowSnapshot versionedFlowSnapshot = processGroupUploadEntity.getFlowSnapshot(); - - // clear Registry info - sanitizeRegistryInfo(versionedFlowSnapshot.getFlowContents()); - - // resolve Bundle info - serviceFacade.discoverCompatibleBundles(versionedFlowSnapshot.getFlowContents()); - - // if there are any Controller Services referenced that are inherited from the parent group, - // resolve those to point to the appropriate Controller Service, if we are able to. - final FlowSnapshotContainer flowSnapshotContainer = new FlowSnapshotContainer(versionedFlowSnapshot); - serviceFacade.resolveInheritedControllerServices(flowSnapshotContainer, groupId, NiFiUserUtils.getNiFiUser()); - - // If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to. - serviceFacade.resolveParameterProviders(versionedFlowSnapshot, NiFiUserUtils.getNiFiUser()); - - if (isReplicateRequest()) { - return replicate(HttpMethod.POST, processGroupUploadEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(processGroupUploadEntity.getDisconnectedNodeAcknowledged()); - } - - // create a new ProcessGroupEntity - final ProcessGroupEntity newProcessGroupEntity = createProcessGroupEntity(groupId, processGroupUploadEntity.getGroupName(), processGroupUploadEntity.getPositionDTO(), versionedFlowSnapshot); - - return withWriteLock( - serviceFacade, - newProcessGroupEntity, - lookup -> authorizeAccess(groupId, newProcessGroupEntity, lookup), - () -> { - final RegisteredFlowSnapshot newVersionedFlowSnapshot = newProcessGroupEntity.getVersionedFlowSnapshot(); - if (newVersionedFlowSnapshot != null) { - serviceFacade.verifyComponentTypes(newVersionedFlowSnapshot.getFlowContents()); - } - }, - processGroupEntity -> { - final ProcessGroupDTO processGroup = processGroupEntity.getComponent(); - - // set the processor id as appropriate - processGroup.setId(generateUuid()); - - // get the versioned flow - final RegisteredFlowSnapshot flowSnapshot = processGroupEntity.getVersionedFlowSnapshot(); - - // create the process group contents - final Revision revision = new Revision((long) 0, processGroupUploadEntity.getRevisionDTO().getClientId(), processGroup.getId()); - - ProcessGroupEntity entity = serviceFacade.createProcessGroup(revision, groupId, processGroup); - - if (flowSnapshot != null) { - final RevisionDTO revisionDto = entity.getRevision(); - final String newGroupId = entity.getComponent().getId(); - final Revision newGroupRevision = new Revision(revisionDto.getVersion(), revisionDto.getClientId(), newGroupId); - - // We don't want the Process Group's position to be updated because we want to keep the position where the user - // placed the Process Group. We do not want to use the name of the Process Group that is in the Flow Contents. - // To accomplish this, we call updateProcessGroupContents() passing 'false' for the updateSettings flag, set - // the Process Group name, and null out the position. - flowSnapshot.getFlowContents().setPosition(null); - flowSnapshot.getFlowContents().setName(processGroupUploadEntity.getGroupName()); - - entity = serviceFacade.updateProcessGroupContents(newGroupRevision, newGroupId, null, flowSnapshot, - getIdGenerationSeed().orElse(null), false, false, true); - } - - populateRemainingProcessGroupEntityContent(entity); - - // generate a 201 created response - String uri = entity.getUri(); - return generateCreatedResponse(URI.create(uri), entity).build(); - } - ); - - } - - - /** - * Replace the Process Group contents with the given ID with the specified Process Group contents. - * - * This is the endpoint used in a cluster update replication scenario. - * - * @param groupId The id of the process group to replace - * @param importEntity A request entity containing revision info and the process group to replace with - * @return A ProcessGroupImportEntity. - */ - @PUT - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/flow-contents") - @ApiOperation( - value = "Replace Process Group contents with the given ID with the specified Process Group contents", - response = ProcessGroupImportEntity.class, - notes = "This endpoint is used for replication within a cluster, when replacing a flow with a new flow. It expects that the flow being" - + "replaced is not under version control and that the given snapshot will not modify any Processor that is currently running " - + "or any Controller Service that is enabled. " - + NON_GUARANTEED_ENDPOINT, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}"), - @Authorization(value = "Write - /process-groups/{uuid}") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response replaceProcessGroup(@ApiParam(value = "The process group id.", required = true) @PathParam("id") final String groupId, - @ApiParam(value = "The process group replace request entity.", required = true) final ProcessGroupImportEntity importEntity) { - // Verify the request - if (importEntity == null) { - throw new IllegalArgumentException("Process Group Import Entity is required"); - } - - final RevisionDTO revisionDto = importEntity.getProcessGroupRevision(); - if (revisionDto == null) { - throw new IllegalArgumentException("Process Group Revision must be specified."); - } - - final RegisteredFlowSnapshot requestFlowSnapshot = importEntity.getVersionedFlowSnapshot(); - if (requestFlowSnapshot == null) { - throw new IllegalArgumentException("Versioned Flow Snapshot must be supplied."); - } - - // Perform the request - if (isReplicateRequest()) { - return replicate(HttpMethod.PUT, importEntity); - } else if (isDisconnectedFromCluster()) { - verifyDisconnectedNodeModification(importEntity.isDisconnectedNodeAcknowledged()); - } - - final Revision requestRevision = getRevision(importEntity.getProcessGroupRevision(), groupId); - return withWriteLock( - serviceFacade, - importEntity, - requestRevision, - lookup -> { - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - final Authorizable processGroup = groupAuthorizable.getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - () -> { - // We do not enforce that the Process Group is 'not dirty' because at this point, - // the client has explicitly indicated the dataflow that the Process Group should - // provide and provided the Revision to ensure that they have the most up-to-date - // view of the Process Group. - serviceFacade.verifyCanUpdate(groupId, requestFlowSnapshot, true, false); - }, - (revision, entity) -> { - final ProcessGroupEntity updatedGroup = - performUpdateFlow(groupId, revision, importEntity, entity.getVersionedFlowSnapshot(), - getIdGenerationSeed().orElse(null), false, true); - - // response to replication request is an entity with revision info but no versioned flow snapshot - final ProcessGroupImportEntity responseEntity = new ProcessGroupImportEntity(); - responseEntity.setProcessGroupRevision(updatedGroup.getRevision()); - - return generateOkResponse(responseEntity).build(); - }); - } - - /** - * Retrieve a request to replace a Process Group by request ID. - * - * @param replaceRequestId The ID of the replace request - * @return A ProcessGroupReplaceRequestEntity. - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("replace-requests/{id}") - @ApiOperation( - value = "Returns the Replace Request with the given ID", - response = ProcessGroupReplaceRequestEntity.class, - notes = "Returns the Replace Request with the given ID. Once a Replace Request has been created by performing a POST to /process-groups/{id}/replace-requests, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. " - + NON_GUARANTEED_ENDPOINT, - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response getReplaceProcessGroupRequest( - @ApiParam("The ID of the Replace Request") @PathParam("id") final String replaceRequestId) { - return retrieveFlowUpdateRequest("replace-requests", replaceRequestId); - } - - @DELETE - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("replace-requests/{id}") - @ApiOperation( - value = "Deletes the Replace Request with the given ID", - response = ProcessGroupReplaceRequestEntity.class, - notes = "Deletes the Replace Request with the given ID. After a request is created via a POST to /process-groups/{id}/replace-requests, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Replace process has completed. If the request is deleted before the request " - + "completes, then the Replace request will finish the step that it is currently performing and then will cancel any subsequent steps. " - + NON_GUARANTEED_ENDPOINT, - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response deleteReplaceProcessGroupRequest( - @ApiParam(value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", required = false) - @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam("The ID of the Update Request") @PathParam("id") final String replaceRequestId) { - return deleteFlowUpdateRequest("replace-requests", replaceRequestId, disconnectedNodeAcknowledged.booleanValue()); - } - - // ------------- - // flow-analysis - // ------------- - - /** - * Submits a request to run a flow analysis. - * - * @param processGroupId The id of the process group representing (a part of) the flow to be analyzed - * @return An AnalyzeFlowRequestEntity - */ - @POST - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/flow-analysis-requests") - @ApiOperation( - value = "Executes a flow analysis for components within a given process group", - response = AnalyzeFlowRequestEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid} - For this and all encapsulated process groups") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response submitAnalyzeFlowRequest( - @ApiParam( - value = "The id of the process group representing (a part of) the flow to be analyzed.", - required = true - ) - @PathParam("id") - final String processGroupId - ) { - if (isReplicateRequest()) { - return replicate(HttpMethod.POST); - } - - NiFiUser user = NiFiUserUtils.getNiFiUser(); - - ProcessGroupEntity requestProcessGroupEntity = new ProcessGroupEntity(); - requestProcessGroupEntity.setId(processGroupId); - - return withWriteLock( - serviceFacade, - requestProcessGroupEntity, - lookup -> { - final ProcessGroupAuthorizable processGroup = lookup.getProcessGroup(processGroupId); - processGroup.getAuthorizable().authorize(authorizer, RequestAction.READ, user); - }, - null, - (processGroupEntity) -> { - String analyzedGroupId = processGroupEntity.getId(); - - final String requestId = generateUuid(); - final AsynchronousWebRequest analyzeFlowAsyncWebRequest = new StandardAsynchronousWebRequest<>( - requestId, - analyzedGroupId, - analyzedGroupId, - user, - Collections.singletonList(new StandardUpdateStep("Analyze Process Group")) - ); - - // Submit the request to be performed in the background - final Consumer> analyzeFlowTask = asyncRequest -> { - try { - serviceFacade.analyzeProcessGroup(analyzedGroupId); - asyncRequest.markStepComplete(); - } catch (final Exception e) { - logger.error("Failed to run flow analysis on process group {}", processGroupId, e); - asyncRequest.fail("Failed to run flow analysis on process group " + processGroupId + " due to " + e); - } - }; - flowAnalysisAsyncRequestManager.submitRequest( - FLOW_ANALYSIS_REQUEST_TYPE, - requestId, - analyzeFlowAsyncWebRequest, - analyzeFlowTask - ); - - return generateOkResponse(createAnalyzeFlowRequestEntity(analyzeFlowAsyncWebRequest, requestId)).build(); - } - ); - } - - /** - * Checks the status of an outstanding request for a flow analysis. - * - * @param requestId The id of flow analysis request - * @return An analyzeFlowRequestEntity - */ - @GET - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/flow-analysis-requests/{requestId}") - @ApiOperation( - value = "Gets the current status of a flow analysis request.", - response = AnalyzeFlowRequestEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid} - For this and all encapsulated process groups") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response getAnalyzeFlowRequest( - @ApiParam( - value = "The id of the process group representing (a part of) the flow being analyzed.", - required = true - ) - @PathParam("id") - final String processGroupId, - @ApiParam( - value = "The id of the process group representing (a part of) the flow to be analyzed.", - required = true - ) - @PathParam("requestId") - final String requestId - ) { - if (isReplicateRequest()) { - return replicate(HttpMethod.GET); - } - - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - - // request manager will ensure that the current is the user that submitted this request - final AsynchronousWebRequest asyncRequest = - flowAnalysisAsyncRequestManager.getRequest(FLOW_ANALYSIS_REQUEST_TYPE, requestId, user); - - return generateOkResponse(createAnalyzeFlowRequestEntity(asyncRequest, requestId)).build(); - } - - /** - * Cancels the specified flow analysis request. - * - * @param httpServletRequest request - * @param requestId The id of the flow analysis request - * @return An analyzeFlowRequestEntity - */ - @DELETE - @Consumes(MediaType.WILDCARD) - @Produces(MediaType.APPLICATION_JSON) - @Path("{id}/flow-analysis-requests/{requestId}") - @ApiOperation( - value = "Cancels a flow analysis request.", - response = AnalyzeFlowRequestEntity.class, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid} - For this and all encapsulated process groups") - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } - ) - public Response removeAnalyzeFlowRequest( - @ApiParam( - value = "The id of the process group representing (a part of) the flow being analyzed.", - required = true - ) - @PathParam("id") - final String processGroupId, - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The id of the flow analysis request", - required = true - ) - @PathParam("requestId") - final String requestId - ) { - if (isReplicateRequest()) { - return replicate(HttpMethod.DELETE); - } - - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - final boolean twoPhaseRequest = isTwoPhaseRequest(httpServletRequest); - final boolean executionPhase = isExecutionPhase(httpServletRequest); - - // If this is a standalone node, or if this is the execution phase of the request, perform the actual request. - if (!twoPhaseRequest || executionPhase) { - // request manager will ensure that the current is the user that submitted this request - final AsynchronousWebRequest asyncRequest = - flowAnalysisAsyncRequestManager.removeRequest(FLOW_ANALYSIS_REQUEST_TYPE, requestId, user); - - if (asyncRequest == null) { - throw new ResourceNotFoundException("Could not find request of type " + FLOW_ANALYSIS_REQUEST_TYPE + " with ID " + requestId); - } - - if (!asyncRequest.isComplete()) { - asyncRequest.cancel(); - } - - AnalyzeFlowRequestEntity analyzeFlowRequestEntity = createAnalyzeFlowRequestEntity(asyncRequest, requestId); - return generateOkResponse(analyzeFlowRequestEntity).build(); - } - - if (isValidationPhase(httpServletRequest)) { - // Perform authorization by attempting to get the request - flowAnalysisAsyncRequestManager.getRequest(FLOW_ANALYSIS_REQUEST_TYPE, requestId, user); - return generateContinueResponse().build(); - } else if (isCancellationPhase(httpServletRequest)) { - return generateOkResponse().build(); - } else { - throw new IllegalStateException("This request does not appear to be part of the two phase commit."); - } - } - - private AnalyzeFlowRequestEntity createAnalyzeFlowRequestEntity( - final AsynchronousWebRequest asyncRequest, - final String requestId - ) { - String analyzedGroupId = asyncRequest.getRequest(); - - AnalyzeFlowRequestDTO responseDto = new AnalyzeFlowRequestDTO(); - responseDto.setProcessGroupId(analyzedGroupId); - - responseDto.setRequestId(requestId); - responseDto.setComplete(asyncRequest.isComplete()); - responseDto.setFailureReason(asyncRequest.getFailureReason()); - responseDto.setLastUpdated(asyncRequest.getLastUpdated()); - responseDto.setPercentCompleted(asyncRequest.getPercentComplete()); - responseDto.setState(asyncRequest.getState()); - responseDto.setUri(generateResourceUri("process-groups", "flow-analysis", analyzedGroupId)); - - final List updateSteps = new ArrayList<>(); - for (final UpdateStep updateStep : asyncRequest.getUpdateSteps()) { - final AnalyzeFlowRequestUpdateStepDTO updateStepDTO = new AnalyzeFlowRequestUpdateStepDTO(); - updateStepDTO.setDescription(updateStep.getDescription()); - updateStepDTO.setComplete(updateStep.isComplete()); - updateStepDTO.setFailureReason(updateStep.getFailureReason()); - updateSteps.add(updateStepDTO); - } - responseDto.setUpdateSteps(updateSteps); - - AnalyzeFlowRequestEntity analyzeFlowRequestEntity = new AnalyzeFlowRequestEntity(); - analyzeFlowRequestEntity.setAnalyzeFlowRequest(responseDto); - - return analyzeFlowRequestEntity; - } - //-- - - /** - * Perform actual flow update of the specified flow. This is used for the initial flow update and replication updates. - */ - @Override - protected ProcessGroupEntity performUpdateFlow(final String groupId, final Revision revision, final ProcessGroupImportEntity requestEntity, - final RegisteredFlowSnapshot flowSnapshot, final String idGenerationSeed, - final boolean verifyNotModified, final boolean updateDescendantVersionedFlows) { - logger.info("Replacing Process Group with ID {} with imported Process Group with ID {}", groupId, flowSnapshot.getFlowContents().getIdentifier()); - - // Update Process Group to the new flow (including name) - return serviceFacade.updateProcessGroupContents(revision, groupId, null, flowSnapshot, idGenerationSeed, verifyNotModified, - true, updateDescendantVersionedFlows); - } - - /** - * Create the entity that is used for update flow replication. The initial replace request entity can be re-used for the replication request. - */ - @Override - protected Entity createReplicateUpdateFlowEntity(final Revision revision, final ProcessGroupImportEntity requestEntity, - final RegisteredFlowSnapshot flowSnapshot) { - return requestEntity; - } - - /** - * Create the entity that captures the status and result of a replace request - * - * @return a new instance of a ProcessGroupReplaceRequestEntity - */ - @Override - protected ProcessGroupReplaceRequestEntity createUpdateRequestEntity() { - return new ProcessGroupReplaceRequestEntity(); - } - - /** - * Finalize a completed update request for an existing replace request. This is used when retrieving and deleting a replace request. - * - * A completed request will contain the updated VersionedFlowSnapshot - * - * @param requestEntity the request entity to finalize - */ - @Override - protected void finalizeCompletedUpdateRequest(final ProcessGroupReplaceRequestEntity requestEntity) { - final ProcessGroupReplaceRequestDTO updateRequestDto = requestEntity.getRequest(); - if (updateRequestDto.isComplete()) { - final RegisteredFlowSnapshot versionedFlowSnapshot = - serviceFacade.getCurrentFlowSnapshotByGroupId(updateRequestDto.getProcessGroupId()); - requestEntity.setVersionedFlowSnapshot(versionedFlowSnapshot); - } - } - - /** - * Creates a new ProcessGroupEntity with the specified VersionedFlowSnapshot. - * - * @param groupId the group id string - * @param groupName the process group name string - * @param positionDTO the process group PositionDTO - * @param deserializedSnapshot the deserialized snapshot - * - * @return a new ProcessGroupEntity - */ - private ProcessGroupEntity createProcessGroupEntity( - String groupId, String groupName, PositionDTO positionDTO, RegisteredFlowSnapshot deserializedSnapshot) { - - final ProcessGroupEntity processGroupEntity = new ProcessGroupEntity(); - - // create a ProcessGroupDTO - final ProcessGroupDTO processGroupDTO = new ProcessGroupDTO(); - processGroupDTO.setParentGroupId(groupId); - processGroupDTO.setName(groupName); - - processGroupEntity.setComponent(processGroupDTO); - processGroupEntity.setVersionedFlowSnapshot(deserializedSnapshot); - - // set the ProcessGroupEntity position - processGroupEntity.getComponent().setPosition(positionDTO); - - return processGroupEntity; - } - - /** - * Authorizes access to a Parameter Context and RestrictedComponents resource. - * - * @param groupId the group id string - * @param processGroupEntity the ProcessGroupEntity - * @param lookup the lookup - */ - private void authorizeAccess(String groupId, ProcessGroupEntity processGroupEntity, AuthorizableLookup lookup) { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, user); - - // if request specifies a Parameter Context, need to authorize that user has READ policy for the Parameter Context. - final ParameterContextReferenceEntity referencedParamContext = processGroupEntity.getComponent().getParameterContext(); - if (referencedParamContext != null && referencedParamContext.getId() != null) { - lookup.getParameterContext(referencedParamContext.getId()).authorize(authorizer, RequestAction.READ, user); - } - - // if any of the components is a Restricted Component, then we must authorize the user - // for write access to the RestrictedComponents resource - final RegisteredFlowSnapshot versionedFlowSnapshot = processGroupEntity.getVersionedFlowSnapshot(); - if (versionedFlowSnapshot != null) { - final Set restrictedComponents = FlowRegistryUtils.getRestrictedComponents(versionedFlowSnapshot.getFlowContents(), serviceFacade); - restrictedComponents.forEach(restrictedComponent -> { - final ComponentAuthorizable restrictedComponentAuthorizable = lookup.getConfigurableComponent(restrictedComponent); - authorizeRestrictions(authorizer, restrictedComponentAuthorizable); - }); - - final Map parameterContexts = versionedFlowSnapshot.getParameterContexts(); - if (parameterContexts != null) { - parameterContexts.values().forEach(context -> AuthorizeParameterReference.authorizeParameterContextAddition(context, serviceFacade, authorizer, lookup, user)); - } - } - } - - // setters - - public void setProcessorResource(ProcessorResource processorResource) { - this.processorResource = processorResource; - } - - public void setInputPortResource(InputPortResource inputPortResource) { - this.inputPortResource = inputPortResource; - } - - public void setOutputPortResource(OutputPortResource outputPortResource) { - this.outputPortResource = outputPortResource; - } - - public void setFunnelResource(FunnelResource funnelResource) { - this.funnelResource = funnelResource; - } - - public void setLabelResource(LabelResource labelResource) { - this.labelResource = labelResource; - } - - public void setRemoteProcessGroupResource(RemoteProcessGroupResource remoteProcessGroupResource) { - this.remoteProcessGroupResource = remoteProcessGroupResource; - } - - public void setConnectionResource(ConnectionResource connectionResource) { - this.connectionResource = connectionResource; - } - - public void setControllerServiceResource(ControllerServiceResource controllerServiceResource) { - this.controllerServiceResource = controllerServiceResource; - } - - public void setParameterContextReplacer(ParameterContextReplacer parameterContextReplacer) { - this.parameterContextReplacer = parameterContextReplacer; - } - - private static class DropEntity extends Entity { - final String entityId; - final String dropRequestId; - - public DropEntity(String entityId, String dropRequestId) { - this.entityId = entityId; - this.dropRequestId = dropRequestId; - } - - public String getEntityId() { - return entityId; - } - - public String getDropRequestId() { - return dropRequestId; - } - } + private static final Logger logger = LoggerFactory.getLogger(ProcessGroupResource.class); + + private static final String FLOW_ANALYSIS_REQUEST_TYPE = "flow-analysis-requests"; + + private ProcessorResource processorResource; + private InputPortResource inputPortResource; + private OutputPortResource outputPortResource; + private FunnelResource funnelResource; + private LabelResource labelResource; + private RemoteProcessGroupResource remoteProcessGroupResource; + private ConnectionResource connectionResource; + private ControllerServiceResource controllerServiceResource; + private ParameterContextReplacer parameterContextReplacer; + + + public RequestManager flowAnalysisAsyncRequestManager = + new AsyncRequestManager<>(100, TimeUnit.MINUTES.toMillis(1L), "On-demand Flow Analysis"); + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + static { + MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); + MAPPER.setDefaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL)); + MAPPER.setAnnotationIntrospector(new JakartaXmlBindAnnotationIntrospector(MAPPER.getTypeFactory())); + MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + } + + /** + * Populates the remaining fields in the specified process groups. + * + * @param processGroupEntities groups + * @return group dto + */ + public Set populateRemainingProcessGroupEntitiesContent(Set processGroupEntities) { + for (ProcessGroupEntity processGroupEntity : processGroupEntities) { + populateRemainingProcessGroupEntityContent(processGroupEntity); + } + return processGroupEntities; + } + + /** + * Populates the remaining fields in the specified process group. + * + * @param processGroupEntity group + * @return group dto + */ + public ProcessGroupEntity populateRemainingProcessGroupEntityContent(ProcessGroupEntity processGroupEntity) { + processGroupEntity.setUri(generateResourceUri("process-groups", processGroupEntity.getId())); + return processGroupEntity; + } + + + /** + * Populates the remaining content of the specified snippet. + */ + private FlowDTO populateRemainingSnippetContent(FlowDTO flow) { + processorResource.populateRemainingProcessorEntitiesContent(flow.getProcessors()); + connectionResource.populateRemainingConnectionEntitiesContent(flow.getConnections()); + inputPortResource.populateRemainingInputPortEntitiesContent(flow.getInputPorts()); + outputPortResource.populateRemainingOutputPortEntitiesContent(flow.getOutputPorts()); + remoteProcessGroupResource.populateRemainingRemoteProcessGroupEntitiesContent(flow.getRemoteProcessGroups()); + funnelResource.populateRemainingFunnelEntitiesContent(flow.getFunnels()); + labelResource.populateRemainingLabelEntitiesContent(flow.getLabels()); + + // go through each process group child and populate its uri + if (flow.getProcessGroups() != null) { + populateRemainingProcessGroupEntitiesContent(flow.getProcessGroups()); + } + + return flow; + } + + /** + * Retrieves the contents of the specified group. + * + * @param groupId The id of the process group. + * @return A processGroupEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}") + @Operation( + summary = "Gets a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getProcessGroup( + @Parameter(description = "The process group id.") + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get this process group contents + final ProcessGroupEntity entity = serviceFacade.getProcessGroup(groupId); + populateRemainingProcessGroupEntityContent(entity); + + if (entity.getComponent() != null) { + entity.getComponent().setContents(null); + } + + return generateOkResponse(entity).build(); + } + + /** + * Retrieves the specified group as a versioned flow snapshot for download. + * + * @param groupId The id of the process group + * @return A processGroupEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/download") + @Operation( + summary = "Gets a process group for download", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response exportProcessGroup( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId, + @Parameter(description = "If referenced services from outside the target group should be included") + @QueryParam("includeReferencedServices") + @DefaultValue("false") boolean includeReferencedServices) { + // authorize access + serviceFacade.authorizeAccess(lookup -> { + // ensure access to process groups (nested), encapsulated controller services and referenced parameter contexts + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.READ, true, + false, false, true); + }); + + // get the versioned flow + final RegisteredFlowSnapshot currentVersionedFlowSnapshot = includeReferencedServices + ? serviceFacade.getCurrentFlowSnapshotByGroupIdWithReferencedControllerServices(groupId) + : serviceFacade.getCurrentFlowSnapshotByGroupId(groupId); + + // determine the name of the attachment - possible issues with spaces in file names + final VersionedProcessGroup currentVersionedProcessGroup = currentVersionedFlowSnapshot.getFlowContents(); + final String flowName = currentVersionedProcessGroup.getName(); + final String filename = flowName.replaceAll("\\s", "_") + ".json"; + + return generateOkResponse(currentVersionedFlowSnapshot).header(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=\"%s\"", filename)).build(); + } + + /** + * Retrieves a list of local modifications to the Process Group since it was last synchronized with the Flow Registry + * + * @param groupId The id of the process group. + * @return A processGroupEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/local-modifications") + @Operation( + summary = "Gets a list of local modifications to the Process Group since it was last synchronized with the Flow Registry", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowComparisonEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getLocalModifications( + @Parameter(description = "The process group id.") + @PathParam("id") final String groupId) throws IOException, NiFiRegistryException { + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.READ, false, false, false, false); + }); + + final FlowComparisonEntity entity = serviceFacade.getLocalModifications(groupId); + return generateOkResponse(entity).build(); + } + + /** + * Updates the specified process group. + * + * @param id The id of the process group. + * @param requestProcessGroupEntity A processGroupEntity. + * @return A processGroupEntity or the parent processGroupEntity for recursive requests. + */ + @PUT + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}") + @Operation( + summary = "Updates a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response updateProcessGroup( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String id, + @Parameter( + description = "The process group configuration details.", + required = true + ) final ProcessGroupEntity requestProcessGroupEntity) { + + if (requestProcessGroupEntity == null || requestProcessGroupEntity.getComponent() == null) { + throw new IllegalArgumentException("Process group details must be specified."); + } + + if (requestProcessGroupEntity.getRevision() == null) { + throw new IllegalArgumentException("Revision must be specified."); + } + + // ensure the same id is being used + final ProcessGroupDTO requestProcessGroupDTO = requestProcessGroupEntity.getComponent(); + if (!id.equals(requestProcessGroupDTO.getId())) { + throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does " + + "not equal the process group id of the requested resource (%s).", requestProcessGroupDTO.getId(), id)); + } + + final PositionDTO proposedPosition = requestProcessGroupDTO.getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + final String processGroupUpdateStrategy = requestProcessGroupEntity.getProcessGroupUpdateStrategy(); + final ProcessGroupRecursivity updateStrategy; + if (processGroupUpdateStrategy == null) { + updateStrategy = ProcessGroupRecursivity.DIRECT_CHILDREN; + } else { + updateStrategy = ProcessGroupRecursivity.valueOf(processGroupUpdateStrategy); + } + + final String executionEngine = requestProcessGroupDTO.getExecutionEngine(); + if (executionEngine != null) { + try { + ExecutionEngine.valueOf(executionEngine); + } catch (final IllegalArgumentException iae) { + throw new IllegalArgumentException("Illegal value proposed for Execution Engine: " + executionEngine); + } + } + + final String statelessTimeout = requestProcessGroupDTO.getStatelessFlowTimeout(); + if (statelessTimeout != null) { + try { + FormatUtils.getPreciseTimeDuration(statelessTimeout, TimeUnit.MILLISECONDS); + } catch (final Exception e) { + throw new IllegalArgumentException("Illegal value proposed for Stateless Flow Timeout: " + statelessTimeout); + } + } + + final Integer maxConcurrentTasks = requestProcessGroupDTO.getMaxConcurrentTasks(); + if (maxConcurrentTasks != null && maxConcurrentTasks < 1) { + throw new IllegalArgumentException("Illegal value proposed for Max Concurrent Tasks: " + maxConcurrentTasks); + } + + if (isReplicateRequest()) { + return replicate(HttpMethod.PUT, requestProcessGroupEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestProcessGroupEntity.isDisconnectedNodeAcknowledged()); + } + + // handle expects request (usually from the cluster manager) + final ParameterContextReferenceEntity requestParamContext = requestProcessGroupDTO.getParameterContext(); + final String requestGroupId = requestProcessGroupDTO.getId(); + final Map updatableProcessGroups = new HashMap<>(); + + updatableProcessGroups.put(requestProcessGroupEntity, getRevision(requestProcessGroupEntity, requestGroupId)); + + if (updateStrategy == ProcessGroupRecursivity.ALL_DESCENDANTS) { + for (ProcessGroupEntity processGroupEntity : serviceFacade.getProcessGroups(requestGroupId, updateStrategy)) { + final ProcessGroupDTO processGroupDTO = processGroupEntity.getComponent(); + final String processGroupId = processGroupDTO == null ? processGroupEntity.getId() : processGroupDTO.getId(); + if (processGroupDTO != null) { + processGroupDTO.setParameterContext(requestParamContext); + } + updatableProcessGroups.put(processGroupEntity, getRevision(processGroupEntity, processGroupId)); + } + } + + return withWriteLock( + serviceFacade, + requestProcessGroupEntity, + new HashSet<>(updatableProcessGroups.values()), + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + + for (final ProcessGroupEntity updatableGroupEntity : updatableProcessGroups.keySet()) { + final ProcessGroupDTO updatableGroupDto = updatableGroupEntity.getComponent(); + final String groupId = updatableGroupDto == null ? updatableGroupEntity.getId() : updatableGroupDto.getId(); + + Authorizable authorizable = lookup.getProcessGroup(groupId).getAuthorizable(); + authorizable.authorize(authorizer, RequestAction.WRITE, user); + + // Ensure that user has READ permission on current Parameter Context (if any) because user is un-binding. + final ParameterContextReferenceEntity referencedParamContext = updatableGroupDto.getParameterContext(); + if (referencedParamContext != null) { + // Lookup the current Parameter Context and determine whether or not the Parameter Context is changing + final ProcessGroupEntity currentGroupEntity = serviceFacade.getProcessGroup(groupId); + final ProcessGroupDTO groupDto = currentGroupEntity.getComponent(); + final ParameterContextReferenceEntity currentParamContext = groupDto.getParameterContext(); + final String currentParamContextId = currentParamContext == null ? null : currentParamContext.getId(); + final boolean parameterContextChanging = !Objects.equals(referencedParamContext.getId(), currentParamContextId); + + // If Parameter Context is changing... + if (parameterContextChanging) { + // In order to bind to a Parameter Context, the user must have the READ policy to that Parameter Context. + if (referencedParamContext.getId() != null) { + lookup.getParameterContext(referencedParamContext.getId()).authorize(authorizer, RequestAction.READ, user); + } + + // If currently referencing a Parameter Context, we must authorize that the user has READ permissions on the Parameter Context in order to un-bind to it. + if (currentParamContextId != null) { + lookup.getParameterContext(currentParamContextId).authorize(authorizer, RequestAction.READ, user); + } + + // Because the user will be changing the behavior of any component in this group that is currently referencing any Parameter, we must ensure that the user has + // both READ and WRITE policies for each of those components. + for (final AffectedComponentEntity affectedComponentEntity : serviceFacade.getProcessorsReferencingParameter(groupId)) { + final Authorizable processorAuthorizable = lookup.getProcessor(affectedComponentEntity.getId()).getAuthorizable(); + processorAuthorizable.authorize(authorizer, RequestAction.READ, user); + processorAuthorizable.authorize(authorizer, RequestAction.WRITE, user); + } + + for (final AffectedComponentEntity affectedComponentEntity : serviceFacade.getControllerServicesReferencingParameter(groupId)) { + final Authorizable serviceAuthorizable = lookup.getControllerService(affectedComponentEntity.getId()).getAuthorizable(); + serviceAuthorizable.authorize(authorizer, RequestAction.READ, user); + serviceAuthorizable.authorize(authorizer, RequestAction.WRITE, user); + } + } + } + } + }, + () -> { + for (final ProcessGroupEntity entity : updatableProcessGroups.keySet()) { + serviceFacade.verifyUpdateProcessGroup(entity.getComponent()); + } + }, + (revisions, entities) -> { + ProcessGroupEntity responseEntity = null; + for (Map.Entry entry : updatableProcessGroups.entrySet()) { + // update the process group + final Revision revision = entry.getValue(); + final ProcessGroupDTO groupDTO = entry.getKey().getComponent(); + final ProcessGroupEntity entity = serviceFacade.updateProcessGroup(revision, groupDTO); + + if (requestGroupId.equals(entity.getId())) { + responseEntity = entity; + populateRemainingProcessGroupEntityContent(responseEntity); + + // prune response as necessary + if (responseEntity.getComponent() != null) { + responseEntity.getComponent().setContents(null); + } + } + } + return generateOkResponse(responseEntity).build(); + } + ); + } + + /** + * Extracts the response entity from the specified node response. + * + * @param nodeResponse node response + * @param clazz class + * @param type of class + * @return the response entity + */ + @Override + @SuppressWarnings("unchecked") + protected T getResponseEntity(final NodeResponse nodeResponse, final Class clazz) { + T entity = (T) nodeResponse.getUpdatedEntity(); + if (entity == null) { + entity = nodeResponse.getClientResponse().readEntity(clazz); + } + return entity; + } + + /** + * Creates a request to drop the flowfiles from all connection queues within a process group (recursively). + * + * @param processGroupId The id of the process group to be removed. + * @return A dropRequestEntity. + */ + @POST + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/empty-all-connections-requests") + @Operation( + summary = "Creates a request to drop all flowfiles of all connection queues in this process group.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid} - For this and all encapsulated process groups"), + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid} - For all encapsulated connections") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "202", description = "The request has been accepted. An HTTP response header will contain the URI where the status can be polled."), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createEmptyAllConnectionsRequest( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String processGroupId + ) { + if (isReplicateRequest()) { + return replicate(HttpMethod.POST); + } + + final ProcessGroupEntity requestProcessGroupEntity = new ProcessGroupEntity(); + requestProcessGroupEntity.setId(processGroupId); + + return withWriteLock( + serviceFacade, + requestProcessGroupEntity, + lookup -> authorizeHandleDropAllFlowFilesRequest(processGroupId, lookup), + null, + (processGroupEntity) -> { + // ensure the id is the same across the cluster + final String dropRequestId = generateUuid(); + + // submit the drop request + final DropRequestDTO dropRequest = serviceFacade.createDropAllFlowFilesInProcessGroup(processGroupEntity.getId(), dropRequestId); + dropRequest.setUri(generateResourceUri("process-groups", processGroupEntity.getId(), "empty-all-connections-requests", dropRequest.getId())); + + // create the response entity + final DropRequestEntity entity = new DropRequestEntity(); + entity.setDropRequest(dropRequest); + + // generate the URI where the response will be + final URI location = URI.create(dropRequest.getUri()); + return Response.status(Status.ACCEPTED).location(location).entity(entity).build(); + } + ); + } + + /** + * Checks the status of an outstanding request for dropping all flowfiles within a process group. + * + * @param processGroupId The id of the process group + * @param dropRequestId The id of the drop request + * @return A dropRequestEntity + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/empty-all-connections-requests/{drop-request-id}") + @Operation( + summary = "Gets the current status of a drop all flowfiles request.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid} - For this and all encapsulated process groups"), + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid} - For all encapsulated connections") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getDropAllFlowfilesRequest( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String processGroupId, + @Parameter( + description = "The drop request id.", + required = true + ) + @PathParam("drop-request-id") final String dropRequestId + ) { + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> authorizeHandleDropAllFlowFilesRequest(processGroupId, lookup)); + + // get the drop request + final DropRequestDTO dropRequest = serviceFacade.getDropAllFlowFilesRequest(processGroupId, dropRequestId); + dropRequest.setUri(generateResourceUri("process-groups", processGroupId, "empty-all-connections-requests", dropRequest.getId())); + + // create the response entity + final DropRequestEntity entity = new DropRequestEntity(); + entity.setDropRequest(dropRequest); + + return generateOkResponse(entity).build(); + } + + /** + * Cancels the specified request for dropping all flowfiles within a process group. + * + * @param processGroupId The process group id + * @param dropRequestId The drop request id + * @return A dropRequestEntity + */ + @DELETE + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/empty-all-connections-requests/{drop-request-id}") + @Operation( + summary = "Cancels and/or removes a request to drop all flowfiles.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid} - For this and all encapsulated process groups"), + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid} - For all encapsulated connections") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response removeDropRequest( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String processGroupId, + @Parameter(description = "The drop request id.", required = true) + @PathParam("drop-request-id") final String dropRequestId + ) { + if (isReplicateRequest()) { + return replicate(HttpMethod.DELETE); + } + + return withWriteLock( + serviceFacade, + new DropEntity(processGroupId, dropRequestId), + lookup -> authorizeHandleDropAllFlowFilesRequest(processGroupId, lookup), + null, + (dropEntity) -> { + // delete the drop request + final DropRequestDTO dropRequest = serviceFacade.deleteDropAllFlowFilesRequest(dropEntity.getEntityId(), dropEntity.getDropRequestId()); + dropRequest.setUri(generateResourceUri("process-groups", dropEntity.getEntityId(), "empty-all-connections-requests", dropRequest.getId())); + + // create the response entity + final DropRequestEntity entity = new DropRequestEntity(); + entity.setDropRequest(dropRequest); + + return generateOkResponse(entity).build(); + } + ); + } + + private void authorizeHandleDropAllFlowFilesRequest(String processGroupId, AuthorizableLookup lookup) { + final ProcessGroupAuthorizable processGroup = lookup.getProcessGroup(processGroupId); + + authorizeProcessGroup(processGroup, authorizer, lookup, RequestAction.READ, false, false, false, false); + + processGroup.getEncapsulatedProcessGroups() + .forEach(encapsulatedProcessGroup -> authorizeProcessGroup(encapsulatedProcessGroup, authorizer, lookup, RequestAction.READ, false, false, false, false)); + + processGroup.getEncapsulatedConnections().stream() + .map(ConnectionAuthorizable::getSourceData) + .forEach(connectionSourceData -> connectionSourceData.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser())); + } + + /** + * Removes the specified process group reference. + * + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the process group to be removed. + * @return A processGroupEntity. + */ + @DELETE + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}") + @Operation( + summary = "Deletes a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services by any encapsulated components - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For all encapsulated components") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response removeProcessGroup( + @Parameter(description = "The revision is used to verify the client is working with the latest version of the flow.") + @QueryParam(VERSION) final LongParameter version, + @Parameter(description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") + @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, + @Parameter(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.") + @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, + @Parameter(description = "The process group id.") + @PathParam("id") final String id) { + + // replicate if cluster manager + if (isReplicateRequest()) { + return replicate(HttpMethod.DELETE); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(disconnectedNodeAcknowledged); + } + + final ProcessGroupEntity requestProcessGroupEntity = new ProcessGroupEntity(); + requestProcessGroupEntity.setId(id); + + // handle expects request (usually from the cluster manager) + final Revision requestRevision = new Revision(version == null ? null : version.getLong(), clientId.getClientId(), id); + return withWriteLock( + serviceFacade, + requestProcessGroupEntity, + requestRevision, + lookup -> { + final ProcessGroupAuthorizable processGroupAuthorizable = lookup.getProcessGroup(id); + + // ensure write to this process group and all encapsulated components including controller services. additionally, ensure + // read to any referenced services by encapsulated components + authorizeProcessGroup(processGroupAuthorizable, authorizer, lookup, RequestAction.WRITE, true, true, false, false); + + // ensure write permission to the parent process group, if applicable... if this is the root group the + // request will fail later but still need to handle authorization here + final Authorizable parentAuthorizable = processGroupAuthorizable.getAuthorizable().getParentAuthorizable(); + if (parentAuthorizable != null) { + parentAuthorizable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + } + }, + () -> serviceFacade.verifyDeleteProcessGroup(id), + (revision, processGroupEntity) -> { + // delete the process group + final ProcessGroupEntity entity = serviceFacade.deleteProcessGroup(revision, processGroupEntity.getId()); + + // prune response as necessary + if (entity.getComponent() != null) { + entity.getComponent().setContents(null); + } + + // create the response + return generateOkResponse(entity).build(); + } + ); + } + + /** + * Adds the specified process group. + * + * @param groupId The group id + * @param requestProcessGroupEntity A processGroupEntity + * @return A processGroupEntity + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/process-groups") + @Operation( + summary = "Creates a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createProcessGroup( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId, + @Parameter( + description = "The process group configuration details.", + required = true + ) final ProcessGroupEntity requestProcessGroupEntity, + @Parameter( + description = "Handling Strategy controls whether to keep or replace Parameter Contexts" + ) + @QueryParam("parameterContextHandlingStrategy") + @DefaultValue("KEEP_EXISTING") final ParameterContextHandlingStrategy parameterContextHandlingStrategy + ) { + if (requestProcessGroupEntity == null || requestProcessGroupEntity.getComponent() == null) { + throw new IllegalArgumentException("Process group details must be specified."); + } + + if (requestProcessGroupEntity.getRevision() == null || (requestProcessGroupEntity.getRevision().getVersion() == null || requestProcessGroupEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Process group."); + } + + if (requestProcessGroupEntity.getComponent().getId() != null) { + throw new IllegalArgumentException("Process group ID cannot be specified."); + } + + final PositionDTO proposedPosition = requestProcessGroupEntity.getComponent().getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + // if the group name isn't specified, ensure the group is being imported from version control + if (StringUtils.isBlank(requestProcessGroupEntity.getComponent().getName()) && requestProcessGroupEntity.getComponent().getVersionControlInformation() == null) { + throw new IllegalArgumentException("The group name is required when the group is not imported from version control."); + } + + if (requestProcessGroupEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestProcessGroupEntity.getComponent().getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestProcessGroupEntity.getComponent().getParentGroupId(), groupId)); + } + requestProcessGroupEntity.getComponent().setParentGroupId(groupId); + + // Step 1: Ensure that user has write permissions to the Process Group. If not, then immediately fail. + // Step 2: Retrieve flow from Flow Registry + // Step 3: Resolve Bundle info + // Step 4: Update contents of the ProcessGroupDTO passed in to include the components that need to be added. + // Step 5: If any of the components is a Restricted Component, then we must authorize the user + // for write access to the RestrictedComponents resource + // Step 6: Replicate the request or call serviceFacade.updateProcessGroup + + final VersionControlInformationDTO versionControlInfo = requestProcessGroupEntity.getComponent().getVersionControlInformation(); + if (versionControlInfo != null && requestProcessGroupEntity.getVersionedFlowSnapshot() == null) { + // Step 1: Ensure that user has write permissions to the Process Group. If not, then immediately fail. + // Step 2: Retrieve flow from Flow Registry + final FlowSnapshotContainer flowSnapshotContainer = getFlowFromRegistry(versionControlInfo); + final RegisteredFlowSnapshot flowSnapshot = flowSnapshotContainer.getFlowSnapshot(); + + // Step 3: Enrich version control info came from UI + if (flowSnapshot.getFlowContents() != null) { + final VersionedFlowCoordinates versionedFlowCoordinates = flowSnapshot.getFlowContents().getVersionedFlowCoordinates(); + if (versionedFlowCoordinates != null) { + versionControlInfo.setStorageLocation(versionedFlowCoordinates.getStorageLocation()); + } + } + + // Step 4: Replace parameter contexts if necessary + if (ParameterContextHandlingStrategy.REPLACE.equals(parameterContextHandlingStrategy)) { + parameterContextReplacer.replaceParameterContexts(flowSnapshot, serviceFacade.getParameterContexts()); + } + + // Step 5: Resolve Bundle info + serviceFacade.discoverCompatibleBundles(flowSnapshot.getFlowContents()); + + // If there are any Controller Services referenced that are inherited from the parent group, resolve those to point to the appropriate Controller Service, if we are able to. + serviceFacade.resolveInheritedControllerServices(flowSnapshotContainer, groupId, NiFiUserUtils.getNiFiUser()); + + // If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to. + serviceFacade.resolveParameterProviders(flowSnapshot, NiFiUserUtils.getNiFiUser()); + + // Step 6: Update contents of the ProcessGroupDTO passed in to include the components that need to be added. + requestProcessGroupEntity.setVersionedFlowSnapshot(flowSnapshot); + } + + if (versionControlInfo != null) { + final RegisteredFlowSnapshot flowSnapshot = requestProcessGroupEntity.getVersionedFlowSnapshot(); + serviceFacade.verifyImportProcessGroup(versionControlInfo, flowSnapshot.getFlowContents(), groupId); + } + + // Step 7: Replicate the request or call serviceFacade.updateProcessGroup + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestProcessGroupEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestProcessGroupEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestProcessGroupEntity, + lookup -> authorizeAccess(groupId, requestProcessGroupEntity, lookup), + () -> { + final RegisteredFlowSnapshot versionedFlowSnapshot = requestProcessGroupEntity.getVersionedFlowSnapshot(); + if (versionedFlowSnapshot != null) { + serviceFacade.verifyComponentTypes(versionedFlowSnapshot.getFlowContents()); + } + }, + processGroupEntity -> { + final ProcessGroupDTO processGroup = processGroupEntity.getComponent(); + + // set the processor id as appropriate + processGroup.setId(generateUuid()); + + // ensure the group name comes from the versioned flow + final RegisteredFlowSnapshot flowSnapshot = processGroupEntity.getVersionedFlowSnapshot(); + if (flowSnapshot != null && StringUtils.isNotBlank(flowSnapshot.getFlowContents().getName()) && StringUtils.isBlank(processGroup.getName())) { + processGroup.setName(flowSnapshot.getFlowContents().getName()); + } + + // create the process group contents + final Revision revision = getRevision(processGroupEntity, processGroup.getId()); + ProcessGroupEntity entity = serviceFacade.createProcessGroup(revision, groupId, processGroup); + + if (flowSnapshot != null) { + final RevisionDTO revisionDto = entity.getRevision(); + final String newGroupId = entity.getComponent().getId(); + final Revision newGroupRevision = new Revision(revisionDto.getVersion(), revisionDto.getClientId(), newGroupId); + + // We don't want the Process Group's position to be updated because we want to keep the position where the user + // placed the Process Group. However, we do want to use the name of the Process Group that is in the Flow Contents. + // To accomplish this, we call updateProcessGroupContents() passing 'true' for the updateSettings flag but null out the position. + flowSnapshot.getFlowContents().setPosition(null); + entity = serviceFacade.updateProcessGroupContents(newGroupRevision, newGroupId, versionControlInfo, flowSnapshot, + getIdGenerationSeed().orElse(null), false, true, true); + } + + populateRemainingProcessGroupEntityContent(entity); + + // generate a 201 created response + String uri = entity.getUri(); + return generateCreatedResponse(URI.create(uri), entity).build(); + } + ); + } + + private FlowSnapshotContainer getFlowFromRegistry(final VersionControlInformationDTO versionControlInfo) { + final FlowSnapshotContainer flowSnapshotContainer = serviceFacade.getVersionedFlowSnapshot(versionControlInfo, true); + final RegisteredFlowSnapshot flowSnapshot = flowSnapshotContainer.getFlowSnapshot(); + final FlowRegistryBucket bucket = flowSnapshot.getBucket(); + final RegisteredFlow flow = flowSnapshot.getFlow(); + + versionControlInfo.setBucketName(bucket.getName()); + versionControlInfo.setFlowName(flow.getName()); + versionControlInfo.setFlowDescription(flow.getDescription()); + + versionControlInfo.setRegistryName(serviceFacade.getFlowRegistryName(versionControlInfo.getRegistryId())); + final VersionedFlowState flowState = flowSnapshot.isLatest() ? VersionedFlowState.UP_TO_DATE : VersionedFlowState.STALE; + versionControlInfo.setState(flowState.name()); + + return flowSnapshotContainer; + } + + + /** + * Retrieves all the child process groups of the process group with the given id. + * + * @param groupId the parent process group id + * @return An entity containing all the child process group entities. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/process-groups") + @Operation( + summary = "Gets all process groups", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getProcessGroups( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get the process groups + final Set entities = serviceFacade.getProcessGroups(groupId, ProcessGroupRecursivity.DIRECT_CHILDREN); + + // always prune the contents + for (final ProcessGroupEntity entity : entities) { + if (entity.getComponent() != null) { + entity.getComponent().setContents(null); + } + } + + // create the response entity + final ProcessGroupsEntity entity = new ProcessGroupsEntity(); + entity.setProcessGroups(populateRemainingProcessGroupEntitiesContent(entities)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ---------- + // processors + // ---------- + + /** + * Creates a new processor. + * + * @param groupId The group id + * @param requestProcessorEntity A processorEntity. + * @return A processorEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/processors") + @Operation( + summary = "Creates a new processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Processor is restricted - /restricted-components") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createProcessor( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The processor configuration details.", required = true) final ProcessorEntity requestProcessorEntity) { + + if (requestProcessorEntity == null || requestProcessorEntity.getComponent() == null) { + throw new IllegalArgumentException("Processor details must be specified."); + } + + if (requestProcessorEntity.getRevision() == null || (requestProcessorEntity.getRevision().getVersion() == null || requestProcessorEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Processor."); + } + + final ProcessorDTO requestProcessor = requestProcessorEntity.getComponent(); + if (requestProcessor.getId() != null) { + throw new IllegalArgumentException("Processor ID cannot be specified."); + } + + if (StringUtils.isBlank(requestProcessor.getType())) { + throw new IllegalArgumentException("The type of processor to create must be specified."); + } + + final PositionDTO proposedPosition = requestProcessor.getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + if (requestProcessor.getParentGroupId() != null && !groupId.equals(requestProcessor.getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestProcessor.getParentGroupId(), groupId)); + } + requestProcessor.setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestProcessorEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestProcessorEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestProcessorEntity, + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + final Authorizable processGroup = groupAuthorizable.getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, user); + + final Authorizable parameterContext = groupAuthorizable.getProcessGroup().getParameterContext(); + final ProcessorConfigDTO configDto = requestProcessor.getConfig(); + if (parameterContext != null && configDto != null) { + AuthorizeParameterReference.authorizeParameterReferences(configDto.getProperties(), authorizer, parameterContext, user); + } + + ComponentAuthorizable authorizable = null; + try { + authorizable = lookup.getConfigurableComponent(requestProcessor.getType(), requestProcessor.getBundle()); + + if (authorizable.isRestricted()) { + authorizeRestrictions(authorizer, authorizable); + } + + final ProcessorConfigDTO config = requestProcessor.getConfig(); + if (config != null && config.getProperties() != null) { + AuthorizeControllerServiceReference.authorizeControllerServiceReferences(config.getProperties(), authorizable, authorizer, lookup); + } + } finally { + if (authorizable != null) { + authorizable.cleanUpResources(); + } + } + }, + () -> serviceFacade.verifyCreateProcessor(requestProcessor), + processorEntity -> { + final ProcessorDTO processor = processorEntity.getComponent(); + + // set the processor id as appropriate + processor.setId(generateUuid()); + + // create the new processor + final Revision revision = getRevision(processorEntity, processor.getId()); + final ProcessorEntity entity = serviceFacade.createProcessor(revision, groupId, processor); + processorResource.populateRemainingProcessorEntityContent(entity); + + // generate a 201 created response + String uri = entity.getUri(); + return generateCreatedResponse(URI.create(uri), entity).build(); + } + ); + } + + /** + * Retrieves all the processors in this NiFi. + * + * @param groupId group id + * @return A processorsEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/processors") + @Operation( + summary = "Gets all processors", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getProcessors( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId, + @Parameter(description = "Whether or not to include processors from descendant process groups") + @QueryParam("includeDescendantGroups") + @DefaultValue("false") boolean includeDescendantGroups) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get the processors + final Set processors = serviceFacade.getProcessors(groupId, includeDescendantGroups); + + // create the response entity + final ProcessorsEntity entity = new ProcessorsEntity(); + entity.setProcessors(processorResource.populateRemainingProcessorEntitiesContent(processors)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ----------- + // input ports + // ----------- + + /** + * Creates a new input port. + * + * @param groupId The group id + * @param requestPortEntity A inputPortEntity. + * @return A inputPortEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/input-ports") + @Operation( + summary = "Creates an input port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createInputPort( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The input port configuration details.", required = true) final PortEntity requestPortEntity) { + + if (requestPortEntity == null || requestPortEntity.getComponent() == null) { + throw new IllegalArgumentException("Port details must be specified."); + } + + if (requestPortEntity.getRevision() == null || (requestPortEntity.getRevision().getVersion() == null || requestPortEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Input port."); + } + + if (requestPortEntity.getComponent().getId() != null) { + throw new IllegalArgumentException("Input port ID cannot be specified."); + } + + final PositionDTO proposedPosition = requestPortEntity.getComponent().getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + if (requestPortEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestPortEntity.getComponent().getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestPortEntity.getComponent().getParentGroupId(), groupId)); + } + requestPortEntity.getComponent().setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestPortEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestPortEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestPortEntity, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + null, + portEntity -> { + // set the processor id as appropriate + portEntity.getComponent().setId(generateUuid()); + + // create the input port and generate the json + final Revision revision = getRevision(portEntity, portEntity.getComponent().getId()); + final PortEntity entity = serviceFacade.createInputPort(revision, groupId, portEntity.getComponent()); + inputPortResource.populateRemainingInputPortEntityContent(entity); + + // build the response + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); + } + ); + } + + /** + * Retrieves all the of input ports in this NiFi. + * + * @return A inputPortsEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/input-ports") + @Operation( + summary = "Gets all input ports", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = InputPortsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getInputPorts( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get all the input ports + final Set inputPorts = serviceFacade.getInputPorts(groupId); + + final InputPortsEntity entity = new InputPortsEntity(); + entity.setInputPorts(inputPortResource.populateRemainingInputPortEntitiesContent(inputPorts)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ------------ + // output ports + // ------------ + + /** + * Creates a new output port. + * + * @param groupId The group id + * @param requestPortEntity A outputPortEntity. + * @return A outputPortEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/output-ports") + @Operation( + summary = "Creates an output port", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createOutputPort( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The output port configuration.", required = true) final PortEntity requestPortEntity + ) { + + if (requestPortEntity == null || requestPortEntity.getComponent() == null) { + throw new IllegalArgumentException("Port details must be specified."); + } + + if (requestPortEntity.getRevision() == null || (requestPortEntity.getRevision().getVersion() == null || requestPortEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Output port."); + } + + if (requestPortEntity.getComponent().getId() != null) { + throw new IllegalArgumentException("Output port ID cannot be specified."); + } + + final PositionDTO proposedPosition = requestPortEntity.getComponent().getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + if (requestPortEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestPortEntity.getComponent().getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestPortEntity.getComponent().getParentGroupId(), groupId)); + } + requestPortEntity.getComponent().setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestPortEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestPortEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestPortEntity, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + null, + portEntity -> { + // set the processor id as appropriate + portEntity.getComponent().setId(generateUuid()); + + // create the output port and generate the json + final Revision revision = getRevision(portEntity, portEntity.getComponent().getId()); + final PortEntity entity = serviceFacade.createOutputPort(revision, groupId, portEntity.getComponent()); + outputPortResource.populateRemainingOutputPortEntityContent(entity); + + // build the response + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); + } + ); + } + + /** + * Retrieves all the of output ports in this NiFi. + * + * @return A outputPortsEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/output-ports") + @Operation( + summary = "Gets all output ports", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = OutputPortsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getOutputPorts( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get all the output ports + final Set outputPorts = serviceFacade.getOutputPorts(groupId); + + // create the response entity + final OutputPortsEntity entity = new OutputPortsEntity(); + entity.setOutputPorts(outputPortResource.populateRemainingOutputPortEntitiesContent(outputPorts)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ------- + // funnels + // ------- + + /** + * Creates a new Funnel. + * + * @param groupId The group id + * @param requestFunnelEntity A funnelEntity. + * @return A funnelEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/funnels") + @Operation( + summary = "Creates a funnel", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createFunnel( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The funnel configuration details.", required = true) final FunnelEntity requestFunnelEntity) { + + if (requestFunnelEntity == null || requestFunnelEntity.getComponent() == null) { + throw new IllegalArgumentException("Funnel details must be specified."); + } + + if (requestFunnelEntity.getRevision() == null || (requestFunnelEntity.getRevision().getVersion() == null || requestFunnelEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Funnel."); + } + + if (requestFunnelEntity.getComponent().getId() != null) { + throw new IllegalArgumentException("Funnel ID cannot be specified."); + } + + final PositionDTO proposedPosition = requestFunnelEntity.getComponent().getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + if (requestFunnelEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestFunnelEntity.getComponent().getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestFunnelEntity.getComponent().getParentGroupId(), groupId)); + } + requestFunnelEntity.getComponent().setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestFunnelEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestFunnelEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestFunnelEntity, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + null, + funnelEntity -> { + // set the processor id as appropriate + funnelEntity.getComponent().setId(generateUuid()); + + // create the funnel and generate the json + final Revision revision = getRevision(funnelEntity, funnelEntity.getComponent().getId()); + final FunnelEntity entity = serviceFacade.createFunnel(revision, groupId, funnelEntity.getComponent()); + funnelResource.populateRemainingFunnelEntityContent(entity); + + // build the response + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); + } + ); + } + + /** + * Retrieves all the of funnels in this NiFi. + * + * @return A funnelsEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/funnels") + @Operation( + summary = "Gets all funnels", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getFunnels( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get all the funnels + final Set funnels = serviceFacade.getFunnels(groupId); + + // create the response entity + final FunnelsEntity entity = new FunnelsEntity(); + entity.setFunnels(funnelResource.populateRemainingFunnelEntitiesContent(funnels)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ------ + // labels + // ------ + + /** + * Creates a new Label. + * + * @param groupId The group id + * @param requestLabelEntity A labelEntity. + * @return A labelEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/labels") + @Operation( + summary = "Creates a label", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createLabel( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The label configuration details.", required = true) final LabelEntity requestLabelEntity + ) { + + if (requestLabelEntity == null || requestLabelEntity.getComponent() == null) { + throw new IllegalArgumentException("Label details must be specified."); + } + + if (requestLabelEntity.getRevision() == null || (requestLabelEntity.getRevision().getVersion() == null || requestLabelEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Label."); + } + + if (requestLabelEntity.getComponent().getId() != null) { + throw new IllegalArgumentException("Label ID cannot be specified."); + } + + final PositionDTO proposedPosition = requestLabelEntity.getComponent().getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + if (requestLabelEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestLabelEntity.getComponent().getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestLabelEntity.getComponent().getParentGroupId(), groupId)); + } + requestLabelEntity.getComponent().setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestLabelEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestLabelEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestLabelEntity, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + null, + labelEntity -> { + // set the processor id as appropriate + labelEntity.getComponent().setId(generateUuid()); + + // create the label and generate the json + final Revision revision = getRevision(labelEntity, labelEntity.getComponent().getId()); + final LabelEntity entity = serviceFacade.createLabel(revision, groupId, labelEntity.getComponent()); + labelResource.populateRemainingLabelEntityContent(entity); + + // build the response + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); + } + ); + } + + /** + * Retrieves all the of labels in this NiFi. + * + * @return A labelsEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/labels") + @Operation( + summary = "Gets all labels", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getLabels( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get all the labels + final Set labels = serviceFacade.getLabels(groupId); + + // create the response entity + final LabelsEntity entity = new LabelsEntity(); + entity.setLabels(labelResource.populateRemainingLabelEntitiesContent(labels)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // --------------------- + // remote process groups + // --------------------- + + /** + * Creates a new remote process group. + * + * @param groupId The group id + * @param requestRemoteProcessGroupEntity A remoteProcessGroupEntity. + * @return A remoteProcessGroupEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/remote-process-groups") + @Operation( + summary = "Creates a new process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createRemoteProcessGroup( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The remote process group configuration details.", required = true) final RemoteProcessGroupEntity requestRemoteProcessGroupEntity) { + + if (requestRemoteProcessGroupEntity == null || requestRemoteProcessGroupEntity.getComponent() == null) { + throw new IllegalArgumentException("Remote process group details must be specified."); + } + + if (requestRemoteProcessGroupEntity.getRevision() == null + || (requestRemoteProcessGroupEntity.getRevision().getVersion() == null || requestRemoteProcessGroupEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Remote process group."); + } + + final RemoteProcessGroupDTO requestRemoteProcessGroupDTO = requestRemoteProcessGroupEntity.getComponent(); + + if (requestRemoteProcessGroupDTO.getId() != null) { + throw new IllegalArgumentException("Remote process group ID cannot be specified."); + } + + if (requestRemoteProcessGroupDTO.getTargetUri() == null) { + throw new IllegalArgumentException("The URI of the process group must be specified."); + } + + final PositionDTO proposedPosition = requestRemoteProcessGroupDTO.getPosition(); + if (proposedPosition != null) { + if (proposedPosition.getX() == null || proposedPosition.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); + } + } + + if (requestRemoteProcessGroupDTO.getParentGroupId() != null && !groupId.equals(requestRemoteProcessGroupDTO.getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestRemoteProcessGroupDTO.getParentGroupId(), groupId)); + } + requestRemoteProcessGroupDTO.setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestRemoteProcessGroupEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestRemoteProcessGroupEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestRemoteProcessGroupEntity, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + null, + remoteProcessGroupEntity -> { + final RemoteProcessGroupDTO remoteProcessGroupDTO = remoteProcessGroupEntity.getComponent(); + + // set the processor id as appropriate + remoteProcessGroupDTO.setId(generateUuid()); + + // parse the uri to check if the uri is valid + final String targetUris = remoteProcessGroupDTO.getTargetUris(); + SiteToSiteRestApiClient.parseClusterUrls(targetUris); + + // since the uri is valid, use it + remoteProcessGroupDTO.setTargetUris(targetUris); + + // create the remote process group + final Revision revision = getRevision(remoteProcessGroupEntity, remoteProcessGroupDTO.getId()); + final RemoteProcessGroupEntity entity = serviceFacade.createRemoteProcessGroup(revision, groupId, remoteProcessGroupDTO); + remoteProcessGroupResource.populateRemainingRemoteProcessGroupEntityContent(entity); + + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); + } + ); + } + + /** + * Retrieves all the of remote process groups in this NiFi. + * + * @return A remoteProcessGroupEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/remote-process-groups") + @Operation( + summary = "Gets all remote process groups", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getRemoteProcessGroups( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // get all the remote process groups + final Set remoteProcessGroups = serviceFacade.getRemoteProcessGroups(groupId); + + // prune response as necessary + for (RemoteProcessGroupEntity remoteProcessGroupEntity : remoteProcessGroups) { + if (remoteProcessGroupEntity.getComponent() != null) { + remoteProcessGroupEntity.getComponent().setContents(null); + } + } + + // create the response entity + final RemoteProcessGroupsEntity entity = new RemoteProcessGroupsEntity(); + entity.setRemoteProcessGroups(remoteProcessGroupResource.populateRemainingRemoteProcessGroupEntitiesContent(remoteProcessGroups)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ----------- + // connections + // ----------- + + /** + * Creates a new connection. + * + * @param groupId The group id + * @param requestConnectionEntity A connectionEntity. + * @return A connectionEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/connections") + @Operation( + summary = "Creates a connection", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createConnection( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The connection configuration details.", required = true) final ConnectionEntity requestConnectionEntity) { + + if (requestConnectionEntity == null || requestConnectionEntity.getComponent() == null) { + throw new IllegalArgumentException("Connection details must be specified."); + } + + if (requestConnectionEntity.getRevision() == null || (requestConnectionEntity.getRevision().getVersion() == null || requestConnectionEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Connection."); + } + + if (requestConnectionEntity.getComponent().getId() != null) { + throw new IllegalArgumentException("Connection ID cannot be specified."); + } + + final List proposedBends = requestConnectionEntity.getComponent().getBends(); + if (proposedBends != null) { + for (final PositionDTO proposedBend : proposedBends) { + if (proposedBend.getX() == null || proposedBend.getY() == null) { + throw new IllegalArgumentException("The x and y coordinate of the each bend must be specified."); + } + } + } + + if (requestConnectionEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestConnectionEntity.getComponent().getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestConnectionEntity.getComponent().getParentGroupId(), groupId)); + } + requestConnectionEntity.getComponent().setParentGroupId(groupId); + + // get the connection + final ConnectionDTO requestConnection = requestConnectionEntity.getComponent(); + + if (requestConnection.getSource() == null || requestConnection.getSource().getId() == null) { + throw new IllegalArgumentException("The source of the connection must be specified."); + } + + if (requestConnection.getSource().getType() == null) { + throw new IllegalArgumentException("The type of the source of the connection must be specified."); + } + + final ConnectableType sourceConnectableType; + try { + sourceConnectableType = ConnectableType.valueOf(requestConnection.getSource().getType()); + } catch (final IllegalArgumentException e) { + throw new IllegalArgumentException(String.format("Unrecognized source type %s. Expected values are [%s]", + requestConnection.getSource().getType(), StringUtils.join(ConnectableType.values(), ", "))); + } + + if (requestConnection.getDestination() == null || requestConnection.getDestination().getId() == null) { + throw new IllegalArgumentException("The destination of the connection must be specified."); + } + + if (requestConnection.getDestination().getType() == null) { + throw new IllegalArgumentException("The type of the destination of the connection must be specified."); + } + + final ConnectableType destinationConnectableType; + try { + destinationConnectableType = ConnectableType.valueOf(requestConnection.getDestination().getType()); + } catch (final IllegalArgumentException e) { + throw new IllegalArgumentException(String.format("Unrecognized destination type %s. Expected values are [%s]", + requestConnection.getDestination().getType(), StringUtils.join(ConnectableType.values(), ", "))); + } + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestConnectionEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestConnectionEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestConnectionEntity, + lookup -> { + // ensure write access to the group + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + + // explicitly handle RPGs differently as the connectable id can be ambiguous if self referencing + final Authorizable source; + if (ConnectableType.REMOTE_OUTPUT_PORT.equals(sourceConnectableType)) { + source = lookup.getRemoteProcessGroup(requestConnection.getSource().getGroupId()); + } else { + source = lookup.getLocalConnectable(requestConnection.getSource().getId()); + } + + // ensure write access to the source + if (source == null) { + throw new ResourceNotFoundException("Cannot find source component with ID [" + requestConnection.getSource().getId() + "]"); + } + source.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + + // explicitly handle RPGs differently as the connectable id can be ambiguous if self referencing + final Authorizable destination; + if (ConnectableType.REMOTE_INPUT_PORT.equals(destinationConnectableType)) { + destination = lookup.getRemoteProcessGroup(requestConnection.getDestination().getGroupId()); + } else { + destination = lookup.getLocalConnectable(requestConnection.getDestination().getId()); + } + + // ensure write access to the destination + if (destination == null) { + throw new ResourceNotFoundException("Cannot find destination component with ID [" + requestConnection.getDestination().getId() + "]"); + } + + destination.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + () -> serviceFacade.verifyCreateConnection(groupId, requestConnection), + connectionEntity -> { + final ConnectionDTO connection = connectionEntity.getComponent(); + + // set the connection id as appropriate + connection.setId(generateUuid()); + + // create the new relationship target + final Revision revision = getRevision(connectionEntity, connection.getId()); + final ConnectionEntity entity = serviceFacade.createConnection(revision, groupId, connection); + connectionResource.populateRemainingConnectionEntityContent(entity); + + // extract the href and build the response + String uri = entity.getUri(); + return generateCreatedResponse(URI.create(uri), entity).build(); + } + ); + } + + /** + * Gets all the connections. + * + * @return A connectionsEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/connections") + @Operation( + summary = "Gets all connections", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getConnections( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") String groupId) { + + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + // authorize access + serviceFacade.authorizeAccess(lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }); + + // all of the relationships for the specified source processor + Set connections = serviceFacade.getConnections(groupId); + + // create the client response entity + ConnectionsEntity entity = new ConnectionsEntity(); + entity.setConnections(connectionResource.populateRemainingConnectionEntitiesContent(connections)); + + // generate the response + return generateOkResponse(entity).build(); + } + + // ---------------- + // snippet instance + // ---------------- + + /** + * Copies the specified snippet within this ProcessGroup. The snippet instance that is instantiated cannot be referenced at a later time, therefore there is no + * corresponding URI. Instead the request URI is returned. + *

+ * Alternatively, we could have performed a PUT request. However, PUT requests are supposed to be idempotent and this endpoint is certainly not. + * + * @param groupId The group id + * @param requestCopySnippetEntity The copy snippet request + * @return A flowSnippetEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/snippet-instance") + @Operation( + summary = "Copies a snippet and discards it.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For each component in the snippet and their descendant components"), + @SecurityRequirement(name = "Write - if the snippet contains any restricted Processors - /restricted-components") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response copySnippet( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The copy snippet request.", required = true) final CopySnippetRequestEntity requestCopySnippetEntity) { + + // ensure the position has been specified + if (requestCopySnippetEntity == null || requestCopySnippetEntity.getOriginX() == null || requestCopySnippetEntity.getOriginY() == null) { + throw new IllegalArgumentException("The origin position (x, y) must be specified"); + } + + if (requestCopySnippetEntity.getSnippetId() == null) { + throw new IllegalArgumentException("The snippet id must be specified."); + } + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestCopySnippetEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestCopySnippetEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestCopySnippetEntity, + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + final SnippetAuthorizable snippet = authorizeSnippetUsage(lookup, groupId, requestCopySnippetEntity.getSnippetId(), false, true); + + final Consumer authorizeRestricted = authorizable -> { + if (authorizable.isRestricted()) { + authorizeRestrictions(authorizer, authorizable); + } + }; + + // consider each processor. note - this request will not create new controller services so we do not need to check + // for if there are not restricted controller services. it will however, need to authorize the user has access + // to any referenced services and this is done within authorizeSnippetUsage above. + // Also ensure that user has READ permissions to the Parameter Contexts in order to copy them. + snippet.getSelectedProcessors().forEach(authorizeRestricted); + for (final ProcessGroupAuthorizable groupAuthorizable : snippet.getSelectedProcessGroups()) { + groupAuthorizable.getEncapsulatedProcessors().forEach(authorizeRestricted); + + final ParameterContext parameterContext = groupAuthorizable.getProcessGroup().getParameterContext(); + if (parameterContext != null) { + parameterContext.authorize(authorizer, RequestAction.READ, user); + } + + for (final ProcessGroupAuthorizable encapsulatedGroupAuth : groupAuthorizable.getEncapsulatedProcessGroups()) { + final ParameterContext encapsulatedGroupParameterContext = encapsulatedGroupAuth.getProcessGroup().getParameterContext(); + if (encapsulatedGroupParameterContext != null) { + encapsulatedGroupParameterContext.authorize(authorizer, RequestAction.READ, user); + } + + } + } + }, + null, + copySnippetRequestEntity -> { + // copy the specified snippet + final FlowEntity flowEntity = serviceFacade.copySnippet( + groupId, copySnippetRequestEntity.getSnippetId(), copySnippetRequestEntity.getOriginX(), copySnippetRequestEntity.getOriginY(), getIdGenerationSeed().orElse(null)); + + // get the snippet + final FlowDTO flow = flowEntity.getFlow(); + + // prune response as necessary + for (ProcessGroupEntity childGroupEntity : flow.getProcessGroups()) { + childGroupEntity.getComponent().setContents(null); + } + + // create the response entity + populateRemainingSnippetContent(flow); + + // generate the response + return generateCreatedResponse(getAbsolutePath(), flowEntity).build(); + } + ); + } + + private SnippetAuthorizable authorizeSnippetUsage(final AuthorizableLookup lookup, final String groupId, final String snippetId, + final boolean authorizeTransitiveServices, final boolean authorizeParameterReferences) { + + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + + // ensure write access to the target process group + lookup.getProcessGroup(groupId).getAuthorizable().authorize(authorizer, RequestAction.WRITE, user); + + // ensure read permission to every component in the snippet including referenced services + final SnippetAuthorizable snippet = lookup.getSnippet(snippetId); + authorizeSnippet(snippet, authorizer, lookup, RequestAction.READ, true, authorizeTransitiveServices, authorizeParameterReferences); + return snippet; + } + + // ------------------- + // controller services + // ------------------- + + /** + * Creates a new Controller Service. + * + * @param requestControllerServiceEntity A controllerServiceEntity. + * @return A controllerServiceEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/controller-services") + @Operation( + summary = "Creates a new controller service", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Controller Service is restricted - /restricted-components") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response createControllerService( + @Parameter(description = "The process group id.", required = true) + @PathParam("id") final String groupId, + @Parameter(description = "The controller service configuration details.", required = true) final ControllerServiceEntity requestControllerServiceEntity) { + + if (requestControllerServiceEntity == null || requestControllerServiceEntity.getComponent() == null) { + throw new IllegalArgumentException("Controller service details must be specified."); + } + + if (requestControllerServiceEntity.getRevision() == null + || (requestControllerServiceEntity.getRevision().getVersion() == null || requestControllerServiceEntity.getRevision().getVersion() != 0)) { + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Controller service."); + } + + final ControllerServiceDTO requestControllerService = requestControllerServiceEntity.getComponent(); + if (requestControllerService.getId() != null) { + throw new IllegalArgumentException("Controller service ID cannot be specified."); + } + + if (StringUtils.isBlank(requestControllerService.getType())) { + throw new IllegalArgumentException("The type of controller service to create must be specified."); + } + + if (requestControllerService.getParentGroupId() != null && !groupId.equals(requestControllerService.getParentGroupId())) { + throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", + requestControllerService.getParentGroupId(), groupId)); + } + requestControllerService.setParentGroupId(groupId); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, requestControllerServiceEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(requestControllerServiceEntity.isDisconnectedNodeAcknowledged()); + } + + return withWriteLock( + serviceFacade, + requestControllerServiceEntity, + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + final Authorizable processGroup = groupAuthorizable.getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, user); + + final Authorizable parameterContext = groupAuthorizable.getProcessGroup().getParameterContext(); + if (parameterContext != null) { + AuthorizeParameterReference.authorizeParameterReferences(requestControllerService.getProperties(), authorizer, parameterContext, user); + } + + ComponentAuthorizable authorizable = null; + try { + authorizable = lookup.getConfigurableComponent(requestControllerService.getType(), requestControllerService.getBundle()); + + if (authorizable.isRestricted()) { + authorizeRestrictions(authorizer, authorizable); + } + + if (requestControllerService.getProperties() != null) { + AuthorizeControllerServiceReference.authorizeControllerServiceReferences(requestControllerService.getProperties(), authorizable, authorizer, lookup); + } + } finally { + if (authorizable != null) { + authorizable.cleanUpResources(); + } + } + }, + () -> serviceFacade.verifyCreateControllerService(requestControllerService), + controllerServiceEntity -> { + final ControllerServiceDTO controllerService = controllerServiceEntity.getComponent(); + + // set the processor id as appropriate + controllerService.setId(generateUuid()); + + // create the controller service and generate the json + final Revision revision = getRevision(controllerServiceEntity, controllerService.getId()); + final ControllerServiceEntity entity = serviceFacade.createControllerService(revision, groupId, controllerService); + controllerServiceResource.populateRemainingControllerServiceEntityContent(entity); + + // build the response + return generateCreatedResponse(URI.create(entity.getUri()), entity).build(); + } + ); + } + + /** + * Initiates the request to replace the Process Group with the given ID with the Process Group in the given import entity + * + * @param groupId The id of the process group to replace + * @param importEntity A request entity containing revision info and the process group to replace with + * @return A ProcessGroupReplaceRequestEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/replace-requests") + @Operation( + summary = "Initiate the Replace Request of a Process Group with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupReplaceRequestEntity.class))), + description = "This will initiate the action of replacing a process group with the given process group. This can be a lengthy " + + "process, as it will stop any Processors and disable any Controller Services necessary to perform the action and then restart them. As a result, " + + "the endpoint will immediately return a ProcessGroupReplaceRequestEntity, and the process of replacing the flow will occur " + + "asynchronously in the background. The client may then periodically poll the status of the request by issuing a GET request to " + + "/process-groups/replace-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/process-groups/replace-requests/{requestId}. " + NON_GUARANTEED_ENDPOINT, + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For all encapsulated components"), + @SecurityRequirement(name = "Write - if the snapshot contains any restricted components - /restricted-components"), + @SecurityRequirement(name = "Read - /parameter-contexts/{uuid} - For any Parameter Context that is referenced by a Property that is changed, added, or removed") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response initiateReplaceProcessGroup(@Parameter(description = "The process group id.", required = true) @PathParam("id") final String groupId, + @Parameter(description = "The process group replace request entity", required = true) final ProcessGroupImportEntity importEntity) { + if (importEntity == null) { + throw new IllegalArgumentException("Process Group Import Entity is required"); + } + + // replacing a flow under version control is not permitted via import. Versioned flows have additional requirements to allow + // them only to be replaced by a different version of the same flow. + if (serviceFacade.isAnyProcessGroupUnderVersionControl(groupId)) { + throw new IllegalStateException("Cannot replace a Process Group via import while it or its descendants are under Version Control."); + } + + final RegisteredFlowSnapshot versionedFlowSnapshot = importEntity.getVersionedFlowSnapshot(); + if (versionedFlowSnapshot == null) { + throw new IllegalArgumentException("Versioned Flow Snapshot must be supplied"); + } + + // remove any registry-specific versioning content which could be present if the flow was exported from registry + versionedFlowSnapshot.setFlow(null); + versionedFlowSnapshot.setBucket(null); + versionedFlowSnapshot.setSnapshotMetadata(null); + sanitizeRegistryInfo(versionedFlowSnapshot.getFlowContents()); + + final FlowSnapshotContainer flowSnapshotContainer = new FlowSnapshotContainer(versionedFlowSnapshot); + return initiateFlowUpdate(groupId, importEntity, true, "replace-requests", + "/nifi-api/process-groups/" + groupId + "/flow-contents", () -> flowSnapshotContainer); + } + + /** + * Recursively clear the registry info in the given versioned process group and all nested versioned process groups + * + * @param versionedProcessGroup the process group to sanitize + */ + private void sanitizeRegistryInfo(final VersionedProcessGroup versionedProcessGroup) { + versionedProcessGroup.setVersionedFlowCoordinates(null); + + for (final VersionedProcessGroup innerVersionedProcessGroup : versionedProcessGroup.getProcessGroups()) { + sanitizeRegistryInfo(innerVersionedProcessGroup); + } + } + + /** + * Uploads the specified versioned flow definition and adds it to a new process group. + * + * @param in The flow definition stream + * @return A processGroupEntity + */ + @POST + @Consumes(MediaType.MULTIPART_FORM_DATA) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/process-groups/upload") + @Operation( + summary = "Uploads a versioned flow definition and creates a process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response uploadProcessGroup( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId, + @Parameter( + description = "The process group name.", + required = true + ) + @FormDataParam("groupName") final String groupName, + @Parameter( + description = "The process group X position.", + required = true + ) + @FormDataParam("positionX") final Double positionX, + @Parameter( + description = "The process group Y position.", + required = true + ) + @FormDataParam("positionY") final Double positionY, + @Parameter( + description = "The client id.", + required = true + ) + @FormDataParam("clientId") final String clientId, + @Parameter(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.") + @FormDataParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, + @FormDataParam("file") final InputStream in) throws InterruptedException { + + // ensure the group name is specified + if (StringUtils.isBlank(groupName)) { + throw new IllegalArgumentException("The process group name is required."); + } + + if (StringUtils.isBlank(groupId)) { + throw new IllegalArgumentException("The parent process group id is required"); + } + + if (positionX == null) { + throw new IllegalArgumentException("The x coordinate of the proposed position must be specified."); + } + + if (positionY == null) { + throw new IllegalArgumentException("The y coordinate of the proposed position must be specified."); + } + + if (StringUtils.isBlank(clientId)) { + throw new IllegalArgumentException("The client id must be specified"); + } + + // deserialize InputStream to a VersionedFlowSnapshot + RegisteredFlowSnapshot deserializedSnapshot; + + try { + deserializedSnapshot = MAPPER.readValue(in, RegisteredFlowSnapshot.class); + } catch (IOException e) { + logger.warn("Deserialization of uploaded JSON failed", e); + throw new IllegalArgumentException("Deserialization of uploaded JSON failed", e); + } + + // clear Registry info + sanitizeRegistryInfo(deserializedSnapshot.getFlowContents()); + + // resolve Bundle info + serviceFacade.discoverCompatibleBundles(deserializedSnapshot.getFlowContents()); + + // if there are any Controller Services referenced that are inherited from the parent group, + // resolve those to point to the appropriate Controller Service, if we are able to. + final FlowSnapshotContainer flowSnapshotContainer = new FlowSnapshotContainer(deserializedSnapshot); + serviceFacade.resolveInheritedControllerServices(flowSnapshotContainer, groupId, NiFiUserUtils.getNiFiUser()); + + // If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to. + serviceFacade.resolveParameterProviders(deserializedSnapshot, NiFiUserUtils.getNiFiUser()); + + if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(disconnectedNodeAcknowledged); + } + + // create a PositionDTO + final PositionDTO positionDTO = new PositionDTO(); + positionDTO.setX(positionX); + positionDTO.setY(positionY); + + // create a RevisionDTO + RevisionDTO revisionDTO = new RevisionDTO(); + revisionDTO.setClientId(clientId); + revisionDTO.setVersion((long) 0); + + // build the response entity for a replicate request + ProcessGroupUploadEntity pgUploadEntity = new ProcessGroupUploadEntity(); + pgUploadEntity.setGroupId(groupId); + pgUploadEntity.setGroupName(groupName); + pgUploadEntity.setDisconnectedNodeAcknowledged(disconnectedNodeAcknowledged); + pgUploadEntity.setFlowSnapshot(deserializedSnapshot); + pgUploadEntity.setPositionDTO(positionDTO); + pgUploadEntity.setRevisionDTO(revisionDTO); + + // replicate the request + if (isReplicateRequest()) { + // convert request accordingly + final UriBuilder uriBuilder = uriInfo.getBaseUriBuilder(); + uriBuilder.segment("process-groups", groupId, "process-groups", "import"); + final URI importUri = uriBuilder.build(); + + final Map headersToOverride = new HashMap<>(); + headersToOverride.put("content-type", MediaType.APPLICATION_JSON); + + // Determine whether we should replicate only to the cluster coordinator, or if we should replicate directly + // to the cluster nodes themselves. + if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) { + return getRequestReplicator().replicate(HttpMethod.POST, importUri, pgUploadEntity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse(); + } else { + return getRequestReplicator().forwardToCoordinator( + getClusterCoordinatorNode(), HttpMethod.POST, importUri, pgUploadEntity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse(); + } + } + + // otherwise import the process group locally + return importProcessGroup(groupId, pgUploadEntity); + } + + /** + * Imports the specified process group. + * + * @param processGroupUploadEntity A ProcessGroupUploadEntity. + * @return A processGroupEntity. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/process-groups/import") + @Operation( + summary = "Imports a specified process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response importProcessGroup( + @Parameter( + description = "The process group id.", + required = true + ) + @PathParam("id") final String groupId, + final ProcessGroupUploadEntity processGroupUploadEntity) { + + // verify the process group was specified + if (processGroupUploadEntity == null || processGroupUploadEntity.getFlowSnapshot() == null) { + throw new IllegalArgumentException("Process group details must be specified."); + } + + final RegisteredFlowSnapshot versionedFlowSnapshot = processGroupUploadEntity.getFlowSnapshot(); + + // clear Registry info + sanitizeRegistryInfo(versionedFlowSnapshot.getFlowContents()); + + // resolve Bundle info + serviceFacade.discoverCompatibleBundles(versionedFlowSnapshot.getFlowContents()); + + // if there are any Controller Services referenced that are inherited from the parent group, + // resolve those to point to the appropriate Controller Service, if we are able to. + final FlowSnapshotContainer flowSnapshotContainer = new FlowSnapshotContainer(versionedFlowSnapshot); + serviceFacade.resolveInheritedControllerServices(flowSnapshotContainer, groupId, NiFiUserUtils.getNiFiUser()); + + // If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to. + serviceFacade.resolveParameterProviders(versionedFlowSnapshot, NiFiUserUtils.getNiFiUser()); + + if (isReplicateRequest()) { + return replicate(HttpMethod.POST, processGroupUploadEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(processGroupUploadEntity.getDisconnectedNodeAcknowledged()); + } + + // create a new ProcessGroupEntity + final ProcessGroupEntity newProcessGroupEntity = createProcessGroupEntity(groupId, processGroupUploadEntity.getGroupName(), processGroupUploadEntity.getPositionDTO(), versionedFlowSnapshot); + + return withWriteLock( + serviceFacade, + newProcessGroupEntity, + lookup -> authorizeAccess(groupId, newProcessGroupEntity, lookup), + () -> { + final RegisteredFlowSnapshot newVersionedFlowSnapshot = newProcessGroupEntity.getVersionedFlowSnapshot(); + if (newVersionedFlowSnapshot != null) { + serviceFacade.verifyComponentTypes(newVersionedFlowSnapshot.getFlowContents()); + } + }, + processGroupEntity -> { + final ProcessGroupDTO processGroup = processGroupEntity.getComponent(); + + // set the processor id as appropriate + processGroup.setId(generateUuid()); + + // get the versioned flow + final RegisteredFlowSnapshot flowSnapshot = processGroupEntity.getVersionedFlowSnapshot(); + + // create the process group contents + final Revision revision = new Revision((long) 0, processGroupUploadEntity.getRevisionDTO().getClientId(), processGroup.getId()); + + ProcessGroupEntity entity = serviceFacade.createProcessGroup(revision, groupId, processGroup); + + if (flowSnapshot != null) { + final RevisionDTO revisionDto = entity.getRevision(); + final String newGroupId = entity.getComponent().getId(); + final Revision newGroupRevision = new Revision(revisionDto.getVersion(), revisionDto.getClientId(), newGroupId); + + // We don't want the Process Group's position to be updated because we want to keep the position where the user + // placed the Process Group. We do not want to use the name of the Process Group that is in the Flow Contents. + // To accomplish this, we call updateProcessGroupContents() passing 'false' for the updateSettings flag, set + // the Process Group name, and null out the position. + flowSnapshot.getFlowContents().setPosition(null); + flowSnapshot.getFlowContents().setName(processGroupUploadEntity.getGroupName()); + + entity = serviceFacade.updateProcessGroupContents(newGroupRevision, newGroupId, null, flowSnapshot, + getIdGenerationSeed().orElse(null), false, false, true); + } + + populateRemainingProcessGroupEntityContent(entity); + + // generate a 201 created response + String uri = entity.getUri(); + return generateCreatedResponse(URI.create(uri), entity).build(); + } + ); + + } + + + /** + * Replace the Process Group contents with the given ID with the specified Process Group contents. + *

+ * This is the endpoint used in a cluster update replication scenario. + * + * @param groupId The id of the process group to replace + * @param importEntity A request entity containing revision info and the process group to replace with + * @return A ProcessGroupImportEntity. + */ + @PUT + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/flow-contents") + @Operation( + summary = "Replace Process Group contents with the given ID with the specified Process Group contents", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupImportEntity.class))), + description = "This endpoint is used for replication within a cluster, when replacing a flow with a new flow. It expects that the flow being" + + "replaced is not under version control and that the given snapshot will not modify any Processor that is currently running " + + "or any Controller Service that is enabled. " + + NON_GUARANTEED_ENDPOINT, + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - /process-groups/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response replaceProcessGroup(@Parameter(description = "The process group id.", required = true) @PathParam("id") final String groupId, + @Parameter(description = "The process group replace request entity.", required = true) final ProcessGroupImportEntity importEntity) { + // Verify the request + if (importEntity == null) { + throw new IllegalArgumentException("Process Group Import Entity is required"); + } + + final RevisionDTO revisionDto = importEntity.getProcessGroupRevision(); + if (revisionDto == null) { + throw new IllegalArgumentException("Process Group Revision must be specified."); + } + + final RegisteredFlowSnapshot requestFlowSnapshot = importEntity.getVersionedFlowSnapshot(); + if (requestFlowSnapshot == null) { + throw new IllegalArgumentException("Versioned Flow Snapshot must be supplied."); + } + + // Perform the request + if (isReplicateRequest()) { + return replicate(HttpMethod.PUT, importEntity); + } else if (isDisconnectedFromCluster()) { + verifyDisconnectedNodeModification(importEntity.isDisconnectedNodeAcknowledged()); + } + + final Revision requestRevision = getRevision(importEntity.getProcessGroupRevision(), groupId); + return withWriteLock( + serviceFacade, + importEntity, + requestRevision, + lookup -> { + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + final Authorizable processGroup = groupAuthorizable.getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + () -> { + // We do not enforce that the Process Group is 'not dirty' because at this point, + // the client has explicitly indicated the dataflow that the Process Group should + // provide and provided the Revision to ensure that they have the most up-to-date + // view of the Process Group. + serviceFacade.verifyCanUpdate(groupId, requestFlowSnapshot, true, false); + }, + (revision, entity) -> { + final ProcessGroupEntity updatedGroup = + performUpdateFlow(groupId, revision, importEntity, entity.getVersionedFlowSnapshot(), + getIdGenerationSeed().orElse(null), false, true); + + // response to replication request is an entity with revision info but no versioned flow snapshot + final ProcessGroupImportEntity responseEntity = new ProcessGroupImportEntity(); + responseEntity.setProcessGroupRevision(updatedGroup.getRevision()); + + return generateOkResponse(responseEntity).build(); + }); + } + + /** + * Retrieve a request to replace a Process Group by request ID. + * + * @param replaceRequestId The ID of the replace request + * @return A ProcessGroupReplaceRequestEntity. + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("replace-requests/{id}") + @Operation( + summary = "Returns the Replace Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupReplaceRequestEntity.class))), + description = "Returns the Replace Request with the given ID. Once a Replace Request has been created by performing a POST to /process-groups/{id}/replace-requests, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. " + + NON_GUARANTEED_ENDPOINT, + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getReplaceProcessGroupRequest( + @Parameter(description = "The ID of the Replace Request") @PathParam("id") final String replaceRequestId) { + return retrieveFlowUpdateRequest("replace-requests", replaceRequestId); + } + + @DELETE + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("replace-requests/{id}") + @Operation( + summary = "Deletes the Replace Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupReplaceRequestEntity.class))), + description = "Deletes the Replace Request with the given ID. After a request is created via a POST to /process-groups/{id}/replace-requests, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Replace process has completed. If the request is deleted before the request " + + "completes, then the Replace request will finish the step that it is currently performing and then will cancel any subsequent steps. " + + NON_GUARANTEED_ENDPOINT, + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response deleteReplaceProcessGroupRequest( + @Parameter(description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.") + @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) + @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, + @Parameter(description = "The ID of the Update Request") + @PathParam("id") final String replaceRequestId + ) { + return deleteFlowUpdateRequest("replace-requests", replaceRequestId, disconnectedNodeAcknowledged.booleanValue()); + } + + // ------------- + // flow-analysis + // ------------- + + /** + * Submits a request to run a flow analysis. + * + * @param processGroupId The id of the process group representing (a part of) the flow to be analyzed + * @return An AnalyzeFlowRequestEntity + */ + @POST + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/flow-analysis-requests") + @Operation( + summary = "Executes a flow analysis for components within a given process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AnalyzeFlowRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid} - For this and all encapsulated process groups") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response submitAnalyzeFlowRequest( + @Parameter( + description = "The id of the process group representing (a part of) the flow to be analyzed.", + required = true + ) + @PathParam("id") final String processGroupId + ) { + if (isReplicateRequest()) { + return replicate(HttpMethod.POST); + } + + NiFiUser user = NiFiUserUtils.getNiFiUser(); + + ProcessGroupEntity requestProcessGroupEntity = new ProcessGroupEntity(); + requestProcessGroupEntity.setId(processGroupId); + + return withWriteLock( + serviceFacade, + requestProcessGroupEntity, + lookup -> { + final ProcessGroupAuthorizable processGroup = lookup.getProcessGroup(processGroupId); + processGroup.getAuthorizable().authorize(authorizer, RequestAction.READ, user); + }, + null, + (processGroupEntity) -> { + String analyzedGroupId = processGroupEntity.getId(); + + final String requestId = generateUuid(); + final AsynchronousWebRequest analyzeFlowAsyncWebRequest = new StandardAsynchronousWebRequest<>( + requestId, + analyzedGroupId, + analyzedGroupId, + user, + Collections.singletonList(new StandardUpdateStep("Analyze Process Group")) + ); + + // Submit the request to be performed in the background + final Consumer> analyzeFlowTask = asyncRequest -> { + try { + serviceFacade.analyzeProcessGroup(analyzedGroupId); + asyncRequest.markStepComplete(); + } catch (final Exception e) { + logger.error("Failed to run flow analysis on process group {}", processGroupId, e); + asyncRequest.fail("Failed to run flow analysis on process group " + processGroupId + " due to " + e); + } + }; + flowAnalysisAsyncRequestManager.submitRequest( + FLOW_ANALYSIS_REQUEST_TYPE, + requestId, + analyzeFlowAsyncWebRequest, + analyzeFlowTask + ); + + return generateOkResponse(createAnalyzeFlowRequestEntity(analyzeFlowAsyncWebRequest, requestId)).build(); + } + ); + } + + /** + * Checks the status of an outstanding request for a flow analysis. + * + * @param requestId The id of flow analysis request + * @return An analyzeFlowRequestEntity + */ + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/flow-analysis-requests/{requestId}") + @Operation( + summary = "Gets the current status of a flow analysis request.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AnalyzeFlowRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid} - For this and all encapsulated process groups") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response getAnalyzeFlowRequest( + @Parameter( + description = "The id of the process group representing (a part of) the flow being analyzed.", + required = true + ) + @PathParam("id") final String processGroupId, + @Parameter( + description = "The id of the process group representing (a part of) the flow to be analyzed.", + required = true + ) + @PathParam("requestId") final String requestId + ) { + if (isReplicateRequest()) { + return replicate(HttpMethod.GET); + } + + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + + // request manager will ensure that the current is the user that submitted this request + final AsynchronousWebRequest asyncRequest = + flowAnalysisAsyncRequestManager.getRequest(FLOW_ANALYSIS_REQUEST_TYPE, requestId, user); + + return generateOkResponse(createAnalyzeFlowRequestEntity(asyncRequest, requestId)).build(); + } + + /** + * Cancels the specified flow analysis request. + * + * @param httpServletRequest request + * @param requestId The id of the flow analysis request + * @return An analyzeFlowRequestEntity + */ + @DELETE + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("{id}/flow-analysis-requests/{requestId}") + @Operation( + summary = "Cancels a flow analysis request.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AnalyzeFlowRequestEntity.class))), + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid} - For this and all encapsulated process groups") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response removeAnalyzeFlowRequest( + @Parameter( + description = "The id of the process group representing (a part of) the flow being analyzed.", + required = true + ) + @PathParam("id") final String processGroupId, + @Context final HttpServletRequest httpServletRequest, + @Parameter( + description = "The id of the flow analysis request", + required = true + ) + @PathParam("requestId") final String requestId + ) { + if (isReplicateRequest()) { + return replicate(HttpMethod.DELETE); + } + + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + final boolean twoPhaseRequest = isTwoPhaseRequest(httpServletRequest); + final boolean executionPhase = isExecutionPhase(httpServletRequest); + + // If this is a standalone node, or if this is the execution phase of the request, perform the actual request. + if (!twoPhaseRequest || executionPhase) { + // request manager will ensure that the current is the user that submitted this request + final AsynchronousWebRequest asyncRequest = + flowAnalysisAsyncRequestManager.removeRequest(FLOW_ANALYSIS_REQUEST_TYPE, requestId, user); + + if (asyncRequest == null) { + throw new ResourceNotFoundException("Could not find request of type " + FLOW_ANALYSIS_REQUEST_TYPE + " with ID " + requestId); + } + + if (!asyncRequest.isComplete()) { + asyncRequest.cancel(); + } + + AnalyzeFlowRequestEntity analyzeFlowRequestEntity = createAnalyzeFlowRequestEntity(asyncRequest, requestId); + return generateOkResponse(analyzeFlowRequestEntity).build(); + } + + if (isValidationPhase(httpServletRequest)) { + // Perform authorization by attempting to get the request + flowAnalysisAsyncRequestManager.getRequest(FLOW_ANALYSIS_REQUEST_TYPE, requestId, user); + return generateContinueResponse().build(); + } else if (isCancellationPhase(httpServletRequest)) { + return generateOkResponse().build(); + } else { + throw new IllegalStateException("This request does not appear to be part of the two phase commit."); + } + } + + private AnalyzeFlowRequestEntity createAnalyzeFlowRequestEntity( + final AsynchronousWebRequest asyncRequest, + final String requestId + ) { + String analyzedGroupId = asyncRequest.getRequest(); + + AnalyzeFlowRequestDTO responseDto = new AnalyzeFlowRequestDTO(); + responseDto.setProcessGroupId(analyzedGroupId); + + responseDto.setRequestId(requestId); + responseDto.setComplete(asyncRequest.isComplete()); + responseDto.setFailureReason(asyncRequest.getFailureReason()); + responseDto.setLastUpdated(asyncRequest.getLastUpdated()); + responseDto.setPercentCompleted(asyncRequest.getPercentComplete()); + responseDto.setState(asyncRequest.getState()); + responseDto.setUri(generateResourceUri("process-groups", "flow-analysis", analyzedGroupId)); + + final List updateSteps = new ArrayList<>(); + for (final UpdateStep updateStep : asyncRequest.getUpdateSteps()) { + final AnalyzeFlowRequestUpdateStepDTO updateStepDTO = new AnalyzeFlowRequestUpdateStepDTO(); + updateStepDTO.setDescription(updateStep.getDescription()); + updateStepDTO.setComplete(updateStep.isComplete()); + updateStepDTO.setFailureReason(updateStep.getFailureReason()); + updateSteps.add(updateStepDTO); + } + responseDto.setUpdateSteps(updateSteps); + + AnalyzeFlowRequestEntity analyzeFlowRequestEntity = new AnalyzeFlowRequestEntity(); + analyzeFlowRequestEntity.setAnalyzeFlowRequest(responseDto); + + return analyzeFlowRequestEntity; + } + //-- + + /** + * Perform actual flow update of the specified flow. This is used for the initial flow update and replication updates. + */ + @Override + protected ProcessGroupEntity performUpdateFlow(final String groupId, final Revision revision, final ProcessGroupImportEntity requestEntity, + final RegisteredFlowSnapshot flowSnapshot, final String idGenerationSeed, + final boolean verifyNotModified, final boolean updateDescendantVersionedFlows) { + logger.info("Replacing Process Group with ID {} with imported Process Group with ID {}", groupId, flowSnapshot.getFlowContents().getIdentifier()); + + // Update Process Group to the new flow (including name) + return serviceFacade.updateProcessGroupContents(revision, groupId, null, flowSnapshot, idGenerationSeed, verifyNotModified, + true, updateDescendantVersionedFlows); + } + + /** + * Create the entity that is used for update flow replication. The initial replace request entity can be re-used for the replication request. + */ + @Override + protected Entity createReplicateUpdateFlowEntity(final Revision revision, final ProcessGroupImportEntity requestEntity, + final RegisteredFlowSnapshot flowSnapshot) { + return requestEntity; + } + + /** + * Create the entity that captures the status and result of a replace request + * + * @return a new instance of a ProcessGroupReplaceRequestEntity + */ + @Override + protected ProcessGroupReplaceRequestEntity createUpdateRequestEntity() { + return new ProcessGroupReplaceRequestEntity(); + } + + /** + * Finalize a completed update request for an existing replace request. This is used when retrieving and deleting a replace request. + *

+ * A completed request will contain the updated VersionedFlowSnapshot + * + * @param requestEntity the request entity to finalize + */ + @Override + protected void finalizeCompletedUpdateRequest(final ProcessGroupReplaceRequestEntity requestEntity) { + final ProcessGroupReplaceRequestDTO updateRequestDto = requestEntity.getRequest(); + if (updateRequestDto.isComplete()) { + final RegisteredFlowSnapshot versionedFlowSnapshot = + serviceFacade.getCurrentFlowSnapshotByGroupId(updateRequestDto.getProcessGroupId()); + requestEntity.setVersionedFlowSnapshot(versionedFlowSnapshot); + } + } + + /** + * Creates a new ProcessGroupEntity with the specified VersionedFlowSnapshot. + * + * @param groupId the group id string + * @param groupName the process group name string + * @param positionDTO the process group PositionDTO + * @param deserializedSnapshot the deserialized snapshot + * @return a new ProcessGroupEntity + */ + private ProcessGroupEntity createProcessGroupEntity( + String groupId, String groupName, PositionDTO positionDTO, RegisteredFlowSnapshot deserializedSnapshot) { + + final ProcessGroupEntity processGroupEntity = new ProcessGroupEntity(); + + // create a ProcessGroupDTO + final ProcessGroupDTO processGroupDTO = new ProcessGroupDTO(); + processGroupDTO.setParentGroupId(groupId); + processGroupDTO.setName(groupName); + + processGroupEntity.setComponent(processGroupDTO); + processGroupEntity.setVersionedFlowSnapshot(deserializedSnapshot); + + // set the ProcessGroupEntity position + processGroupEntity.getComponent().setPosition(positionDTO); + + return processGroupEntity; + } + + /** + * Authorizes access to a Parameter Context and RestrictedComponents resource. + * + * @param groupId the group id string + * @param processGroupEntity the ProcessGroupEntity + * @param lookup the lookup + */ + private void authorizeAccess(String groupId, ProcessGroupEntity processGroupEntity, AuthorizableLookup lookup) { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, user); + + // if request specifies a Parameter Context, need to authorize that user has READ policy for the Parameter Context. + final ParameterContextReferenceEntity referencedParamContext = processGroupEntity.getComponent().getParameterContext(); + if (referencedParamContext != null && referencedParamContext.getId() != null) { + lookup.getParameterContext(referencedParamContext.getId()).authorize(authorizer, RequestAction.READ, user); + } + + // if any of the components is a Restricted Component, then we must authorize the user + // for write access to the RestrictedComponents resource + final RegisteredFlowSnapshot versionedFlowSnapshot = processGroupEntity.getVersionedFlowSnapshot(); + if (versionedFlowSnapshot != null) { + final Set restrictedComponents = FlowRegistryUtils.getRestrictedComponents(versionedFlowSnapshot.getFlowContents(), serviceFacade); + restrictedComponents.forEach(restrictedComponent -> { + final ComponentAuthorizable restrictedComponentAuthorizable = lookup.getConfigurableComponent(restrictedComponent); + authorizeRestrictions(authorizer, restrictedComponentAuthorizable); + }); + + final Map parameterContexts = versionedFlowSnapshot.getParameterContexts(); + if (parameterContexts != null) { + parameterContexts.values().forEach(context -> AuthorizeParameterReference.authorizeParameterContextAddition(context, serviceFacade, authorizer, lookup, user)); + } + } + } + + // setters + + public void setProcessorResource(ProcessorResource processorResource) { + this.processorResource = processorResource; + } + + public void setInputPortResource(InputPortResource inputPortResource) { + this.inputPortResource = inputPortResource; + } + + public void setOutputPortResource(OutputPortResource outputPortResource) { + this.outputPortResource = outputPortResource; + } + + public void setFunnelResource(FunnelResource funnelResource) { + this.funnelResource = funnelResource; + } + + public void setLabelResource(LabelResource labelResource) { + this.labelResource = labelResource; + } + + public void setRemoteProcessGroupResource(RemoteProcessGroupResource remoteProcessGroupResource) { + this.remoteProcessGroupResource = remoteProcessGroupResource; + } + + public void setConnectionResource(ConnectionResource connectionResource) { + this.connectionResource = connectionResource; + } + + public void setControllerServiceResource(ControllerServiceResource controllerServiceResource) { + this.controllerServiceResource = controllerServiceResource; + } + + public void setParameterContextReplacer(ParameterContextReplacer parameterContextReplacer) { + this.parameterContextReplacer = parameterContextReplacer; + } + + private static class DropEntity extends Entity { + final String entityId; + final String dropRequestId; + + public DropEntity(String entityId, String dropRequestId) { + this.entityId = entityId; + this.dropRequestId = dropRequestId; + } + + public String getEntityId() { + return entityId; + } + + public String getDropRequestId() { + return dropRequestId; + } + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java index 95573b2bb2..703e160d35 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java @@ -16,22 +16,22 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -96,13 +96,7 @@ import org.slf4j.LoggerFactory; * RESTful endpoint for managing a Processor. */ @Path("/processors") -@Api( - value = "/processors", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Processor.") -}) +@Tag(name = "Processors") public class ProcessorResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ProcessorResource.class); @@ -202,25 +196,25 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") - @ApiOperation( - value = "Gets a processor", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Read - /processors/{uuid}") + @Operation( + summary = "Gets a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /processors/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProcessor( - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id) throws InterruptedException { @@ -248,25 +242,24 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/run-status-details/queries") - @ApiOperation( - value = "Submits a query to retrieve the run status details of all processors that are in the given list of Processor IDs", - response = ProcessorsRunStatusDetailsEntity.class, - authorizations = { - @Authorization(value = "Read - /processors/{uuid} for each processor whose run status information is requested") - } + @Operation( + summary = "Submits a query to retrieve the run status details of all processors that are in the given list of Processor IDs", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorsRunStatusDetailsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /processors/{uuid} for each processor whose run status information is requested") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response getProcessorRunStatusDetails( - @ApiParam(value = "The request for the processors that should be included in the results") - final RunStatusDetailsRequestEntity requestEntity) { + @Parameter(description = "The request for the processors that should be included in the results") final RunStatusDetailsRequestEntity requestEntity) { if (requestEntity.getProcessorIds() == null) { throw new IllegalArgumentException("List of Processor IDs must be provided"); @@ -277,13 +270,14 @@ public class ProcessorResource extends ApplicationResource { } return withWriteLock(serviceFacade, - requestEntity, - lookup -> {}, - null, - providedEntity -> { - final ProcessorsRunStatusDetailsEntity entity = serviceFacade.getProcessorsRunStatusDetails(requestEntity.getProcessorIds(), NiFiUserUtils.getNiFiUser()); - return generateOkResponse(entity).build(); - }); + requestEntity, + lookup -> { + }, + null, + providedEntity -> { + final ProcessorsRunStatusDetailsEntity entity = serviceFacade.getProcessorsRunStatusDetails(requestEntity.getProcessorIds(), NiFiUserUtils.getNiFiUser()); + return generateOkResponse(entity).build(); + }); } @@ -291,18 +285,24 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/threads") - @ApiOperation(value = "Terminates a processor, essentially \"deleting\" its threads and any active tasks", response = ProcessorEntity.class, authorizations = { - @Authorization(value = "Write - /processors/{uuid} or /operation/processors/{uuid}") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Terminates a processor, essentially \"deleting\" its threads and any active tasks", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /processors/{uuid} or /operation/processors/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response terminateProcessor( - @ApiParam(value = "The processor id.", required = true) @PathParam("id") final String id) { + @Parameter(description = "The processor id.", required = true) @PathParam("id") final String id) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -312,39 +312,44 @@ public class ProcessorResource extends ApplicationResource { requestProcessorEntity.setId(id); return withWriteLock( - serviceFacade, - requestProcessorEntity, - lookup -> { - final Authorizable authorizable = lookup.getProcessor(id).getAuthorizable(); - OperationAuthorizable.authorizeOperation(authorizable, authorizer, NiFiUserUtils.getNiFiUser()); - }, - () -> serviceFacade.verifyTerminateProcessor(id), - processorEntity -> { - final ProcessorEntity entity = serviceFacade.terminateProcessor(processorEntity.getId()); - populateRemainingProcessorEntityContent(entity); + serviceFacade, + requestProcessorEntity, + lookup -> { + final Authorizable authorizable = lookup.getProcessor(id).getAuthorizable(); + OperationAuthorizable.authorizeOperation(authorizable, authorizer, NiFiUserUtils.getNiFiUser()); + }, + () -> serviceFacade.verifyTerminateProcessor(id), + processorEntity -> { + final ProcessorEntity entity = serviceFacade.terminateProcessor(processorEntity.getId()); + populateRemainingProcessorEntityContent(entity); - return generateOkResponse(entity).build(); - }); + return generateOkResponse(entity).build(); + }); } @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/diagnostics") - @ApiOperation(value = "Gets diagnostics information about a processor", - response = ProcessorEntity.class, - notes = NON_GUARANTEED_ENDPOINT, - authorizations = { @Authorization(value = "Read - /processors/{uuid}")} + @Operation( + summary = "Gets diagnostics information about a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + description = NON_GUARANTEED_ENDPOINT, + security = { + @SecurityRequirement(name = "Read - /processors/{uuid}") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) public Response getProcessorDiagnostics( - @ApiParam(value = "The processor id.", required = true) @PathParam("id") final String id) throws InterruptedException { + @Parameter(description = "The processor id.", required = true) @PathParam("id") final String id) throws InterruptedException { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -367,7 +372,7 @@ public class ProcessorResource extends ApplicationResource { /** * Returns the descriptor for the specified property. * - * @param id The id of the processor + * @param id The id of the processor * @param propertyName The property * @return a propertyDescriptorEntity * @throws InterruptedException if interrupted @@ -376,42 +381,38 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/descriptors") - @ApiOperation( - value = "Gets the descriptor for a processor property", - response = PropertyDescriptorEntity.class, - authorizations = { - @Authorization(value = "Read - /processors/{uuid}") + @Operation( + summary = "Gets the descriptor for a processor property", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /processors/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPropertyDescriptor( - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The property name.", + @Parameter( + description = "The property name.", required = true ) @QueryParam("propertyName") final String propertyName, - @ApiParam( - value = "Property Descriptor requested sensitive status", - defaultValue = "false" - ) + @Parameter(description = "Property Descriptor requested sensitive status") @QueryParam("sensitive") final boolean sensitive ) throws InterruptedException { @@ -452,25 +453,25 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/state") - @ApiOperation( - value = "Gets the state for a processor", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /processors/{uuid}") + @Operation( + summary = "Gets the state for a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /processors/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getState( - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id) throws InterruptedException { @@ -499,8 +500,7 @@ public class ProcessorResource extends ApplicationResource { /** * Clears the state for a processor. * - * @param httpServletRequest servlet request - * @param id The id of the processor + * @param id The id of the processor * @return a componentStateEntity * @throws InterruptedException if interrupted */ @@ -508,26 +508,25 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state/clear-requests") - @ApiOperation( - value = "Clears the state for a processor", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /processors/{uuid}") + @Operation( + summary = "Clears the state for a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /processors/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response clearState( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id) throws InterruptedException { @@ -565,25 +564,25 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/analysis") - @ApiOperation( - value = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - response = ConfigurationAnalysisEntity.class, - authorizations = { - @Authorization(value = "Read - /processors/{uuid}") - } + @Operation( + summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), + security = { + @SecurityRequirement(name = "Read - /processors/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response analyzeConfiguration( - @ApiParam(value = "The processor id.", required = true) @PathParam("id") final String processorId, - @ApiParam(value = "The processor configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { + @Parameter(description = "The processor id.", required = true) @PathParam("id") final String processorId, + @Parameter(description = "The processor configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { if (configurationAnalysis == null || configurationAnalysis.getConfigurationAnalysis() == null) { throw new IllegalArgumentException("Processor's configuration must be specified"); @@ -607,18 +606,19 @@ public class ProcessorResource extends ApplicationResource { } return withWriteLock( - serviceFacade, - configurationAnalysis, - lookup -> { - final ComponentAuthorizable processor = lookup.getProcessor(processorId); - processor.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> { }, - entity -> { - final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); - final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeProcessorConfiguration(analysis.getComponentId(), analysis.getProperties()); - return generateOkResponse(resultsEntity).build(); - } + serviceFacade, + configurationAnalysis, + lookup -> { + final ComponentAuthorizable processor = lookup.getProcessor(processorId); + processor.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + }, + entity -> { + final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); + final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeProcessorConfiguration(analysis.getComponentId(), analysis.getProperties()); + return generateOkResponse(resultsEntity).build(); + } ); } @@ -627,30 +627,30 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/verification-requests") - @ApiOperation( - value = "Performs verification of the Processor's configuration", - response = VerifyConfigRequestEntity.class, - notes = "This will initiate the process of verifying a given Processor configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + - "ProcessorConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + - "The client may then periodically poll the status of the request by " + - "issuing a GET request to /processors/{processorId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + - "/processors/{processorId}/verification-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /processors/{uuid}") - } + @Operation( + summary = "Performs verification of the Processor's configuration", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "This will initiate the process of verifying a given Processor configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + + "ProcessorConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + + "The client may then periodically poll the status of the request by " + + "issuing a GET request to /processors/{processorId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/processors/{processorId}/verification-requests/{requestId}.", + security = { + @SecurityRequirement(name = "Read - /processors/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response submitProcessorVerificationRequest( - @ApiParam(value = "The processor id.", required = true) @PathParam("id") final String processorId, - @ApiParam(value = "The processor configuration verification request.", required = true) final VerifyConfigRequestEntity processorConfigRequest) { + @Parameter(description = "The processor id.", required = true) @PathParam("id") final String processorId, + @Parameter(description = "The processor configuration verification request.", required = true) final VerifyConfigRequestEntity processorConfigRequest) { if (processorConfigRequest == null) { throw new IllegalArgumentException("Processor's configuration must be specified"); @@ -676,16 +676,16 @@ public class ProcessorResource extends ApplicationResource { final NiFiUser user = NiFiUserUtils.getNiFiUser(); return withWriteLock( - serviceFacade, - processorConfigRequest, - lookup -> { - final ComponentAuthorizable processor = lookup.getProcessor(processorId); - processor.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> { - serviceFacade.verifyCanVerifyProcessorConfig(processorId); - }, - entity -> performAsyncConfigVerification(entity, user) + serviceFacade, + processorConfigRequest, + lookup -> { + final ComponentAuthorizable processor = lookup.getProcessor(processorId); + processor.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + serviceFacade.verifyCanVerifyProcessorConfig(processorId); + }, + entity -> performAsyncConfigVerification(entity, user) ); } @@ -693,25 +693,28 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Returns the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getVerificationRequest( - @ApiParam("The ID of the Processor") @PathParam("id") final String processorId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Processor") @PathParam("id") final String processorId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -731,25 +734,28 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Deletes the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteVerificationRequest( - @ApiParam("The ID of the Processor") @PathParam("id") final String processorId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Processor") @PathParam("id") final String processorId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -788,41 +794,39 @@ public class ProcessorResource extends ApplicationResource { /** * Updates the specified processor with the specified values. * - * @param httpServletRequest request - * @param id The id of the processor to update. - * @param requestProcessorEntity A processorEntity. + * @param id The id of the processor to update. + * @param requestProcessorEntity A processorEntity. * @return A processorEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") - @ApiOperation( - value = "Updates a processor", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Write - /processors/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") + @Operation( + summary = "Updates a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /processors/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateProcessor( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The processor configuration details.", + @Parameter( + description = "The processor configuration details.", required = true ) final ProcessorEntity requestProcessorEntity) { @@ -907,10 +911,9 @@ public class ProcessorResource extends ApplicationResource { /** * Removes the specified processor. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the processor to remove. + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the processor to remove. * @return A processorEntity. * @throws InterruptedException if interrupted */ @@ -918,43 +921,39 @@ public class ProcessorResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") - @ApiOperation( - value = "Deletes a processor", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Write - /processors/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}") + @Operation( + summary = "Deletes a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /processors/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteProcessor( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id) throws InterruptedException { @@ -999,40 +998,38 @@ public class ProcessorResource extends ApplicationResource { /** * Updates the operational status for the specified processor with the specified values. * - * @param httpServletRequest request - * @param id The id of the processor to update. - * @param requestRunStatus A processorEntity. + * @param id The id of the processor to update. + * @param requestRunStatus A processorEntity. * @return A processorEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/run-status") - @ApiOperation( - value = "Updates run status of a processor", - response = ProcessorEntity.class, - authorizations = { - @Authorization(value = "Write - /processors/{uuid} or /operation/processors/{uuid}") + @Operation( + summary = "Updates run status of a processor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), + security = { + @SecurityRequirement(name = "Write - /processors/{uuid} or /operation/processors/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRunStatus( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The processor id.", + @Parameter( + description = "The processor id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The processor run status.", + @Parameter( + description = "The processor run status.", required = true ) final ProcessorRunStatusEntity requestRunStatus) { @@ -1092,7 +1089,7 @@ public class ProcessorResource extends ApplicationResource { final List updateSteps = Collections.singletonList(new StandardUpdateStep("Verify Processor Configuration")); final AsynchronousWebRequest> request = - new StandardAsynchronousWebRequest<>(requestId, processorConfigRequest, processorId, user, updateSteps); + new StandardAsynchronousWebRequest<>(requestId, processorConfigRequest, processorId, user, updateSteps); // Submit the request to be performed in the background final Consumer>> updateTask = asyncRequest -> { @@ -1114,8 +1111,8 @@ public class ProcessorResource extends ApplicationResource { } private VerifyConfigRequestEntity createVerifyProcessorConfigRequestEntity( - final AsynchronousWebRequest> asyncRequest, - final String requestId) { + final AsynchronousWebRequest> asyncRequest, + final String requestId) { final VerifyConfigRequestDTO requestDto = asyncRequest.getRequest().getRequest(); final List resultsList = asyncRequest.getResults(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceEventResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceEventResource.java index 6e85b440d9..966dde9e09 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceEventResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceEventResource.java @@ -16,19 +16,20 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URI; import java.util.Collections; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -69,13 +70,7 @@ import org.slf4j.LoggerFactory; * RESTful endpoint for querying data provenance. */ @Path("/provenance-events") -@Api( - value = "/provenance-events", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for accessing data flow provenance.") -}) +@Tag(name = "ProvenanceEvents") public class ProvenanceEventResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ProvenanceEventResource.class); @@ -86,38 +81,37 @@ public class ProvenanceEventResource extends ApplicationResource { * Gets the content for the input of the specified event. * * @param clusterNodeId The id of the node within the cluster this content is on. Required if clustered. - * @param id The id of the provenance event associated with this content. + * @param id The id of the provenance event associated with this content. * @return The content stream */ @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("{id}/content/input") - @ApiOperation( - value = "Gets the input content for a provenance event", - response = StreamingOutput.class, - authorizations = { - @Authorization(value = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), - @Authorization(value = "Read Component Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets the input content for a provenance event", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), + security = { + @SecurityRequirement(name = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), + @SecurityRequirement(name = "Read Component Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getInputContent( - @ApiParam( - value = "The id of the node where the content exists if clustered.", - required = false + @Parameter( + description = "The id of the node where the content exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "The provenance event id.", + @Parameter( + description = "The provenance event id.", required = true ) @PathParam("id") final LongParameter id) { @@ -170,38 +164,37 @@ public class ProvenanceEventResource extends ApplicationResource { * Gets the content for the output of the specified event. * * @param clusterNodeId The id of the node within the cluster this content is on. Required if clustered. - * @param id The id of the provenance event associated with this content. + * @param id The id of the provenance event associated with this content. * @return The content stream */ @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("{id}/content/output") - @ApiOperation( - value = "Gets the output content for a provenance event", - response = StreamingOutput.class, - authorizations = { - @Authorization(value = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), - @Authorization(value = "Read Component Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets the output content for a provenance event", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), + security = { + @SecurityRequirement(name = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), + @SecurityRequirement(name = "Read Component Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getOutputContent( - @ApiParam( - value = "The id of the node where the content exists if clustered.", - required = false + @Parameter( + description = "The id of the node where the content exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "The provenance event id.", + @Parameter( + description = "The provenance event id.", required = true ) @PathParam("id") final LongParameter id) { @@ -253,7 +246,7 @@ public class ProvenanceEventResource extends ApplicationResource { /** * Gets the details for a provenance event. * - * @param id The id of the event + * @param id The id of the event * @param clusterNodeId The id of node in the cluster that the event/flowfile originated from. This is only required when clustered. * @return A provenanceEventEntity */ @@ -261,30 +254,29 @@ public class ProvenanceEventResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a provenance event", - response = ProvenanceEventEntity.class, - authorizations = { - @Authorization(value = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}") + @Operation( + summary = "Gets a provenance event", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProvenanceEventEntity.class))), + security = { + @SecurityRequirement(name = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProvenanceEvent( - @ApiParam( - value = "The id of the node where this event exists if clustered.", - required = false + @Parameter( + description = "The id of the node where this event exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "The provenance event id.", + @Parameter( + description = "The provenance event id.", required = true ) @PathParam("id") final LongParameter id) { @@ -330,7 +322,6 @@ public class ProvenanceEventResource extends ApplicationResource { /** * Triggers the latest Provenance Event for the specified component to be replayed. * - * @param httpServletRequest request * @param requestEntity The replay request * @return A replayLastEventResponseEntity */ @@ -338,30 +329,29 @@ public class ProvenanceEventResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("latest/replays") - @ApiOperation( - value = "Replays content from a provenance event", - response = ReplayLastEventResponseEntity.class, - authorizations = { - @Authorization(value = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), - @Authorization(value = "Read Component Data - /data/{component-type}/{uuid}"), - @Authorization(value = "Write Component Data - /data/{component-type}/{uuid}") - } + @Operation( + summary = "Replays content from a provenance event", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReplayLastEventResponseEntity.class))), + security = { + @SecurityRequirement(name = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), + @SecurityRequirement(name = "Read Component Data - /data/{component-type}/{uuid}"), + @SecurityRequirement(name = "Write Component Data - /data/{component-type}/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response submitReplayLatestEvent( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The replay request.", - required = true - ) final ReplayLastEventRequestEntity requestEntity) { + @Parameter( + description = "The replay request.", + required = true + ) final ReplayLastEventRequestEntity requestEntity) { // ensure the event id is specified if (requestEntity == null || requestEntity.getComponentId() == null) { @@ -387,48 +377,49 @@ public class ProvenanceEventResource extends ApplicationResource { } return withWriteLock( - serviceFacade, - requestEntity, - lookup -> { - final Authorizable provenance = lookup.getProvenance(); - provenance.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> {}, // No verification step necessary - this can be done any time - entity -> { - final ReplayLastEventSnapshotDTO aggregateSnapshot = new ReplayLastEventSnapshotDTO(); + serviceFacade, + requestEntity, + lookup -> { + final Authorizable provenance = lookup.getProvenance(); + provenance.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + }, // No verification step necessary - this can be done any time + entity -> { + final ReplayLastEventSnapshotDTO aggregateSnapshot = new ReplayLastEventSnapshotDTO(); - // Submit provenance query - try { - final ProvenanceEventDTO provenanceEventDto = serviceFacade.submitReplayLastEvent(entity.getComponentId()); + // Submit provenance query + try { + final ProvenanceEventDTO provenanceEventDto = serviceFacade.submitReplayLastEvent(entity.getComponentId()); - if (provenanceEventDto == null) { - aggregateSnapshot.setEventAvailable(false); - } else { - aggregateSnapshot.setEventAvailable(true); - aggregateSnapshot.setEventsReplayed(Collections.singleton(provenanceEventDto.getEventId())); + if (provenanceEventDto == null) { + aggregateSnapshot.setEventAvailable(false); + } else { + aggregateSnapshot.setEventAvailable(true); + aggregateSnapshot.setEventsReplayed(Collections.singleton(provenanceEventDto.getEventId())); + } + } catch (final AccessDeniedException ade) { + logger.error("Failed to replay latest Provenance Event", ade); + aggregateSnapshot.setFailureExplanation("Access Denied"); + } catch (final Exception e) { + logger.error("Failed to replay latest Provenance Event", e); + aggregateSnapshot.setFailureExplanation(e.getMessage()); } - } catch (final AccessDeniedException ade) { - logger.error("Failed to replay latest Provenance Event", ade); - aggregateSnapshot.setFailureExplanation("Access Denied"); - } catch (final Exception e) { - logger.error("Failed to replay latest Provenance Event", e); - aggregateSnapshot.setFailureExplanation(e.getMessage()); - } - final ReplayLastEventResponseEntity responseEntity = new ReplayLastEventResponseEntity(); - responseEntity.setComponentId(entity.getComponentId()); - responseEntity.setNodes(entity.getNodes()); - responseEntity.setAggregateSnapshot(aggregateSnapshot); + final ReplayLastEventResponseEntity responseEntity = new ReplayLastEventResponseEntity(); + responseEntity.setComponentId(entity.getComponentId()); + responseEntity.setNodes(entity.getNodes()); + responseEntity.setAggregateSnapshot(aggregateSnapshot); - return generateOkResponse(responseEntity).build(); - }); + return generateOkResponse(responseEntity).build(); + }); } /** * Creates a new replay request for the content associated with the specified provenance event id. * - * @param httpServletRequest request + * @param httpServletRequest request * @param replayRequestEntity The replay request * @return A provenanceEventEntity */ @@ -436,28 +427,28 @@ public class ProvenanceEventResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("replays") - @ApiOperation( - value = "Replays content from a provenance event", - response = ProvenanceEventEntity.class, - authorizations = { - @Authorization(value = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), - @Authorization(value = "Read Component Data - /data/{component-type}/{uuid}"), - @Authorization(value = "Write Component Data - /data/{component-type}/{uuid}") + @Operation( + summary = "Replays content from a provenance event", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProvenanceEventEntity.class))), + security = { + @SecurityRequirement(name = "Read Component Provenance Data - /provenance-data/{component-type}/{uuid}"), + @SecurityRequirement(name = "Read Component Data - /data/{component-type}/{uuid}"), + @SecurityRequirement(name = "Write Component Data - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response submitReplay( @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The replay request.", + @Parameter( + description = "The replay request.", required = true ) final SubmitReplayRequestEntity replayRequestEntity) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java index e85a6d56a0..2819cf154f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java @@ -16,18 +16,18 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.HashMap; import java.util.Map; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -38,7 +38,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.nifi.authorization.Authorizer; @@ -61,13 +60,7 @@ import org.apache.nifi.web.api.entity.ProvenanceOptionsEntity; * RESTful endpoint for querying data provenance. */ @Path("/provenance") -@Api( - value = "/provenance", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for accessing data flow provenance.") -}) +@Tag(name = "Provenance") public class ProvenanceResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -113,19 +106,19 @@ public class ProvenanceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("search-options") - @ApiOperation( - value = "Gets the searchable attributes for provenance events", - response = ProvenanceOptionsEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance") + @Operation( + summary = "Gets the searchable attributes for provenance events", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProvenanceOptionsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getSearchOptions() { @@ -150,40 +143,36 @@ public class ProvenanceResource extends ApplicationResource { /** * Creates provenance using the specified query criteria. * - * @param httpServletRequest request - * @param requestProvenanceEntity A provenanceEntity + * @param requestProvenanceEntity A provenanceEntity * @return A provenanceEntity */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @Path("") // necessary due to bug in swagger - @ApiOperation( - value = "Submits a provenance query", - notes = "Provenance queries may be long running so this endpoint submits a request. The response will include the " + @Path("") + @Operation( + summary = "Submits a provenance query", + description = "Provenance queries may be long running so this endpoint submits a request. The response will include the " + "current state of the query. If the request is not completed the URI in the response can be used at a " + "later time to get the updated state of the query. Once the query has completed the provenance request " + "should be deleted by the client who originally submitted it.", - response = ProvenanceEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance"), - @Authorization(value = "Read - /data/{component-type}/{uuid}") + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProvenanceEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance"), + @SecurityRequirement(name = "Read - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response submitProvenanceRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The provenance query details.", - required = true - ) ProvenanceEntity requestProvenanceEntity) { + @Parameter(description = "The provenance query details.", required = true) + ProvenanceEntity requestProvenanceEntity) { // check the request if (requestProvenanceEntity == null) { @@ -250,7 +239,7 @@ public class ProvenanceResource extends ApplicationResource { /** * Gets the provenance with the specified id. * - * @param id The id of the provenance + * @param id The id of the provenance * @param clusterNodeId The id of node in the cluster to search. This is optional and only relevant when clustered. If clustered and it is not specified the entire cluster is searched. * @return A provenanceEntity */ @@ -258,42 +247,39 @@ public class ProvenanceResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a provenance query", - response = ProvenanceEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance"), - @Authorization(value = "Read - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets a provenance query", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProvenanceEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance"), + @SecurityRequirement(name = "Read - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getProvenance( - @ApiParam( - value = "The id of the node where this query exists if clustered.", - required = false + @Parameter( + description = "The id of the node where this query exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "Whether or not incremental results are returned. If false, provenance events" - + " are only returned once the query completes. This property is true by default.", - required = false + @Parameter( + description = "Whether or not incremental results are returned. If false, provenance events" + + " are only returned once the query completes. This property is true by default." ) @QueryParam("summarize") @DefaultValue(value = "false") final Boolean summarize, - @ApiParam( - value = "Whether or not to summarize provenance events returned. This property is false by default.", - required = false + @Parameter( + description = "Whether or not to summarize provenance events returned. This property is false by default." ) @QueryParam("incrementalResults") @DefaultValue(value = "true") final Boolean incrementalResults, - @ApiParam( - value = "The id of the provenance query.", + @Parameter( + description = "The id of the provenance query.", required = true ) @PathParam("id") final String id) { @@ -327,40 +313,37 @@ public class ProvenanceResource extends ApplicationResource { /** * Deletes the provenance with the specified id. * - * @param httpServletRequest request - * @param id The id of the provenance - * @param clusterNodeId The id of node in the cluster to search. This is optional and only relevant when clustered. If clustered and it is not specified the entire cluster is searched. + * @param id The id of the provenance + * @param clusterNodeId The id of node in the cluster to search. This is optional and only relevant when clustered. If clustered and it is not specified the entire cluster is searched. * @return A provenanceEntity */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a provenance query", - response = ProvenanceEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance") + @Operation( + summary = "Deletes a provenance query", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProvenanceEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteProvenance( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The id of the node where this query exists if clustered.", - required = false + @Parameter( + description = "The id of the node where this query exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "The id of the provenance query.", + @Parameter( + description = "The id of the provenance query.", required = true ) @PathParam("id") final String id) { @@ -402,39 +385,37 @@ public class ProvenanceResource extends ApplicationResource { *

* When querying for the lineage of a flowfile you must specify the uuid. The eventId and eventDirection cannot be specified in this case. * - * @param httpServletRequest request - * @param requestLineageEntity A lineageEntity + * @param requestLineageEntity A lineageEntity * @return A lineageEntity */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("lineage") - @ApiOperation( - value = "Submits a lineage query", - notes = "Lineage queries may be long running so this endpoint submits a request. The response will include the " + @Operation( + summary = "Submits a lineage query", + description = "Lineage queries may be long running so this endpoint submits a request. The response will include the " + "current state of the query. If the request is not completed the URI in the response can be used at a " + "later time to get the updated state of the query. Once the query has completed the lineage request " + "should be deleted by the client who originally submitted it.", - response = LineageEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance"), - @Authorization(value = "Read - /data/{component-type}/{uuid}") + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LineageEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance"), + @SecurityRequirement(name = "Read - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response submitLineageRequest( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The lineage query details.", + @Parameter( + description = "The lineage query details.", required = true ) final LineageEntity requestLineageEntity) { @@ -506,38 +487,37 @@ public class ProvenanceResource extends ApplicationResource { * Gets the lineage with the specified id. * * @param clusterNodeId The id of node in the cluster that the event/flowfile originated from. This is only required when clustered. - * @param id The id of the lineage + * @param id The id of the lineage * @return A lineageEntity */ @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("lineage/{id}") - @ApiOperation( - value = "Gets a lineage query", - response = LineageEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance"), - @Authorization(value = "Read - /data/{component-type}/{uuid}") + @Operation( + summary = "Gets a lineage query", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LineageEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance"), + @SecurityRequirement(name = "Read - /data/{component-type}/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getLineage( - @ApiParam( - value = "The id of the node where this query exists if clustered.", - required = false + @Parameter( + description = "The id of the node where this query exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "The id of the lineage query.", + @Parameter( + description = "The id of the lineage query.", required = true ) @PathParam("id") final String id) { @@ -564,40 +544,37 @@ public class ProvenanceResource extends ApplicationResource { /** * Deletes the lineage with the specified id. * - * @param httpServletRequest request - * @param clusterNodeId The id of node in the cluster that the event/flowfile originated from. This is only required when clustered. - * @param id The id of the lineage + * @param clusterNodeId The id of node in the cluster that the event/flowfile originated from. This is only required when clustered. + * @param id The id of the lineage * @return A lineageEntity */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("lineage/{id}") - @ApiOperation( - value = "Deletes a lineage query", - response = LineageEntity.class, - authorizations = { - @Authorization(value = "Read - /provenance") + @Operation( + summary = "Deletes a lineage query", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LineageEntity.class))), + security = { + @SecurityRequirement(name = "Read - /provenance") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteLineage( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The id of the node where this query exists if clustered.", - required = false + @Parameter( + description = "The id of the node where this query exists if clustered." ) @QueryParam("clusterNodeId") final String clusterNodeId, - @ApiParam( - value = "The id of the lineage query.", + @Parameter( + description = "The id of the lineage query.", required = true ) @PathParam("id") final String id) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java index 31524fb00c..70f1ac13c3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java @@ -16,18 +16,18 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.Set; import java.util.stream.Collectors; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -38,7 +38,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -68,13 +67,7 @@ import org.apache.nifi.web.api.request.LongParameter; * RESTful endpoint for managing a Remote group. */ @Path("/remote-process-groups") -@Api( - value = "/remote-process-groups", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Remote Process Group.") -}) +@Tag(name = "RemoteProcessGroups") public class RemoteProcessGroupResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -114,25 +107,25 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a remote process group", - response = RemoteProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Read - /remote-process-groups/{uuid}") + @Operation( + summary = "Gets a remote process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Read - /remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getRemoteProcessGroup( - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") final String id) { @@ -157,52 +150,47 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Removes the specified remote process group. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. - * @param id The id of the remote process group to be removed. + * @param version The revision is used to verify the client is working with the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a new one will be generated. This value (whether specified or generated) is included in the response. + * @param id The id of the remote process group to be removed. * @return A remoteProcessGroupEntity. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a remote process group", - response = RemoteProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid}"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}") + @Operation( + summary = "Deletes a remote process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeRemoteProcessGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") final String id) { @@ -242,9 +230,8 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the specified remote process group input port. * - * @param httpServletRequest request - * @param id The id of the remote process group to update. - * @param portId The id of the input port to update. + * @param id The id of the remote process group to update. + * @param portId The id of the input port to update. * @param requestRemoteProcessGroupPortEntity The remoteProcessGroupPortEntity * @return A remoteProcessGroupPortEntity */ @@ -252,37 +239,36 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/input-ports/{port-id}") - @ApiOperation( - value = "Updates a remote port", - notes = NON_GUARANTEED_ENDPOINT, - response = RemoteProcessGroupPortEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid}") + @Operation( + summary = "Updates a remote port", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupPortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroupInputPort( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The remote process group port id.", + @Parameter( + description = "The remote process group port id.", required = true ) @PathParam("port-id") final String portId, - @ApiParam( - value = "The remote process group port.", + @Parameter( + description = "The remote process group port.", required = true ) final RemoteProcessGroupPortEntity requestRemoteProcessGroupPortEntity) { @@ -345,9 +331,8 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the specified remote process group output port. * - * @param httpServletRequest request - * @param id The id of the remote process group to update. - * @param portId The id of the output port to update. + * @param id The id of the remote process group to update. + * @param portId The id of the output port to update. * @param requestRemoteProcessGroupPortEntity The remoteProcessGroupPortEntity * @return A remoteProcessGroupPortEntity */ @@ -355,37 +340,36 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/output-ports/{port-id}") - @ApiOperation( - value = "Updates a remote port", - notes = NON_GUARANTEED_ENDPOINT, - response = RemoteProcessGroupPortEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid}") + @Operation( + summary = "Updates a remote port", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupPortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroupOutputPort( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") String id, - @ApiParam( - value = "The remote process group port id.", + @Parameter( + description = "The remote process group port id.", required = true ) @PathParam("port-id") String portId, - @ApiParam( - value = "The remote process group port.", + @Parameter( + description = "The remote process group port.", required = true ) RemoteProcessGroupPortEntity requestRemoteProcessGroupPortEntity) { @@ -449,9 +433,8 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the specified remote process group input port run status. * - * @param httpServletRequest request - * @param id The id of the remote process group to update. - * @param portId The id of the input port to update. + * @param id The id of the remote process group to update. + * @param portId The id of the input port to update. * @param requestRemotePortRunStatusEntity The remoteProcessGroupPortRunStatusEntity * @return A remoteProcessGroupPortEntity */ @@ -459,37 +442,36 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/input-ports/{port-id}/run-status") - @ApiOperation( - value = "Updates run status of a remote port", - notes = NON_GUARANTEED_ENDPOINT, - response = RemoteProcessGroupPortEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") + @Operation( + summary = "Updates run status of a remote port", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupPortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroupInputPortRunStatus( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The remote process group port id.", + @Parameter( + description = "The remote process group port id.", required = true ) @PathParam("port-id") final String portId, - @ApiParam( - value = "The remote process group port.", + @Parameter( + description = "The remote process group port.", required = true ) final RemotePortRunStatusEntity requestRemotePortRunStatusEntity) { @@ -548,9 +530,8 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the specified remote process group output port run status. * - * @param httpServletRequest request - * @param id The id of the remote process group to update. - * @param portId The id of the output port to update. + * @param id The id of the remote process group to update. + * @param portId The id of the output port to update. * @param requestRemotePortRunStatusEntity The remoteProcessGroupPortEntity * @return A remoteProcessGroupPortEntity */ @@ -558,37 +539,36 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/output-ports/{port-id}/run-status") - @ApiOperation( - value = "Updates run status of a remote port", - notes = NON_GUARANTEED_ENDPOINT, - response = RemoteProcessGroupPortEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") + @Operation( + summary = "Updates run status of a remote port", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupPortEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroupOutputPortRunStatus( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") String id, - @ApiParam( - value = "The remote process group port id.", + @Parameter( + description = "The remote process group port id.", required = true ) @PathParam("port-id") String portId, - @ApiParam( - value = "The remote process group port.", + @Parameter( + description = "The remote process group port.", required = true ) RemotePortRunStatusEntity requestRemotePortRunStatusEntity) { @@ -640,8 +620,7 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the specified remote process group. * - * @param httpServletRequest request - * @param id The id of the remote process group to update. + * @param id The id of the remote process group to update. * @param requestRemoteProcessGroupEntity A remoteProcessGroupEntity. * @return A remoteProcessGroupEntity. */ @@ -649,31 +628,30 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a remote process group", - response = RemoteProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid}") + @Operation( + summary = "Updates a remote process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroup( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") String id, - @ApiParam( - value = "The remote process group.", + @Parameter( + description = "The remote process group.", required = true ) final RemoteProcessGroupEntity requestRemoteProcessGroupEntity) { @@ -763,8 +741,7 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the operational status for the specified remote process group with the specified value. * - * @param httpServletRequest request - * @param id The id of the remote process group to update. + * @param id The id of the remote process group to update. * @param requestRemotePortRunStatusEntity A remotePortRunStatusEntity. * @return A remoteProcessGroupEntity. */ @@ -772,31 +749,30 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/run-status") - @ApiOperation( - value = "Updates run status of a remote process group", - response = RemoteProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") + @Operation( + summary = "Updates run status of a remote process group", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroupRunStatus( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The remote process group id.", + @Parameter( + description = "The remote process group id.", required = true ) @PathParam("id") String id, - @ApiParam( - value = "The remote process group run status.", + @Parameter( + description = "The remote process group run status.", required = true ) final RemotePortRunStatusEntity requestRemotePortRunStatusEntity) { @@ -840,40 +816,38 @@ public class RemoteProcessGroupResource extends ApplicationResource { /** * Updates the operational status for all remote process groups in the specified process group with the specified value. * - * @param httpServletRequest request - * @param processGroupId The id of the process group in which all remote process groups to update. - * @param requestRemotePortRunStatusEntity A remotePortRunStatusEntity that holds the desired run status + * @param processGroupId The id of the process group in which all remote process groups to update. + * @param requestRemotePortRunStatusEntity A remotePortRunStatusEntity that holds the desired run status * @return A response with an array of RemoteProcessGroupEntity objects. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("process-group/{id}/run-status") - @ApiOperation( - value = "Updates run status of all remote process groups in a process group (recursively)", - response = RemoteProcessGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") + @Operation( + summary = "Updates run status of all remote process groups in a process group (recursively)", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid} or /operation/remote-process-groups/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRemoteProcessGroupRunStatuses( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The process group id.", + @Parameter( + description = "The process group id.", required = true ) @PathParam("id") String processGroupId, - @ApiParam( - value = "The remote process groups run status.", + @Parameter( + description = "The remote process groups run status.", required = true ) final RemotePortRunStatusEntity requestRemotePortRunStatusEntity ) { @@ -891,47 +865,48 @@ public class RemoteProcessGroupResource extends ApplicationResource { // handle expects request (usually from the cluster manager) final Set revisions = serviceFacade.getRevisionsFromGroup( - processGroupId, - group -> group.findAllRemoteProcessGroups().stream() - .filter(remoteProcessGroup -> - requestRemotePortRunStatusEntity.getState().equals("TRANSMITTING") && !remoteProcessGroup.isTransmitting() - || requestRemotePortRunStatusEntity.getState().equals("STOPPED") && remoteProcessGroup.isTransmitting() - ) - .filter(remoteProcessGroup -> OperationAuthorizable.isOperationAuthorized(remoteProcessGroup, authorizer, NiFiUserUtils.getNiFiUser())) - .map(RemoteProcessGroup::getIdentifier) - .collect(Collectors.toSet()) + processGroupId, + group -> group.findAllRemoteProcessGroups().stream() + .filter(remoteProcessGroup -> + requestRemotePortRunStatusEntity.getState().equals("TRANSMITTING") && !remoteProcessGroup.isTransmitting() + || requestRemotePortRunStatusEntity.getState().equals("STOPPED") && remoteProcessGroup.isTransmitting() + ) + .filter(remoteProcessGroup -> OperationAuthorizable.isOperationAuthorized(remoteProcessGroup, authorizer, NiFiUserUtils.getNiFiUser())) + .map(RemoteProcessGroup::getIdentifier) + .collect(Collectors.toSet()) ); return withWriteLock( - serviceFacade, - requestRemotePortRunStatusEntity, - revisions, - lookup -> { - final ProcessGroupAuthorizable processGroup = lookup.getProcessGroup(processGroupId); + serviceFacade, + requestRemotePortRunStatusEntity, + revisions, + lookup -> { + final ProcessGroupAuthorizable processGroup = lookup.getProcessGroup(processGroupId); - authorizeProcessGroup(processGroup, authorizer, lookup, RequestAction.READ, false, false, false, false); + authorizeProcessGroup(processGroup, authorizer, lookup, RequestAction.READ, false, false, false, false); - Set remoteProcessGroups = processGroup.getEncapsulatedRemoteProcessGroups(); - for (Authorizable remoteProcessGroup : remoteProcessGroups) { - OperationAuthorizable.authorizeOperation(remoteProcessGroup, authorizer, NiFiUserUtils.getNiFiUser()); + Set remoteProcessGroups = processGroup.getEncapsulatedRemoteProcessGroups(); + for (Authorizable remoteProcessGroup : remoteProcessGroups) { + OperationAuthorizable.authorizeOperation(remoteProcessGroup, authorizer, NiFiUserUtils.getNiFiUser()); + } + }, + () -> serviceFacade.verifyUpdateRemoteProcessGroups(processGroupId, shouldTransmit(requestRemotePortRunStatusEntity)), + (_revisions, remotePortRunStatusEntity) -> { + Set remoteProcessGroupEntities = _revisions.stream() + .map(revision -> { + final RemoteProcessGroupEntity entity = serviceFacade.updateRemoteProcessGroup(revision, createDTOWithDesiredRunStatus(revision.getComponentId(), + remotePortRunStatusEntity)); + populateRemainingRemoteProcessGroupEntityContent(entity); + + return entity; + }) + .collect(Collectors.toSet()); + + RemoteProcessGroupsEntity remoteProcessGroupsEntity = new RemoteProcessGroupsEntity(); + + Response response = generateOkResponse(remoteProcessGroupsEntity).build(); + + return response; } - }, - () -> serviceFacade.verifyUpdateRemoteProcessGroups(processGroupId, shouldTransmit(requestRemotePortRunStatusEntity)), - (_revisions, remotePortRunStatusEntity) -> { - Set remoteProcessGroupEntities = _revisions.stream() - .map(revision -> { - final RemoteProcessGroupEntity entity = serviceFacade.updateRemoteProcessGroup(revision, createDTOWithDesiredRunStatus(revision.getComponentId(), remotePortRunStatusEntity)); - populateRemainingRemoteProcessGroupEntityContent(entity); - - return entity; - }) - .collect(Collectors.toSet()); - - RemoteProcessGroupsEntity remoteProcessGroupsEntity = new RemoteProcessGroupsEntity(); - - Response response = generateOkResponse(remoteProcessGroupsEntity).build(); - - return response; - } ); } @@ -946,28 +921,28 @@ public class RemoteProcessGroupResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/state") - @ApiOperation( - value = "Gets the state for a RemoteProcessGroup", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /remote-process-groups/{uuid}") - } + @Operation( + summary = "Gets the state for a RemoteProcessGroup", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /remote-process-groups/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response getState( - @ApiParam( - value = "The processor id.", - required = true - ) - @PathParam("id") final String id) throws InterruptedException { + @Parameter( + description = "The processor id.", + required = true + ) + @PathParam("id") final String id) throws InterruptedException { if (isReplicateRequest()) { return replicate(HttpMethod.GET); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java index 5548b9246e..452022e0ac 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java @@ -16,21 +16,21 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -88,13 +88,7 @@ import org.slf4j.LoggerFactory; * RESTful endpoint for managing a Reporting Task. */ @Path("/reporting-tasks") -@Api( - value = "/reporting-tasks", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing a Reporting Task.") -}) +@Tag(name = "ReportingTasks") public class ReportingTaskResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ReportingTaskResource.class); @@ -170,25 +164,25 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Gets a reporting task", - response = ReportingTaskEntity.class, - authorizations = { - @Authorization(value = "Read - /reporting-tasks/{uuid}") + @Operation( + summary = "Gets a reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), + security = { + @SecurityRequirement(name = "Read - /reporting-tasks/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getReportingTask( - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") final String id) { @@ -213,7 +207,7 @@ public class ReportingTaskResource extends ApplicationResource { /** * Returns the descriptor for the specified property. * - * @param id The id of the reporting task. + * @param id The id of the reporting task. * @param propertyName The property * @return a propertyDescriptorEntity */ @@ -221,36 +215,35 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/descriptors") - @ApiOperation( - value = "Gets a reporting task property descriptor", - response = PropertyDescriptorEntity.class, - authorizations = { - @Authorization(value = "Read - /reporting-tasks/{uuid}") + @Operation( + summary = "Gets a reporting task property descriptor", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), + security = { + @SecurityRequirement(name = "Read - /reporting-tasks/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPropertyDescriptor( - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The property name.", + @Parameter( + description = "The property name.", required = true ) @QueryParam("propertyName") final String propertyName, - @ApiParam( - value = "Property Descriptor requested sensitive status", - defaultValue = "false" + @Parameter( + description = "Property Descriptor requested sensitive status" ) @QueryParam("sensitive") final boolean sensitive ) { @@ -291,25 +284,25 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state") - @ApiOperation( - value = "Gets the state for a reporting task", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /reporting-tasks/{uuid}") + @Operation( + summary = "Gets the state for a reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /reporting-tasks/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getState( - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") final String id) { @@ -338,34 +331,32 @@ public class ReportingTaskResource extends ApplicationResource { /** * Clears the state for a reporting task. * - * @param httpServletRequest servlet request - * @param id The id of the reporting task + * @param id The id of the reporting task * @return a componentStateEntity */ @POST @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/state/clear-requests") - @ApiOperation( - value = "Clears the state for a reporting task", - response = ComponentStateEntity.class, - authorizations = { - @Authorization(value = "Write - /reporting-tasks/{uuid}") + @Operation( + summary = "Clears the state for a reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), + security = { + @SecurityRequirement(name = "Write - /reporting-tasks/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response clearState( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") final String id) { @@ -401,8 +392,7 @@ public class ReportingTaskResource extends ApplicationResource { /** * Updates the specified a Reporting Task. * - * @param httpServletRequest request - * @param id The id of the reporting task to update. + * @param id The id of the reporting task to update. * @param requestReportingTaskEntity A reportingTaskEntity. * @return A reportingTaskEntity. */ @@ -410,32 +400,31 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Updates a reporting task", - response = ReportingTaskEntity.class, - authorizations = { - @Authorization(value = "Write - /reporting-tasks/{uuid}"), - @Authorization(value = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") + @Operation( + summary = "Updates a reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), + security = { + @SecurityRequirement(name = "Write - /reporting-tasks/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateReportingTask( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The reporting task configuration details.", + @Parameter( + description = "The reporting task configuration details.", required = true ) final ReportingTaskEntity requestReportingTaskEntity) { @@ -490,56 +479,51 @@ public class ReportingTaskResource extends ApplicationResource { /** * Removes the specified reporting task. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the reporting task to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the reporting task to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes a reporting task", - response = ReportingTaskEntity.class, - authorizations = { - @Authorization(value = "Write - /reporting-tasks/{uuid}"), - @Authorization(value = "Write - /controller"), - @Authorization(value = "Read - any referenced Controller Services - /controller-services/{uuid}") + @Operation( + summary = "Deletes a reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), + security = { + @SecurityRequirement(name = "Write - /reporting-tasks/{uuid}"), + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeReportingTask( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") String id) { @@ -583,8 +567,7 @@ public class ReportingTaskResource extends ApplicationResource { /** * Updates the operational status for the specified ReportingTask with the specified values. * - * @param httpServletRequest request - * @param id The id of the reporting task to update. + * @param id The id of the reporting task to update. * @param requestRunStatus A runStatusEntity. * @return A reportingTaskEntity. */ @@ -592,31 +575,30 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/run-status") - @ApiOperation( - value = "Updates run status of a reporting task", - response = ReportingTaskEntity.class, - authorizations = { - @Authorization(value = "Write - /reporting-tasks/{uuid} or or /operation/reporting-tasks/{uuid}") + @Operation( + summary = "Updates run status of a reporting task", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), + security = { + @SecurityRequirement(name = "Write - /reporting-tasks/{uuid} or or /operation/reporting-tasks/{uuid}") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateRunStatus( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The reporting task id.", + @Parameter( + description = "The reporting task id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The reporting task run status.", + @Parameter( + description = "The reporting task run status.", required = true ) final ReportingTaskRunStatusEntity requestRunStatus) { @@ -662,25 +644,25 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/analysis") - @ApiOperation( - value = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - response = ConfigurationAnalysisEntity.class, - authorizations = { - @Authorization(value = "Read - /reporting-tasks/{uuid}") - } + @Operation( + summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), + security = { + @SecurityRequirement(name = "Read - /reporting-tasks/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response analyzeConfiguration( - @ApiParam(value = "The reporting task id.", required = true) @PathParam("id") final String reportingTaskId, - @ApiParam(value = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { + @Parameter(description = "The reporting task id.", required = true) @PathParam("id") final String reportingTaskId, + @Parameter(description = "The configuration analysis request.", required = true) final ConfigurationAnalysisEntity configurationAnalysis) { if (configurationAnalysis == null || configurationAnalysis.getConfigurationAnalysis() == null) { throw new IllegalArgumentException("Reporting Tasks's configuration must be specified"); @@ -704,18 +686,19 @@ public class ReportingTaskResource extends ApplicationResource { } return withWriteLock( - serviceFacade, - configurationAnalysis, - lookup -> { - final ComponentAuthorizable reportingTask = lookup.getReportingTask(reportingTaskId); - reportingTask.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> { }, - entity -> { - final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); - final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeReportingTaskConfiguration(analysis.getComponentId(), analysis.getProperties()); - return generateOkResponse(resultsEntity).build(); - } + serviceFacade, + configurationAnalysis, + lookup -> { + final ComponentAuthorizable reportingTask = lookup.getReportingTask(reportingTaskId); + reportingTask.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + }, + entity -> { + final ConfigurationAnalysisDTO analysis = entity.getConfigurationAnalysis(); + final ConfigurationAnalysisEntity resultsEntity = serviceFacade.analyzeReportingTaskConfiguration(analysis.getComponentId(), analysis.getProperties()); + return generateOkResponse(resultsEntity).build(); + } ); } @@ -723,30 +706,30 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/config/verification-requests") - @ApiOperation( - value = "Performs verification of the Reporting Task's configuration", - response = VerifyConfigRequestEntity.class, - notes = "This will initiate the process of verifying a given Reporting Task configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + - "ReportingTaskConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + - "The client may then periodically poll the status of the request by " + - "issuing a GET request to /reporting-tasks/{taskId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + - "/reporting-tasks/{serviceId}/verification-requests/{requestId}.", - authorizations = { - @Authorization(value = "Read - /reporting-tasks/{uuid}") - } + @Operation( + summary = "Performs verification of the Reporting Task's configuration", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "This will initiate the process of verifying a given Reporting Task configuration. This may be a long-running task. As a result, this endpoint will immediately return a " + + "ReportingTaskConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + + "The client may then periodically poll the status of the request by " + + "issuing a GET request to /reporting-tasks/{taskId}/verification-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/reporting-tasks/{serviceId}/verification-requests/{requestId}.", + security = { + @SecurityRequirement(name = "Read - /reporting-tasks/{uuid}") + } ) @ApiResponses( - value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - } + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } ) public Response submitConfigVerificationRequest( - @ApiParam(value = "The reporting task id.", required = true) @PathParam("id") final String reportingTaskId, - @ApiParam(value = "The reporting task configuration verification request.", required = true) final VerifyConfigRequestEntity reportingTaskConfigRequest) { + @Parameter(description = "The reporting task id.", required = true) @PathParam("id") final String reportingTaskId, + @Parameter(description = "The reporting task configuration verification request.", required = true) final VerifyConfigRequestEntity reportingTaskConfigRequest) { if (reportingTaskConfigRequest == null) { throw new IllegalArgumentException("Reporting Task's configuration must be specified"); @@ -772,16 +755,16 @@ public class ReportingTaskResource extends ApplicationResource { final NiFiUser user = NiFiUserUtils.getNiFiUser(); return withWriteLock( - serviceFacade, - reportingTaskConfigRequest, - lookup -> { - final ComponentAuthorizable reportingTask = lookup.getReportingTask(reportingTaskId); - reportingTask.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - }, - () -> { - serviceFacade.verifyCanVerifyReportingTaskConfig(reportingTaskId); - }, - entity -> performAsyncConfigVerification(entity, user) + serviceFacade, + reportingTaskConfigRequest, + lookup -> { + final ComponentAuthorizable reportingTask = lookup.getReportingTask(reportingTaskId); + reportingTask.getAuthorizable().authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + }, + () -> { + serviceFacade.verifyCanVerifyReportingTaskConfig(reportingTaskId); + }, + entity -> performAsyncConfigVerification(entity, user) ); } @@ -789,25 +772,28 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Returns the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " - + "current state of the request, and any failures. ", - authorizations = { - @Authorization(value = "Only the user that submitted the request can get it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Returns the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response getVerificationRequest( - @ApiParam("The ID of the Reporting Task") @PathParam("id") final String reportingTaskId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Reporting Task") @PathParam("id") final String reportingTaskId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.GET); @@ -828,25 +814,28 @@ public class ReportingTaskResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}/config/verification-requests/{requestId}") - @ApiOperation( - value = "Deletes the Verification Request with the given ID", - response = VerifyConfigRequestEntity.class, - notes = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - authorizations = { - @Authorization(value = "Only the user that submitted the request can remove it") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) + @Operation( + summary = "Deletes the Verification Request with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) public Response deleteVerificationRequest( - @ApiParam("The ID of the Reporting Task") @PathParam("id") final String reportingTaskId, - @ApiParam("The ID of the Verification Request") @PathParam("requestId") final String requestId) { + @Parameter(description = "The ID of the Reporting Task") @PathParam("id") final String reportingTaskId, + @Parameter(description = "The ID of the Verification Request") @PathParam("requestId") final String requestId) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); @@ -886,7 +875,6 @@ public class ReportingTaskResource extends ApplicationResource { } - public Response performAsyncConfigVerification(final VerifyConfigRequestEntity configRequest, final NiFiUser user) { // Create an asynchronous request that will occur in the background, because this request may take an indeterminate amount of time. final String requestId = generateUuid(); @@ -896,7 +884,7 @@ public class ReportingTaskResource extends ApplicationResource { final List updateSteps = Collections.singletonList(new StandardUpdateStep("Verify Reporting Task Configuration")); final AsynchronousWebRequest> request = - new StandardAsynchronousWebRequest<>(requestId, configRequest, taskId, user, updateSteps); + new StandardAsynchronousWebRequest<>(requestId, configRequest, taskId, user, updateSteps); // Submit the request to be performed in the background final Consumer>> updateTask = asyncRequest -> { @@ -917,7 +905,7 @@ public class ReportingTaskResource extends ApplicationResource { } private VerifyConfigRequestEntity createVerifyReportingTaskConfigRequestEntity( - final AsynchronousWebRequest> asyncRequest, final String requestId) { + final AsynchronousWebRequest> asyncRequest, final String requestId) { final VerifyConfigRequestDTO requestDto = asyncRequest.getRequest().getRequest(); final List resultsList = asyncRequest.getResults(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ResourceResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ResourceResource.java index 53f8560a65..ef96604ba2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ResourceResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ResourceResource.java @@ -16,14 +16,15 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.List; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.HttpMethod; @@ -43,13 +44,7 @@ import org.apache.nifi.web.api.entity.ResourcesEntity; * RESTful endpoint for retrieving system diagnostics. */ @Path("/resources") -@Api( - value = "/resources", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Provides the resources in this NiFi that can have access/authorization policies.") -}) +@Tag(name = "Resources") public class ResourceResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -70,17 +65,18 @@ public class ResourceResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Gets the available resources that support access/authorization policies", - response = ResourcesEntity.class, - authorizations = { - @Authorization(value = "Read - /resources") + @Operation( + summary = "Gets the available resources that support access/authorization policies", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ResourcesEntity.class))), + security = { + @SecurityRequirement(name = "Read - /resources") } ) @ApiResponses( value = { - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."),} + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + } ) public Response getResources() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java index 0d00d97626..0cfb22c1e3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java @@ -16,14 +16,6 @@ */ package org.apache.nifi.web.api; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; @@ -32,6 +24,14 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -70,13 +70,7 @@ import static org.apache.commons.lang3.StringUtils.isEmpty; * RESTful endpoint for managing a SiteToSite connection. */ @Path("/site-to-site") -@Api( - value = "/site-to-site", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Provide access to site to site with this NiFi.") -}) +@Tag(name = "SiteToSite") public class SiteToSiteResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(SiteToSiteResource.class); @@ -115,19 +109,19 @@ public class SiteToSiteResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Returns the details about this NiFi necessary to communicate via site to site", - response = ControllerEntity.class, - authorizations = { - @Authorization(value = "Read - /site-to-site") + @Operation( + summary = "Returns the details about this NiFi necessary to communicate via site to site", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerEntity.class))), + security = { + @SecurityRequirement(name = "Read - /site-to-site") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getSiteToSiteDetails(@Context HttpServletRequest req) { @@ -204,19 +198,19 @@ public class SiteToSiteResource extends ApplicationResource { @Path("/peers") @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) - @ApiOperation( - value = "Returns the available Peers and its status of this NiFi", - response = PeersEntity.class, - authorizations = { - @Authorization(value = "Read - /site-to-site") + @Operation( + summary = "Returns the available Peers and its status of this NiFi", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PeersEntity.class))), + security = { + @SecurityRequirement(name = "Read - /site-to-site") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getPeers(@Context HttpServletRequest req) { @@ -310,8 +304,6 @@ public class SiteToSiteResource extends ApplicationResource { return isEmpty(remoteInputHost) ? localName : remoteInputHost; } - // setters - public void setServiceFacade(final NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java index 2842566c91..bcf951976e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java @@ -16,19 +16,19 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.Set; import java.util.function.Consumer; import java.util.stream.Collectors; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -39,7 +39,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.nifi.authorization.AccessDeniedException; @@ -63,13 +62,7 @@ import org.apache.nifi.web.api.entity.SnippetEntity; * RESTful endpoint for querying dataflow snippets. */ @Path("/snippets") -@Api( - value = "/snippets", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for accessing dataflow snippets.") -}) +@Tag(name = "Snippets") public class SnippetResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; private Authorizer authorizer; @@ -109,8 +102,8 @@ public class SnippetResource extends ApplicationResource { * (including referenced services) but those will be enforced when the snippet is used. * * @param authorizer authorizer - * @param lookup lookup - * @param action action + * @param lookup lookup + * @param action action */ private void authorizeSnippetRequest(final SnippetDTO snippetRequest, final Authorizer authorizer, final AuthorizableLookup lookup, final RequestAction action) { final Consumer authorize = authorizable -> authorizable.authorize(authorizer, action, NiFiUserUtils.getNiFiUser()); @@ -133,36 +126,33 @@ public class SnippetResource extends ApplicationResource { /** * Creates a snippet based off the specified configuration. * - * @param httpServletRequest request - * @param requestSnippetEntity A snippetEntity + * @param requestSnippetEntity A snippetEntity * @return A snippetEntity */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Creates a snippet. The snippet will be automatically discarded if not used in a subsequent request after 1 minute.", - response = SnippetEntity.class, - authorizations = { - @Authorization(value = "Read or Write - /{component-type}/{uuid} - For every component (all Read or all Write) in the Snippet and their descendant components") + @Operation( + summary = "Creates a snippet. The snippet will be automatically discarded if not used in a subsequent request after 1 minute.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SnippetEntity.class))), + security = { + @SecurityRequirement(name = "Read or Write - /{component-type}/{uuid} - For every component (all Read or all Write) in the Snippet and their descendant components") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createSnippet( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The snippet configuration details.", + @Parameter( + description = "The snippet configuration details.", required = true - ) - final SnippetEntity requestSnippetEntity) { + ) final SnippetEntity requestSnippetEntity) { if (requestSnippetEntity == null || requestSnippetEntity.getSnippet() == null) { throw new IllegalArgumentException("Snippet details must be specified."); @@ -218,41 +208,39 @@ public class SnippetResource extends ApplicationResource { /** * Move's the components in this Snippet into a new Process Group. * - * @param httpServletRequest request - * @param snippetId The id of the snippet. - * @param requestSnippetEntity A snippetEntity + * @param snippetId The id of the snippet. + * @param requestSnippetEntity A snippetEntity * @return A snippetEntity */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Move's the components in this Snippet into a new Process Group and discards the snippet", - response = SnippetEntity.class, - authorizations = { - @Authorization(value = "Write Process Group - /process-groups/{uuid}"), - @Authorization(value = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components") + @Operation( + summary = "Move's the components in this Snippet into a new Process Group and discards the snippet", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SnippetEntity.class))), + security = { + @SecurityRequirement(name = "Write Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateSnippet( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - value = "The snippet id.", + @Parameter( + description = "The snippet id.", required = true ) @PathParam("id") String snippetId, - @ApiParam( - value = "The snippet configuration details.", + @Parameter( + description = "The snippet configuration details.", required = true ) final SnippetEntity requestSnippetEntity) { @@ -312,40 +300,37 @@ public class SnippetResource extends ApplicationResource { /** * Removes the specified snippet. * - * @param httpServletRequest request - * @param snippetId The id of the snippet to remove. + * @param snippetId The id of the snippet to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Deletes the components in a snippet and discards the snippet", - response = SnippetEntity.class, - authorizations = { - @Authorization(value = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components"), - @Authorization(value = "Write - Parent Process Group - /process-groups/{uuid}"), + @Operation( + summary = "Deletes the components in a snippet and discards the snippet", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SnippetEntity.class))), + security = { + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response deleteSnippet( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The snippet id.", + @Parameter( + description = "The snippet id.", required = true ) @PathParam("id") final String snippetId) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java index 7ad6ddd33b..43f64408a7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java @@ -16,15 +16,16 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Collection; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.GET; @@ -51,13 +52,7 @@ import org.apache.nifi.web.api.metrics.jmx.JmxMetricsService; * RESTful endpoint for retrieving system diagnostics. */ @Path("/system-diagnostics") -@Api( - value = "/system-diagnostics", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for accessing system diagnostics.") -}) +@Tag(name = "SystemDiagnostics") public class SystemDiagnosticsResource extends ApplicationResource { private JmxMetricsService jmxMetricsService; private NiFiServiceFacade serviceFacade; @@ -79,32 +74,29 @@ public class SystemDiagnosticsResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Gets the diagnostics for the system NiFi is running on", - response = SystemDiagnosticsEntity.class, - authorizations = { - @Authorization(value = "Read - /system") + @Operation( + summary = "Gets the diagnostics for the system NiFi is running on", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SystemDiagnosticsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /system") } ) @ApiResponses( value = { - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."),} + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."),} ) public Response getSystemDiagnostics( - @ApiParam( - value = "Whether or not to include the breakdown per node. Optional, defaults to false", - required = false + @Parameter( + description = "Whether or not to include the breakdown per node. Optional, defaults to false" ) @QueryParam("nodewise") @DefaultValue(NODEWISE) final Boolean nodewise, - @ApiParam( - value = "Whether or not to include verbose details. Optional, defaults to false", - required = false + @Parameter( + description = "Whether or not to include verbose details. Optional, defaults to false" ) @QueryParam("diagnosticLevel") @DefaultValue("BASIC") final DiagnosticLevel diagnosticLevel, - @ApiParam( - value = "The id of the node where to get the status.", - required = false + @Parameter( + description = "The id of the node where to get the status." ) @QueryParam("clusterNodeId") final String clusterNodeId) throws InterruptedException { @@ -161,28 +153,26 @@ public class SystemDiagnosticsResource extends ApplicationResource { @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Retrieve available JMX metrics", - notes = NON_GUARANTEED_ENDPOINT, - response = JmxMetricsResultsEntity.class, - authorizations = { - @Authorization(value = "Read - /system") + @Operation( + summary = "Retrieve available JMX metrics", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = JmxMetricsResultsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /system") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getJmxMetrics( - @ApiParam( - value = "Regular Expression Pattern to be applied against the ObjectName") + @Parameter(description = "Regular Expression Pattern to be applied against the ObjectName") @QueryParam("beanNameFilter") final String beanNameFilter - ) { authorizeJmxMetrics(); @@ -202,8 +192,6 @@ public class SystemDiagnosticsResource extends ApplicationResource { }); } - // setters - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java index 860ac81032..1116a9f407 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java @@ -16,18 +16,18 @@ */ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.Date; import java.util.Set; -import jakarta.servlet.http.HttpServletRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -39,7 +39,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -67,20 +66,14 @@ import org.apache.nifi.web.api.request.LongParameter; import org.apache.nifi.web.dao.AccessPolicyDAO; @Path("tenants") -@Api( - value = "tenants", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing users and user groups.") -}) +@Tag(name = "Tenants") public class TenantsResource extends ApplicationResource { private final NiFiServiceFacade serviceFacade; private final Authorizer authorizer; public TenantsResource(NiFiServiceFacade serviceFacade, Authorizer authorizer, NiFiProperties properties, RequestReplicator requestReplicator, - ClusterCoordinator clusterCoordinator, FlowController flowController) { + ClusterCoordinator clusterCoordinator, FlowController flowController) { this.serviceFacade = serviceFacade; this.authorizer = authorizer; setProperties(properties); @@ -116,35 +109,33 @@ public class TenantsResource extends ApplicationResource { /** * Creates a new user. * - * @param httpServletRequest request - * @param requestUserEntity An userEntity. + * @param requestUserEntity An userEntity. * @return An userEntity. */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("users") - @ApiOperation( - value = "Creates a user", - notes = NON_GUARANTEED_ENDPOINT, - response = UserEntity.class, - authorizations = { - @Authorization(value = "Write - /tenants") + @Operation( + summary = "Creates a user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), + security = { + @SecurityRequirement(name = "Write - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createUser( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The user configuration details.", + @Parameter( + description = "The user configuration details.", required = true ) final UserEntity requestUserEntity) { @@ -211,26 +202,26 @@ public class TenantsResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("users/{id}") - @ApiOperation( - value = "Gets a user", - notes = NON_GUARANTEED_ENDPOINT, - response = UserEntity.class, - authorizations = { - @Authorization(value = "Read - /tenants") + @Operation( + summary = "Gets a user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), + security = { + @SecurityRequirement(name = "Read - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getUser( - @ApiParam( - value = "The user id.", + @Parameter( + description = "The user id.", required = true ) @PathParam("id") final String id) { @@ -266,21 +257,21 @@ public class TenantsResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("users") - @ApiOperation( - value = "Gets all users", - notes = NON_GUARANTEED_ENDPOINT, - response = UsersEntity.class, - authorizations = { - @Authorization(value = "Read - /tenants") + @Operation( + summary = "Gets all users", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UsersEntity.class))), + security = { + @SecurityRequirement(name = "Read - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getUsers() { @@ -315,41 +306,39 @@ public class TenantsResource extends ApplicationResource { /** * Updates a user. * - * @param httpServletRequest request - * @param id The id of the user to update. - * @param requestUserEntity An userEntity. + * @param id The id of the user to update. + * @param requestUserEntity An userEntity. * @return An userEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("users/{id}") - @ApiOperation( - value = "Updates a user", - notes = NON_GUARANTEED_ENDPOINT, - response = UserEntity.class, - authorizations = { - @Authorization(value = "Write - /tenants") + @Operation( + summary = "Updates a user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), + security = { + @SecurityRequirement(name = "Write - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateUser( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The user id.", + @Parameter( + description = "The user id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The user configuration details.", + @Parameter( + description = "The user configuration details.", required = true ) final UserEntity requestUserEntity) { @@ -403,55 +392,50 @@ public class TenantsResource extends ApplicationResource { /** * Removes the specified user. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the user to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the user to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("users/{id}") - @ApiOperation( - value = "Deletes a user", - notes = NON_GUARANTEED_ENDPOINT, - response = UserEntity.class, - authorizations = { - @Authorization(value = "Write - /tenants") + @Operation( + summary = "Deletes a user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), + security = { + @SecurityRequirement(name = "Write - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeUser( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The user id.", + @Parameter( + description = "The user id.", required = true ) @PathParam("id") final String id) { @@ -516,35 +500,33 @@ public class TenantsResource extends ApplicationResource { /** * Creates a new user group. * - * @param httpServletRequest request - * @param requestUserGroupEntity An userGroupEntity. + * @param requestUserGroupEntity An userGroupEntity. * @return An userGroupEntity. */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups") - @ApiOperation( - value = "Creates a user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /tenants") + @Operation( + summary = "Creates a user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response createUserGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The user group configuration details.", + @Parameter( + description = "The user group configuration details.", required = true ) final UserGroupEntity requestUserGroupEntity) { @@ -611,26 +593,26 @@ public class TenantsResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups/{id}") - @ApiOperation( - value = "Gets a user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroupEntity.class, - authorizations = { - @Authorization(value = "Read - /tenants") + @Operation( + summary = "Gets a user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), + security = { + @SecurityRequirement(name = "Read - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getUserGroup( - @ApiParam( - value = "The user group id.", + @Parameter( + description = "The user group id.", required = true ) @PathParam("id") final String id) { @@ -666,21 +648,21 @@ public class TenantsResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups") - @ApiOperation( - value = "Gets all user groups", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroupsEntity.class, - authorizations = { - @Authorization(value = "Read - /tenants") + @Operation( + summary = "Gets all user groups", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response getUserGroups() { @@ -714,41 +696,39 @@ public class TenantsResource extends ApplicationResource { /** * Updates a user group. * - * @param httpServletRequest request - * @param id The id of the user group to update. - * @param requestUserGroupEntity An userGroupEntity. + * @param id The id of the user group to update. + * @param requestUserGroupEntity An userGroupEntity. * @return An userGroupEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups/{id}") - @ApiOperation( - value = "Updates a user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /tenants") + @Operation( + summary = "Updates a user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response updateUserGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The user group id.", + @Parameter( + description = "The user group id.", required = true ) @PathParam("id") final String id, - @ApiParam( - value = "The user group configuration details.", + @Parameter( + description = "The user group configuration details.", required = true ) final UserGroupEntity requestUserGroupEntity) { @@ -802,55 +782,50 @@ public class TenantsResource extends ApplicationResource { /** * Removes the specified user group. * - * @param httpServletRequest request - * @param version The revision is used to verify the client is working with - * the latest version of the flow. - * @param clientId Optional client id. If the client id is not specified, a - * new one will be generated. This value (whether specified or generated) is - * included in the response. - * @param id The id of the user group to remove. + * @param version The revision is used to verify the client is working with + * the latest version of the flow. + * @param clientId Optional client id. If the client id is not specified, a + * new one will be generated. This value (whether specified or generated) is + * included in the response. + * @param id The id of the user group to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups/{id}") - @ApiOperation( - value = "Deletes a user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroupEntity.class, - authorizations = { - @Authorization(value = "Write - /tenants") + @Operation( + summary = "Deletes a user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), + security = { + @SecurityRequirement(name = "Write - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response removeUserGroup( - @Context final HttpServletRequest httpServletRequest, - @ApiParam( - value = "The revision is used to verify the client is working with the latest version of the flow.", - required = false + @Parameter( + description = "The revision is used to verify the client is working with the latest version of the flow." ) @QueryParam(VERSION) final LongParameter version, - @ApiParam( - value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", - required = false + @Parameter( + description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response." ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, - @ApiParam( - value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", - required = false + @Parameter( + description = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, - @ApiParam( - value = "The user group id.", + @Parameter( + description = "The user group id.", required = true ) @PathParam("id") final String id) { @@ -902,26 +877,26 @@ public class TenantsResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("search-results") - @ApiOperation( - value = "Searches for a tenant with the specified identity", - notes = NON_GUARANTEED_ENDPOINT, - response = TenantsEntity.class, - authorizations = { - @Authorization(value = "Read - /tenants") + @Operation( + summary = "Searches for a tenant with the specified identity", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TenantsEntity.class))), + security = { + @SecurityRequirement(name = "Read - /tenants") } ) @ApiResponses( value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") } ) public Response searchTenants( - @ApiParam( - value = "Identity to search for.", + @Parameter( + description = "Identity to search for.", required = true ) @QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java index 0969bead33..33934aa267 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java @@ -17,14 +17,6 @@ package org.apache.nifi.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.net.URISyntaxException; import java.util.Collections; @@ -32,6 +24,15 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; @@ -85,13 +86,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Path("/versions") -@Api( - value = "/versions", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing version control for a flow.") -}) +@Tag(name = "Versions") public class VersionsResource extends FlowUpdateResource { private static final Logger logger = LoggerFactory.getLogger(VersionsResource.class); @@ -108,20 +103,24 @@ public class VersionsResource extends FlowUpdateResource { final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); @@ -210,25 +211,28 @@ public class VersionsResource extends FlowUpdateResource { - final Authorizable processGroup = lookup.getProcessGroup(requestEntity.getProcessGroupId()).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.WRITE, user); - }, - /* verifier */ null, - entity -> { - final String requestId = generateUuid(); + serviceFacade, + requestEntity, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(requestEntity.getProcessGroupId()).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.WRITE, user); + }, + /* verifier */ null, + entity -> { + final String requestId = generateUuid(); - // We need to ensure that only a single Version Control Request can occur throughout the flow. - // Otherwise, User 1 could log into Node 1 and choose to Version Control Group A. - // At the same time, User 2 could log into Node 2 and choose to Version Control Group B, which is a child of Group A. - // As a result, may could end up in a situation where we are creating flows in the registry that are never referenced. - synchronized (activeRequestMonitor) { - if (activeRequest == null || activeRequest.isExpired()) { - activeRequest = new ActiveRequest(requestId, user, entity.getProcessGroupId()); - } else { - throw new IllegalStateException("A request is already underway to place a Process Group in this NiFi instance under Version Control. " - + "Only a single such request is allowed to occurred at a time. Please try the request again momentarily."); + // We need to ensure that only a single Version Control Request can occur throughout the flow. + // Otherwise, User 1 could log into Node 1 and choose to Version Control Group A. + // At the same time, User 2 could log into Node 2 and choose to Version Control Group B, which is a child of Group A. + // As a result, may could end up in a situation where we are creating flows in the registry that are never referenced. + synchronized (activeRequestMonitor) { + if (activeRequest == null || activeRequest.isExpired()) { + activeRequest = new ActiveRequest(requestId, user, entity.getProcessGroupId()); + } else { + throw new IllegalStateException("A request is already underway to place a Process Group in this NiFi instance under Version Control. " + + "Only a single such request is allowed to occurred at a time. Please try the request again momentarily."); + } } - } - return generateOkResponse(requestId).build(); - }); + return generateOkResponse(requestId).build(); + }); } @@ -275,22 +279,25 @@ public class VersionsResource extends FlowUpdateResource { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - if (user == null) { - throw new AccessDeniedException("Unknown user."); - } + serviceFacade, + requestEntity, + groupRevision, + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + if (user == null) { + throw new AccessDeniedException("Unknown user."); + } - if (!user.equals(activeRequest.getUser())) { - throw new AccessDeniedException("Only the user that creates the Version Control Request can use it."); - } - }, - null, - (rev, mappingEntity) -> { - // set the version control information - final VersionControlInformationEntity responseEntity = serviceFacade.setVersionControlInformation(rev, groupId, - mappingEntity.getVersionControlInformation(), mappingEntity.getVersionControlComponentMapping()); + if (!user.equals(activeRequest.getUser())) { + throw new AccessDeniedException("Only the user that creates the Version Control Request can use it."); + } + }, + null, + (rev, mappingEntity) -> { + // set the version control information + final VersionControlInformationEntity responseEntity = serviceFacade.setVersionControlInformation(rev, groupId, + mappingEntity.getVersionControlInformation(), mappingEntity.getVersionControlComponentMapping()); - // indicate that the active request has performed the update - activeRequest.updatePerformed(); + // indicate that the active request has performed the update + activeRequest.updatePerformed(); - return generateOkResponse(responseEntity).build(); - }); + return generateOkResponse(responseEntity).build(); + }); } } @@ -392,28 +399,30 @@ public class VersionsResource extends FlowUpdateResource { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - if (user == null) { - throw new AccessDeniedException("Unknown user."); - } + serviceFacade, + null, + lookup -> { + final NiFiUser user = NiFiUserUtils.getNiFiUser(); + if (user == null) { + throw new AccessDeniedException("Unknown user."); + } - if (!user.equals(activeRequest.getUser())) { - throw new AccessDeniedException("Only the user that creates the Version Control Request can use it."); - } - }, - null, - requestEntity -> { - // clear the active request - activeRequest = null; + if (!user.equals(activeRequest.getUser())) { + throw new AccessDeniedException("Only the user that creates the Version Control Request can use it."); + } + }, + null, + requestEntity -> { + // clear the active request + activeRequest = null; - return generateOkResponse().build(); - }); + return generateOkResponse().build(); + }); } } @@ -458,28 +467,31 @@ public class VersionsResource extends FlowUpdateResource { - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - final Authorizable processGroup = groupAuthorizable.getAuthorizable(); + serviceFacade, + requestEntity, + groupRevision, + lookup -> { + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + final Authorizable processGroup = groupAuthorizable.getAuthorizable(); - // require write to this group - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + // require write to this group + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - // require read to this group and all descendants - authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.READ, true, false, true, true); - }, - () -> { - final VersionedFlowDTO versionedFlow = requestEntity.getVersionedFlow(); - final String registryId = versionedFlow.getRegistryId(); - final String bucketId = versionedFlow.getBucketId(); - final String flowId = versionedFlow.getFlowId(); - final String action = versionedFlow.getAction(); - serviceFacade.verifyCanSaveToFlowRegistry(groupId, registryId, bucketId, flowId, action); - }, - (rev, flowEntity) -> { - // Register the current flow with the Flow Registry. - final VersionControlComponentMappingEntity mappingEntity = serviceFacade.registerFlowWithFlowRegistry(groupId, flowEntity); + // require read to this group and all descendants + authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.READ, true, false, true, true); + }, + () -> { + final VersionedFlowDTO versionedFlow = requestEntity.getVersionedFlow(); + final String registryId = versionedFlow.getRegistryId(); + final String bucketId = versionedFlow.getBucketId(); + final String flowId = versionedFlow.getFlowId(); + final String action = versionedFlow.getAction(); + serviceFacade.verifyCanSaveToFlowRegistry(groupId, registryId, bucketId, flowId, action); + }, + (rev, flowEntity) -> { + // Register the current flow with the Flow Registry. + final VersionControlComponentMappingEntity mappingEntity = serviceFacade.registerFlowWithFlowRegistry(groupId, flowEntity); - // Update the Process Group's Version Control Information - final VersionControlInformationEntity responseEntity = serviceFacade.setVersionControlInformation(rev, groupId, - mappingEntity.getVersionControlInformation(), mappingEntity.getVersionControlComponentMapping()); - return generateOkResponse(responseEntity).build(); - }); + // Update the Process Group's Version Control Information + final VersionControlInformationEntity responseEntity = serviceFacade.setVersionControlInformation(rev, groupId, + mappingEntity.getVersionControlInformation(), mappingEntity.getVersionControlComponentMapping()); + return generateOkResponse(responseEntity).build(); + }); } private void unlockVersionControl(final URI requestUri, final String groupId) { @@ -607,23 +619,23 @@ public class VersionsResource extends FlowUpdateResource(), Collections.emptyMap()).awaitMergedResponse(); } else { clusterResponse = getRequestReplicator().forwardToCoordinator( - getClusterCoordinatorNode(), HttpMethod.DELETE, requestUri, new MultivaluedHashMap<>(), Collections.emptyMap()).awaitMergedResponse(); + getClusterCoordinatorNode(), HttpMethod.DELETE, requestUri, new MultivaluedHashMap<>(), Collections.emptyMap()).awaitMergedResponse(); } } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new RuntimeException("After starting Version Control on Process Group with ID " + groupId + ", interrupted while waiting for deletion of Version Control Request. " - + "Users may be unable to Version Control other Process Groups until the request lock times out.", ie); + + "Users may be unable to Version Control other Process Groups until the request lock times out.", ie); } if (clusterResponse.getStatus() != Status.OK.getStatusCode()) { logger.error("After starting Version Control on Process Group with ID " + groupId + ", failed to delete Version Control Request. " - + "Users may be unable to Version Control other Process Groups until the request lock times out. Response status code was " + clusterResponse.getStatus()); + + "Users may be unable to Version Control other Process Groups until the request lock times out. Response status code was " + clusterResponse.getStatus()); } } private String lockVersionControl(final URI originalUri, final String groupId) throws URISyntaxException { final URI createRequestUri = new URI(originalUri.getScheme(), originalUri.getUserInfo(), originalUri.getHost(), - originalUri.getPort(), "/nifi-api/versions/active-requests", null, originalUri.getFragment()); + originalUri.getPort(), "/nifi-api/versions/active-requests", null, originalUri.getFragment()); final NodeResponse clusterResponse; try { @@ -638,7 +650,7 @@ public class VersionsResource extends FlowUpdateResource { - final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - () -> { - final VersionControlInformationEntity currentVersionControlInfo = serviceFacade.getVersionControlInformation(groupId); - if (currentVersionControlInfo == null) { - throw new IllegalStateException("Process Group with ID " + groupId + " is not currently under Version Control"); - } - }, - (revision, groupEntity) -> { - // disconnect from version control - final VersionControlInformationEntity entity = serviceFacade.deleteVersionControl(revision, groupId); + serviceFacade, + null, + requestRevision, + lookup -> { + final Authorizable processGroup = lookup.getProcessGroup(groupId).getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + () -> { + final VersionControlInformationEntity currentVersionControlInfo = serviceFacade.getVersionControlInformation(groupId); + if (currentVersionControlInfo == null) { + throw new IllegalStateException("Process Group with ID " + groupId + " is not currently under Version Control"); + } + }, + (revision, groupEntity) -> { + // disconnect from version control + final VersionControlInformationEntity entity = serviceFacade.deleteVersionControl(revision, groupId); - // generate the response - return generateOkResponse(entity).build(); - }); + // generate the response + return generateOkResponse(entity).build(); + }); } @@ -783,25 +795,28 @@ public class VersionsResource extends FlowUpdateResource { - final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); - final Authorizable processGroup = groupAuthorizable.getAuthorizable(); - processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); - processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); - }, - () -> { - // We do not enforce that the Process Group is 'not dirty' because at this point, - // the client has explicitly indicated the dataflow that the Process Group should - // provide and provided the Revision to ensure that they have the most up-to-date - // view of the Process Group. - serviceFacade.verifyCanUpdate(groupId, requestFlowSnapshot, true, false); - }, - (revision, entity) -> { - // prepare an entity similar to initial request to pass registry id to performUpdateFlow - final VersionControlInformationDTO versionControlInfoDto = new VersionControlInformationDTO(); - versionControlInfoDto.setRegistryId(entity.getRegistryId()); - final VersionControlInformationEntity versionControlInfo = new VersionControlInformationEntity(); - versionControlInfo.setVersionControlInformation(versionControlInfoDto); + serviceFacade, + requestEntity, + requestRevision, + lookup -> { + final ProcessGroupAuthorizable groupAuthorizable = lookup.getProcessGroup(groupId); + final Authorizable processGroup = groupAuthorizable.getAuthorizable(); + processGroup.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); + processGroup.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); + }, + () -> { + // We do not enforce that the Process Group is 'not dirty' because at this point, + // the client has explicitly indicated the dataflow that the Process Group should + // provide and provided the Revision to ensure that they have the most up-to-date + // view of the Process Group. + serviceFacade.verifyCanUpdate(groupId, requestFlowSnapshot, true, false); + }, + (revision, entity) -> { + // prepare an entity similar to initial request to pass registry id to performUpdateFlow + final VersionControlInformationDTO versionControlInfoDto = new VersionControlInformationDTO(); + versionControlInfoDto.setRegistryId(entity.getRegistryId()); + final VersionControlInformationEntity versionControlInfo = new VersionControlInformationEntity(); + versionControlInfo.setVersionControlInformation(versionControlInfoDto); - final ProcessGroupEntity updatedGroup = - performUpdateFlow(groupId, revision, versionControlInfo, entity.getVersionedFlowSnapshot(), - getIdGenerationSeed().orElse(null), false, - entity.getUpdateDescendantVersionedFlows()); + final ProcessGroupEntity updatedGroup = + performUpdateFlow(groupId, revision, versionControlInfo, entity.getVersionedFlowSnapshot(), + getIdGenerationSeed().orElse(null), false, + entity.getUpdateDescendantVersionedFlows()); - final VersionControlInformationDTO updatedVci = updatedGroup.getComponent().getVersionControlInformation(); + final VersionControlInformationDTO updatedVci = updatedGroup.getComponent().getVersionControlInformation(); - // response to replication request is a version control entity with revision and versioning info - final VersionControlInformationEntity responseEntity = new VersionControlInformationEntity(); - responseEntity.setProcessGroupRevision(updatedGroup.getRevision()); - responseEntity.setVersionControlInformation(updatedVci); + // response to replication request is a version control entity with revision and versioning info + final VersionControlInformationEntity responseEntity = new VersionControlInformationEntity(); + responseEntity.setProcessGroupRevision(updatedGroup.getRevision()); + responseEntity.setVersionControlInformation(updatedVci); - return generateOkResponse(responseEntity).build(); - }); + return generateOkResponse(responseEntity).build(); + }); } @@ -882,24 +897,27 @@ public class VersionsResource extends FlowUpdateResource serviceFacade.getVersionedFlowSnapshot(requestVersionControlInfoDto, true) - ); + ); } @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("revert-requests/process-groups/{id}") - @ApiOperation( - value = "Initiate the Revert Request of a Process Group with the given ID", - response = VersionedFlowUpdateRequestEntity.class, - notes = "For a Process Group that is already under Version Control, this will initiate the action of reverting " - + "any local changes that have been made to the Process Group since it was last synchronized with the Flow Registry. This will result in the " - + "flow matching the Versioned Flow that exists in the Flow Registry. This can be a lengthy " - + "process, as it will stop any Processors and disable any Controller Services necessary to perform the action and then restart them. As a result, " - + "the endpoint will immediately return a VersionedFlowUpdateRequestEntity, and the process of updating the flow will occur " - + "asynchronously in the background. The client may then periodically poll the status of the request by issuing a GET request to " - + "/versions/revert-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " - + "/versions/revert-requests/{requestId}. " + NON_GUARANTEED_ENDPOINT, - authorizations = { - @Authorization(value = "Read - /process-groups/{uuid}"), - @Authorization(value = "Write - /process-groups/{uuid}"), - @Authorization(value = "Read - /{component-type}/{uuid} - For all encapsulated components"), - @Authorization(value = "Write - /{component-type}/{uuid} - For all encapsulated components"), - @Authorization(value = "Write - if the template contains any restricted components - /restricted-components"), - @Authorization(value = "Read - /parameter-contexts/{uuid} - For any Parameter Context that is referenced by a Property that is changed, added, or removed") - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(code = 401, message = "Client could not be authenticated."), - @ApiResponse(code = 403, message = "Client is not authorized to make this request."), - @ApiResponse(code = 404, message = "The specified resource could not be found."), - @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") - }) - public Response initiateRevertFlowVersion(@ApiParam("The process group id.") @PathParam("id") final String groupId, - @ApiParam(value = "The Version Control Information to revert to.", required = true) final VersionControlInformationEntity requestEntity) { + @Operation( + summary = "Initiate the Revert Request of a Process Group with the given ID", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowUpdateRequestEntity.class))), + description = "For a Process Group that is already under Version Control, this will initiate the action of reverting " + + "any local changes that have been made to the Process Group since it was last synchronized with the Flow Registry. This will result in the " + + "flow matching the Versioned Flow that exists in the Flow Registry. This can be a lengthy " + + "process, as it will stop any Processors and disable any Controller Services necessary to perform the action and then restart them. As a result, " + + "the endpoint will immediately return a VersionedFlowUpdateRequestEntity, and the process of updating the flow will occur " + + "asynchronously in the background. The client may then periodically poll the status of the request by issuing a GET request to " + + "/versions/revert-requests/{requestId}. Once the request is completed, the client is expected to issue a DELETE request to " + + "/versions/revert-requests/{requestId}. " + NON_GUARANTEED_ENDPOINT, + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For all encapsulated components"), + @SecurityRequirement(name = "Write - if the template contains any restricted components - /restricted-components"), + @SecurityRequirement(name = "Read - /parameter-contexts/{uuid} - For any Parameter Context that is referenced by a Property that is changed, added, or removed") + } + ) + @ApiResponses( + value = { + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + } + ) + public Response initiateRevertFlowVersion(@Parameter(description = "The process group id.") @PathParam("id") final String groupId, + @Parameter(description = "The Version Control Information to revert to.", required = true) final VersionControlInformationEntity requestEntity) { if (requestEntity == null) { throw new IllegalArgumentException("Version control information must be specified."); @@ -1161,41 +1192,41 @@ public class VersionsResource extends FlowUpdateResource authorizeFlowUpdate(lookup, user, groupId, flowSnapshot), - () -> { - // Step 3: Verify that all components in the snapshot exist on all nodes - // Step 4: Verify that Process Group is already under version control. If not, must start Version Control instead of updating flow - serviceFacade.verifyCanRevertLocalModifications(groupId, flowSnapshot); - }, - (revision, wrapper) -> { - final VersionControlInformationEntity versionControlInformationEntity = wrapper.getRequestEntity(); - final VersionControlInformationDTO versionControlInformationDTO = versionControlInformationEntity.getVersionControlInformation(); + serviceFacade, + requestWrapper, + requestRevision, + lookup -> authorizeFlowUpdate(lookup, user, groupId, flowSnapshot), + () -> { + // Step 3: Verify that all components in the snapshot exist on all nodes + // Step 4: Verify that Process Group is already under version control. If not, must start Version Control instead of updating flow + serviceFacade.verifyCanRevertLocalModifications(groupId, flowSnapshot); + }, + (revision, wrapper) -> { + final VersionControlInformationEntity versionControlInformationEntity = wrapper.getRequestEntity(); + final VersionControlInformationDTO versionControlInformationDTO = versionControlInformationEntity.getVersionControlInformation(); - // Ensure that the information passed in is correct - final VersionControlInformationEntity currentVersionEntity = serviceFacade.getVersionControlInformation(groupId); - if (currentVersionEntity == null) { - throw new IllegalStateException("Process Group cannot be reverted to the previous version of the flow because Process Group is not under Version Control."); - } + // Ensure that the information passed in is correct + final VersionControlInformationEntity currentVersionEntity = serviceFacade.getVersionControlInformation(groupId); + if (currentVersionEntity == null) { + throw new IllegalStateException("Process Group cannot be reverted to the previous version of the flow because Process Group is not under Version Control."); + } - final VersionControlInformationDTO currentVersion = currentVersionEntity.getVersionControlInformation(); - if (!currentVersion.getBucketId().equals(versionControlInformationDTO.getBucketId())) { - throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); - } - if (!currentVersion.getFlowId().equals(versionControlInformationDTO.getFlowId())) { - throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); - } - if (!currentVersion.getRegistryId().equals(versionControlInformationDTO.getRegistryId())) { - throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); - } - if (!currentVersion.getVersion().equals(versionControlInformationDTO.getVersion())) { - throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); - } + final VersionControlInformationDTO currentVersion = currentVersionEntity.getVersionControlInformation(); + if (!currentVersion.getBucketId().equals(versionControlInformationDTO.getBucketId())) { + throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); + } + if (!currentVersion.getFlowId().equals(versionControlInformationDTO.getFlowId())) { + throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); + } + if (!currentVersion.getRegistryId().equals(versionControlInformationDTO.getRegistryId())) { + throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); + } + if (!currentVersion.getVersion().equals(versionControlInformationDTO.getVersion())) { + throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); + } - return submitFlowUpdateRequest(user, groupId, revision, wrapper,true); - }); + return submitFlowUpdateRequest(user, groupId, revision, wrapper, true); + }); } /** @@ -1260,7 +1291,7 @@ public class VersionsResource extends FlowUpdateResource - - - - {{appName}}-{{version}} - - - - - - - - -

- -
{{appName}}
-
{{version}}
-
-
-
-
{{appDescription}}
-
-
- -
User authentication and token endpoints
-
-
- -
-
-
- -
Get controller configuration, Manage the cluster, Create reporting tasks
-
-
- -
-
-
- -
Manage controller services, Update controller service references
-
-
- -
-
-
- -
Manage reporting tasks
-
-
- -
-
-
- -
Get counters, Reset counters
-
-
- -
-
-
- -
Get the data flow, Obtain component status, Query history
-
-
- -
-
-
- -
Manage Parameter Contexts and associated validation
-
-
- -
-
-
- -
Manage Parameter Providers and associated validation
-
-
- -
-
-
- -
Create components, Instantiate a template, Upload a template
-
-
- -
-
-
- -
Create a processor, Set properties, Schedule
-
-
- -
-
-
- -
Create a connection, Set queue priority, Update connection destination
-
-
- -
-
-
- -
View queue contents, Download flowfile content, Empty queue
-
-
- -
-
-
- -
Create an input port, Set remote port access control
-
-
- -
-
-
- -
Create an output port, Set remote port access control
-
-
- -
-
-
- -
Create a remote group, Enable transmission
-
-
- -
-
-
- -
Create a label, Set label style
-
-
- -
-
-
- -
Manage funnels
-
-
- -
-
-
- -
Query provenance, Search event lineage
-
-
- -
-
-
- -
Download content, Replay
-
-
- -
-
-
- -
Add users and group, Group users
-
-
- -
-
-
- -
Get policies, Create policies
-
-
- -
-
-
- -
Get resources
-
-
- -
-
-
- -
Get available ports, Get peers
-
-
- -
-
-
- -
Send data, Receive data
-
-
- -
-
-
- -
Create a snippet, Move a snippet, Delete a snippet
-
-
- -
-
-
- -
Download a template, Delete a template
-
-
- -
-
-
- -
Get system diagnostics
-
-
- -
-
-
- -
Manage versions of process groups
-
-
- -
- - {{#models}} - {{#model}} - {{> model}} - {{/model}} - {{/models}} - - \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/model.mustache b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/model.mustache deleted file mode 100644 index 045e367c7b..0000000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/model.mustache +++ /dev/null @@ -1,61 +0,0 @@ -{{!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You 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. ---}} - \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.mustache b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.mustache deleted file mode 100644 index 5908001c31..0000000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.mustache +++ /dev/null @@ -1,133 +0,0 @@ -{{!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You 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. ---}} - \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/style.css.mustache b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/style.css.mustache new file mode 100644 index 0000000000..4dc8b82d81 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/style.css.mustache @@ -0,0 +1,138 @@ +{{!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. +--}} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + font-stretch: normal; + src: url(https://fonts.gstatic.com/s/opensans/v27/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0B4gaVI.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} + +body { + font-family: "Open Sans","DejaVu Sans",sans-serif; + margin: 0 auto; + width: 100%; + max-width: 62.5em; +} + +h1 { + font-size: 2.75em; + color: rgba(0,0,0,0.85); + font-weight: 300; + font-style: normal; + line-height: 1.2; + word-spacing: -.05em; +} + +h2 { + font-size: 2em; +} + +h3 { + font-size: 1.5em; +} + +h4 { + font-size: 1.25em; +} + +h2, h3, h4, h5, h6 { + font-weight: 300; + font-style: normal; + color: #7a2518; + line-height: 1.2; + word-spacing: -.05em; +} + +a { + color: #2156a5; + text-decoration: none; +} + +h1 > a { + color: #7a2518; +} + +h2 > a { + color: #7a2518; +} + +h3 > a { + color: #7a2518; +} + +h4 > a { + color: #7a2518; +} + +h5 > a { + color: #7a2518; +} + +h6 > a { + color: #7a2518; +} + +pre { + background: #f7f7f8; + line-height: 1.45; + padding: 1em; + border-radius: 4px; +} + +.app-desc { + margin-bottom: 10px; +} + +.license-info { + margin-bottom: 10px; +} + +.license-url { + margin-bottom: 10px; +} + +.http-method { + text-transform: uppercase; +} + +code { + white-space: pre; +} + +code.huge { + font-size: 1.5em; +} + +.up { + display: none; +} + +.field-items { + margin-left: 10px; +} + +.param-desc { + margin-bottom: 10px; +} + +.param-type { + font-style: italic; +} + +.param-header { + font-weight: bold; +} diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestProcessGroupResource.java index 88c21265dc..a0900f2f84 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestProcessGroupResource.java @@ -90,7 +90,7 @@ public class TestProcessGroupResource { doThrow(AccessDeniedException.class).when(serviceFacade).authorizeAccess(any(AuthorizeAccess.class)); assertThrows(AccessDeniedException.class, () -> - processGroupResource.updateProcessGroup(httpServletRequest, "id", processGroupEntity)); + processGroupResource.updateProcessGroup("id", processGroupEntity)); verify(serviceFacade, never()).verifyUpdateProcessGroup(any()); verify(serviceFacade, never()).updateProcessGroup(any(), any()); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-data-model/pom.xml index f0c29a9ef6..3e7c6ec263 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/pom.xml @@ -22,7 +22,7 @@ - io.swagger + io.swagger.core.v3 swagger-annotations diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/RegistryConfiguration.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/RegistryConfiguration.java index 241d97e161..1debf196a7 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/RegistryConfiguration.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/RegistryConfiguration.java @@ -16,12 +16,10 @@ */ package org.apache.nifi.registry; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; @XmlRootElement -@ApiModel public class RegistryConfiguration { private Boolean supportsManagedAuthorizer; @@ -32,9 +30,9 @@ public class RegistryConfiguration { * @return whether this NiFi Registry supports a managed authorizer. Managed authorizers can visualize users, groups, * and policies in the UI. This value is read only */ - @ApiModelProperty( - value = "Whether this NiFi Registry supports a managed authorizer. Managed authorizers can visualize users, groups, and policies in the UI.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "Whether this NiFi Registry supports a managed authorizer. Managed authorizers can visualize users, groups, and policies in the UI.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsManagedAuthorizer() { return supportsManagedAuthorizer; @@ -47,9 +45,9 @@ public class RegistryConfiguration { /** * @return whether this NiFi Registry supports configurable users and groups. This value is read only */ - @ApiModelProperty( - value = "Whether this NiFi Registry supports configurable users and groups.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "Whether this NiFi Registry supports configurable users and groups.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsConfigurableUsersAndGroups() { return supportsConfigurableUsersAndGroups; @@ -62,9 +60,9 @@ public class RegistryConfiguration { /** * @return whether this NiFi Registry supports a configurable authorizer. This value is read only */ - @ApiModelProperty( - value = "Whether this NiFi Registry supports a configurable authorizer.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "Whether this NiFi Registry supports a configurable authorizer.", + accessMode = Schema.AccessMode.READ_ONLY ) public Boolean getSupportsConfigurableAuthorizer() { return supportsConfigurableAuthorizer; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/about/RegistryAbout.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/about/RegistryAbout.java index 4417fb5131..cefcd34091 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/about/RegistryAbout.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/about/RegistryAbout.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.registry.about; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; @XmlRootElement -@ApiModel public class RegistryAbout { private final String registryAboutVersion; @@ -38,9 +36,9 @@ public class RegistryAbout { /** * @return the version string of this NiFi Registry. This value is read only */ - @ApiModelProperty( - value = "The version string for this Nifi Registry", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The version string for this Nifi Registry", + accessMode = Schema.AccessMode.READ_ONLY ) public String getRegistryAboutVersion() { return registryAboutVersion; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicy.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicy.java index 7b911ecde1..03d2b4148a 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicy.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicy.java @@ -17,8 +17,7 @@ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.HashSet; @@ -27,13 +26,12 @@ import java.util.Set; /** * Access policy details, including the users and user groups to which the policy applies. */ -@ApiModel public class AccessPolicy extends AccessPolicySummary { private Set users; private Set userGroups; - @ApiModelProperty(value = "The set of user IDs associated with this access policy.") + @Schema(description = "The set of user IDs associated with this access policy.") public Set getUsers() { return users; } @@ -51,7 +49,7 @@ public class AccessPolicy extends AccessPolicySummary { } } - @ApiModelProperty(value = "The set of user group IDs associated with this access policy.") + @Schema(description = "The set of user group IDs associated with this access policy.") public Set getUserGroups() { return userGroups; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicySummary.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicySummary.java index b0418804e2..a56a95902a 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicySummary.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/AccessPolicySummary.java @@ -17,15 +17,13 @@ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.revision.entity.RevisableEntity; import org.apache.nifi.registry.revision.entity.RevisionInfo; /** * Access policy summary of which actions ("read', "write", "delete") are allowable for a specified web resource. */ -@ApiModel public class AccessPolicySummary implements RevisableEntity { private String identifier; @@ -34,7 +32,7 @@ public class AccessPolicySummary implements RevisableEntity { private Boolean configurable; private RevisionInfo revision; - @ApiModelProperty(value = "The id of the policy. Set by server at creation time.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The id of the policy. Set by server at creation time.", accessMode = Schema.AccessMode.READ_ONLY) @Override public String getIdentifier() { return identifier; @@ -45,8 +43,7 @@ public class AccessPolicySummary implements RevisableEntity { this.identifier = identifier; } - @ApiModelProperty(value = "The resource for this access policy.", required = true - ) + @Schema(description = "The resource for this access policy.") public String getResource() { return resource; } @@ -55,10 +52,9 @@ public class AccessPolicySummary implements RevisableEntity { this.resource = resource; } - @ApiModelProperty( - value = "The action associated with this access policy.", - allowableValues = "read, write, delete", - required = true + @Schema( + description = "The action associated with this access policy.", + allowableValues = "read, write, delete" ) public String getAction() { return action; @@ -68,7 +64,7 @@ public class AccessPolicySummary implements RevisableEntity { this.action = action; } - @ApiModelProperty(value = "Indicates if this access policy is configurable, based on which Authorizer has been configured to manage it.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Indicates if this access policy is configurable, based on which Authorizer has been configured to manage it.", accessMode = Schema.AccessMode.READ_ONLY) public Boolean getConfigurable() { return configurable; } @@ -77,9 +73,9 @@ public class AccessPolicySummary implements RevisableEntity { this.configurable = configurable; } - @ApiModelProperty( - value = "The revision of this entity used for optimistic-locking during updates.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The revision of this entity used for optimistic-locking during updates.", + accessMode = Schema.AccessMode.READ_ONLY ) @Override public RevisionInfo getRevision() { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/CurrentUser.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/CurrentUser.java index 9c2d252ec7..d00c541edc 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/CurrentUser.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/CurrentUser.java @@ -16,10 +16,8 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class CurrentUser { private String identity; @@ -28,7 +26,7 @@ public class CurrentUser { private boolean oidcLoginSupported; private ResourcePermissions resourcePermissions; - @ApiModelProperty(value = "The identity of the current user", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The identity of the current user", accessMode = Schema.AccessMode.READ_ONLY) public String getIdentity() { return identity; } @@ -37,7 +35,7 @@ public class CurrentUser { this.identity = identity; } - @ApiModelProperty(value = "Indicates if the current user is anonymous", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "Indicates if the current user is anonymous", accessMode = Schema.AccessMode.READ_ONLY) public boolean isAnonymous() { return anonymous; } @@ -46,12 +44,12 @@ public class CurrentUser { this.anonymous = anonymous; } - @ApiModelProperty(value = "Indicates if the NiFi Registry instance supports logging in") + @Schema(description = "Indicates if the NiFi Registry instance supports logging in") public boolean isLoginSupported() { return loginSupported; } - @ApiModelProperty(value = "Indicates if the NiFi Registry instance supports logging in with an OIDC provider") + @Schema(description = "Indicates if the NiFi Registry instance supports logging in with an OIDC provider") public boolean isOIDCLoginSupported() { return oidcLoginSupported; } @@ -64,7 +62,7 @@ public class CurrentUser { this.oidcLoginSupported = oidcLoginSupported; } - @ApiModelProperty(value = "The access that the current user has to top level resources", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The access that the current user has to top level resources", accessMode = Schema.AccessMode.READ_ONLY) public ResourcePermissions getResourcePermissions() { return resourcePermissions; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Permissions.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Permissions.java index 60ba6aa7a8..7cca9f6aef 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Permissions.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Permissions.java @@ -16,10 +16,8 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class Permissions { private boolean canRead = false; @@ -42,9 +40,9 @@ public class Permissions { /** * @return Indicates whether the user can read a given resource. */ - @ApiModelProperty( - value = "Indicates whether the user can read a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "Indicates whether the user can read a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) public boolean getCanRead() { return canRead; @@ -62,9 +60,9 @@ public class Permissions { /** * @return Indicates whether the user can write a given resource. */ - @ApiModelProperty( - value = "Indicates whether the user can write a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "Indicates whether the user can write a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) public boolean getCanWrite() { return canWrite; @@ -82,9 +80,9 @@ public class Permissions { /** * @return Indicates whether the user can delete a given resource. */ - @ApiModelProperty( - value = "Indicates whether the user can delete a given resource.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "Indicates whether the user can delete a given resource.", + accessMode = Schema.AccessMode.READ_ONLY ) public boolean getCanDelete() { return canDelete; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Resource.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Resource.java index 3a22e3a7e9..9f7ab1c7f8 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Resource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Resource.java @@ -16,10 +16,8 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class Resource { private String identifier; @@ -30,7 +28,7 @@ public class Resource { * * @return The name of the resource */ - @ApiModelProperty(value = "The name of the resource.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The name of the resource.", accessMode = Schema.AccessMode.READ_ONLY) public String getName() { return name; } @@ -44,7 +42,7 @@ public class Resource { * * @return The identifier of the resource */ - @ApiModelProperty(value = "The identifier of the resource.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The identifier of the resource.", accessMode = Schema.AccessMode.READ_ONLY) public String getIdentifier() { return identifier; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/ResourcePermissions.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/ResourcePermissions.java index caf44a75ca..3e6066fd21 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/ResourcePermissions.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/ResourcePermissions.java @@ -16,10 +16,8 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class ResourcePermissions { private Permissions buckets = new Permissions(); @@ -27,7 +25,7 @@ public class ResourcePermissions { private Permissions policies = new Permissions(); private Permissions proxy = new Permissions(); - @ApiModelProperty(value = "The access that the current user has to any top level resources (a logical 'OR' of all other values)", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The access that the current user has to any top level resources (a logical 'OR' of all other values)", accessMode = Schema.AccessMode.READ_ONLY) public Permissions getAnyTopLevelResource() { return new Permissions() .withCanRead(buckets.getCanRead() @@ -44,9 +42,9 @@ public class ResourcePermissions { || proxy.getCanDelete()); } - @ApiModelProperty( - value = "The access that the current user has to the top level /buckets resource of this NiFi Registry (i.e., access to all buckets)", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema( + description = "The access that the current user has to the top level /buckets resource of this NiFi Registry (i.e., access to all buckets)", + accessMode = Schema.AccessMode.READ_ONLY) public Permissions getBuckets() { return buckets; } @@ -55,9 +53,9 @@ public class ResourcePermissions { this.buckets = buckets; } - @ApiModelProperty( - value = "The access that the current user has to the top level /tenants resource of this NiFi Registry", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema( + description = "The access that the current user has to the top level /tenants resource of this NiFi Registry", + accessMode = Schema.AccessMode.READ_ONLY) public Permissions getTenants() { return tenants; } @@ -66,9 +64,9 @@ public class ResourcePermissions { this.tenants = tenants; } - @ApiModelProperty( - value = "The access that the current user has to the top level /policies resource of this NiFi Registry", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema( + description = "The access that the current user has to the top level /policies resource of this NiFi Registry", + accessMode = Schema.AccessMode.READ_ONLY) public Permissions getPolicies() { return policies; } @@ -77,9 +75,9 @@ public class ResourcePermissions { this.policies = policies; } - @ApiModelProperty( - value = "The access that the current user has to the top level /proxy resource of this NiFi Registry", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema( + description = "The access that the current user has to the top level /proxy resource of this NiFi Registry", + accessMode = Schema.AccessMode.READ_ONLY) public Permissions getProxy() { return proxy; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Tenant.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Tenant.java index 64e7a5a500..d20e993ae2 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Tenant.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/Tenant.java @@ -16,8 +16,8 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -27,7 +27,7 @@ import org.apache.nifi.registry.revision.entity.RevisionInfo; /** * A tenant of this NiFi Registry */ -@ApiModel + public class Tenant implements RevisableEntity { private String identifier; @@ -47,9 +47,9 @@ public class Tenant implements RevisableEntity { /** * @return tenant's unique identifier */ - @ApiModelProperty( - value = "The computer-generated identifier of the tenant.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema( + description = "The computer-generated identifier of the tenant.", + accessMode = Schema.AccessMode.READ_ONLY) @Override public String getIdentifier() { return identifier; @@ -63,9 +63,9 @@ public class Tenant implements RevisableEntity { /** * @return tenant's identity */ - @ApiModelProperty( - value = "The human-facing identity of the tenant. This can only be changed if the tenant is configurable.", - required = true) + @Schema( + description = "The human-facing identity of the tenant. This can only be changed if the tenant is configurable." + ) public String getIdentity() { return identity; } @@ -74,9 +74,9 @@ public class Tenant implements RevisableEntity { this.identity = identity; } - @ApiModelProperty( - value = "Indicates if this tenant is configurable, based on which UserGroupProvider has been configured to manage it.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema( + description = "Indicates if this tenant is configurable, based on which UserGroupProvider has been configured to manage it.", + accessMode = Schema.AccessMode.READ_ONLY) public Boolean getConfigurable() { return configurable; } @@ -85,9 +85,9 @@ public class Tenant implements RevisableEntity { this.configurable = configurable; } - @ApiModelProperty( - value = "A summary top-level resource access policies granted to this tenant.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "A summary top-level resource access policies granted to this tenant.", + accessMode = Schema.AccessMode.READ_ONLY ) public ResourcePermissions getResourcePermissions() { return resourcePermissions; @@ -97,9 +97,9 @@ public class Tenant implements RevisableEntity { this.resourcePermissions = resourcePermissions; } - @ApiModelProperty( - value = "The access policies granted to this tenant.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The access policies granted to this tenant.", + accessMode = Schema.AccessMode.READ_ONLY ) public Set getAccessPolicies() { return accessPolicies; @@ -118,9 +118,9 @@ public class Tenant implements RevisableEntity { } } - @ApiModelProperty( - value = "The revision of this entity used for optimistic-locking during updates.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The revision of this entity used for optimistic-locking during updates.", + accessMode = Schema.AccessMode.READ_ONLY ) @Override public RevisionInfo getRevision() { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/User.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/User.java index e39dedd461..b436c47e79 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/User.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/User.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.HashSet; import java.util.Set; -@ApiModel public class User extends Tenant { private Set userGroups; @@ -33,9 +31,9 @@ public class User extends Tenant { super(identifier, identity); } - @ApiModelProperty( - value = "The groups to which the user belongs.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The groups to which the user belongs.", + accessMode = Schema.AccessMode.READ_ONLY ) public Set getUserGroups() { return userGroups; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/UserGroup.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/UserGroup.java index 39fca3610e..56ad4351e2 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/UserGroup.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/authorization/UserGroup.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.authorization; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.HashSet; @@ -26,7 +25,6 @@ import java.util.Set; /** * A user group, used to apply a single set of authorization policies to a group of users. */ -@ApiModel public class UserGroup extends Tenant { private Set users; @@ -40,7 +38,7 @@ public class UserGroup extends Tenant { /** * @return The users that belong to this user group. */ - @ApiModelProperty(value = "The users that belong to this user group. This can only be changed if this group is configurable.") + @Schema(description = "The users that belong to this user group. This can only be changed if this group is configurable.") public Set getUsers() { return users; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/Bucket.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/Bucket.java index c9b682941a..492229f704 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/Bucket.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/Bucket.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.bucket; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; @@ -28,7 +27,6 @@ import org.apache.nifi.registry.revision.entity.RevisableEntity; import org.apache.nifi.registry.revision.entity.RevisionInfo; @XmlRootElement -@ApiModel public class Bucket extends LinkableEntity implements RevisableEntity { @NotBlank @@ -50,7 +48,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { private RevisionInfo revision; - @ApiModelProperty(value = "An ID to uniquely identify this object.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "An ID to uniquely identify this object.", accessMode = Schema.AccessMode.READ_ONLY) public String getIdentifier() { return identifier; } @@ -59,7 +57,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.identifier = identifier; } - @ApiModelProperty(value = "The name of the bucket.", required = true) + @Schema(description = "The name of the bucket.") public String getName() { return name; } @@ -68,7 +66,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.name = name; } - @ApiModelProperty(value = "The timestamp of when the bucket was first created. This is set by the server at creation time.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The timestamp of when the bucket was first created. This is set by the server at creation time.", accessMode = Schema.AccessMode.READ_ONLY) public long getCreatedTimestamp() { return createdTimestamp; } @@ -77,7 +75,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.createdTimestamp = createdTimestamp; } - @ApiModelProperty("A description of the bucket.") + @Schema(description = "A description of the bucket.") public String getDescription() { return description; } @@ -86,7 +84,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.description = description; } - @ApiModelProperty("Indicates if this bucket allows the same version of an extension bundle to be redeployed and thus overwrite the existing artifact. By default this is false.") + @Schema(description = "Indicates if this bucket allows the same version of an extension bundle to be redeployed and thus overwrite the existing artifact. By default this is false.") public Boolean isAllowBundleRedeploy() { return allowBundleRedeploy; } @@ -95,7 +93,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.allowBundleRedeploy = allowBundleRedeploy; } - @ApiModelProperty("Indicates if this bucket allows read access to unauthenticated anonymous users") + @Schema(description = "Indicates if this bucket allows read access to unauthenticated anonymous users") public Boolean isAllowPublicRead() { return allowPublicRead; } @@ -104,7 +102,7 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.allowPublicRead = allowPublicRead; } - @ApiModelProperty(value = "The access that the current user has to this bucket.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The access that the current user has to this bucket.", accessMode = Schema.AccessMode.READ_ONLY) public Permissions getPermissions() { return permissions; } @@ -113,9 +111,9 @@ public class Bucket extends LinkableEntity implements RevisableEntity { this.permissions = permissions; } - @ApiModelProperty( - value = "The revision of this entity used for optimistic-locking during updates.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The revision of this entity used for optimistic-locking during updates.", + accessMode = Schema.AccessMode.READ_ONLY ) @Override public RevisionInfo getRevision() { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/BucketItem.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/BucketItem.java index 00c6c48ae4..4adbf7f1f7 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/BucketItem.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/bucket/BucketItem.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.bucket; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; @@ -25,7 +24,6 @@ import jakarta.validation.constraints.NotNull; import org.apache.nifi.registry.authorization.Permissions; import org.apache.nifi.registry.link.LinkableEntity; -@ApiModel public abstract class BucketItem extends LinkableEntity { @NotBlank @@ -58,7 +56,7 @@ public abstract class BucketItem extends LinkableEntity { this.type = type; } - @ApiModelProperty(value = "An ID to uniquely identify this object.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "An ID to uniquely identify this object.", accessMode = Schema.AccessMode.READ_ONLY) public String getIdentifier() { return identifier; } @@ -67,7 +65,7 @@ public abstract class BucketItem extends LinkableEntity { this.identifier = identifier; } - @ApiModelProperty(value = "The name of the item.", required = true) + @Schema(description = "The name of the item.") public String getName() { return name; } @@ -76,7 +74,7 @@ public abstract class BucketItem extends LinkableEntity { this.name = name; } - @ApiModelProperty("A description of the item.") + @Schema(description = "A description of the item.") public String getDescription() { return description; } @@ -85,7 +83,7 @@ public abstract class BucketItem extends LinkableEntity { this.description = description; } - @ApiModelProperty(value = "The identifier of the bucket this items belongs to. This cannot be changed after the item is created.", required = true) + @Schema(description = "The identifier of the bucket this items belongs to. This cannot be changed after the item is created.") public String getBucketIdentifier() { return bucketIdentifier; } @@ -94,7 +92,7 @@ public abstract class BucketItem extends LinkableEntity { this.bucketIdentifier = bucketIdentifier; } - @ApiModelProperty(value = "The name of the bucket this items belongs to.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The name of the bucket this items belongs to.", accessMode = Schema.AccessMode.READ_ONLY) public String getBucketName() { return bucketName; } @@ -103,7 +101,7 @@ public abstract class BucketItem extends LinkableEntity { this.bucketName = bucketName; } - @ApiModelProperty(value = "The timestamp of when the item was created, as milliseconds since epoch.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The timestamp of when the item was created, as milliseconds since epoch.", accessMode = Schema.AccessMode.READ_ONLY) public long getCreatedTimestamp() { return createdTimestamp; } @@ -112,7 +110,7 @@ public abstract class BucketItem extends LinkableEntity { this.createdTimestamp = createdTimestamp; } - @ApiModelProperty(value = "The timestamp of when the item was last modified, as milliseconds since epoch.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The timestamp of when the item was last modified, as milliseconds since epoch.", accessMode = Schema.AccessMode.READ_ONLY) public long getModifiedTimestamp() { return modifiedTimestamp; } @@ -121,12 +119,12 @@ public abstract class BucketItem extends LinkableEntity { this.modifiedTimestamp = modifiedTimestamp; } - @ApiModelProperty(value = "The type of item.", required = true) + @Schema(description = "The type of item.") public BucketItemType getType() { return type; } - @ApiModelProperty(value = "The access that the current user has to the bucket containing this item.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The access that the current user has to the bucket containing this item.", accessMode = Schema.AccessMode.READ_ONLY) public Permissions getPermissions() { return permissions; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifference.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifference.java index d4fb5d01f1..694dc9fcc8 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifference.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifference.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.diff; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Represents a specific, individual difference that has changed between 2 versions. @@ -30,7 +30,7 @@ public class ComponentDifference { private String differenceType; private String differenceTypeDescription; - @ApiModelProperty("The earlier value from the difference.") + @Schema(description = "The earlier value from the difference.") public String getValueA() { return valueA; } @@ -39,7 +39,7 @@ public class ComponentDifference { this.valueA = valueA; } - @ApiModelProperty("The newer value from the difference.") + @Schema(description = "The newer value from the difference.") public String getValueB() { return valueB; } @@ -48,7 +48,7 @@ public class ComponentDifference { this.valueB = valueB; } - @ApiModelProperty("The description of the change.") + @Schema(description = "The description of the change.") public String getChangeDescription() { return changeDescription; } @@ -57,7 +57,7 @@ public class ComponentDifference { this.changeDescription = changeDescription; } - @ApiModelProperty("The key to the difference.") + @Schema(description = "The key to the difference.") public String getDifferenceType() { return differenceType; } @@ -66,7 +66,7 @@ public class ComponentDifference { this.differenceType = differenceType; } - @ApiModelProperty("The description of the change type.") + @Schema(description = "The description of the change type.") public String getDifferenceTypeDescription() { return differenceTypeDescription; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifferenceGroup.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifferenceGroup.java index a7b1d5822a..8572b52edf 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifferenceGroup.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/ComponentDifferenceGroup.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.diff; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.HashSet; import java.util.Objects; @@ -33,7 +33,7 @@ public class ComponentDifferenceGroup { private String processGroupId; private Set differences = new HashSet<>(); - @ApiModelProperty("The id of the component whose changes are grouped together.") + @Schema(description = "The id of the component whose changes are grouped together.") public String getComponentId() { return componentId; } @@ -42,7 +42,7 @@ public class ComponentDifferenceGroup { this.componentId = componentId; } - @ApiModelProperty("The name of the component whose changes are grouped together.") + @Schema(description = "The name of the component whose changes are grouped together.") public String getComponentName() { return componentName; } @@ -51,7 +51,7 @@ public class ComponentDifferenceGroup { this.componentName = componentName; } - @ApiModelProperty("The type of component these changes relate to.") + @Schema(description = "The type of component these changes relate to.") public String getComponentType() { return componentType; } @@ -60,7 +60,7 @@ public class ComponentDifferenceGroup { this.componentType = componentType; } - @ApiModelProperty("The process group id for this component.") + @Schema(description = "The process group id for this component.") public String getProcessGroupId() { return processGroupId; } @@ -69,7 +69,7 @@ public class ComponentDifferenceGroup { this.processGroupId = processGroupId; } - @ApiModelProperty("The list of changes related to this component between the 2 versions.") + @Schema(description = "The list of changes related to this component between the 2 versions.") public Set getDifferences() { return differences; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/VersionedFlowDifference.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/VersionedFlowDifference.java index ccc6a0519a..7a3dc3dfee 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/VersionedFlowDifference.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/diff/VersionedFlowDifference.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.diff; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; @@ -41,7 +41,7 @@ public class VersionedFlowDifference { this.componentDifferenceGroups = componentDifferenceGroups; } - @ApiModelProperty("The id of the bucket that the flow is stored in.") + @Schema(description = "The id of the bucket that the flow is stored in.") public String getBucketId() { return bucketId; } @@ -50,7 +50,7 @@ public class VersionedFlowDifference { this.bucketId = bucketId; } - @ApiModelProperty("The id of the flow that is being examined.") + @Schema(description = "The id of the flow that is being examined.") public String getFlowId() { return flowId; } @@ -59,7 +59,7 @@ public class VersionedFlowDifference { this.flowId = flowId; } - @ApiModelProperty("The earlier version from the diff operation.") + @Schema(description = "The earlier version from the diff operation.") public int getVersionA() { return versionA; } @@ -68,7 +68,7 @@ public class VersionedFlowDifference { this.versionA = versionA; } - @ApiModelProperty("The latter version from the diff operation.") + @Schema(description = "The latter version from the diff operation.") public int getVersionB() { return versionB; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BuildInfo.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BuildInfo.java index deb5944861..04943eb898 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BuildInfo.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BuildInfo.java @@ -16,10 +16,8 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class BuildInfo { private String buildTool; @@ -36,7 +34,7 @@ public class BuildInfo { private String builtBy; - @ApiModelProperty(value = "The tool used to build the version of the bundle") + @Schema(description = "The tool used to build the version of the bundle") public String getBuildTool() { return buildTool; } @@ -45,7 +43,7 @@ public class BuildInfo { this.buildTool = buildTool; } - @ApiModelProperty(value = "The flags used to build the version of the bundle") + @Schema(description = "The flags used to build the version of the bundle") public String getBuildFlags() { return buildFlags; } @@ -54,7 +52,7 @@ public class BuildInfo { this.buildFlags = buildFlags; } - @ApiModelProperty(value = "The branch used to build the version of the bundle") + @Schema(description = "The branch used to build the version of the bundle") public String getBuildBranch() { return buildBranch; } @@ -63,7 +61,7 @@ public class BuildInfo { this.buildBranch = buildBranch; } - @ApiModelProperty(value = "The tag used to build the version of the bundle") + @Schema(description = "The tag used to build the version of the bundle") public String getBuildTag() { return buildTag; } @@ -72,7 +70,7 @@ public class BuildInfo { this.buildTag = buildTag; } - @ApiModelProperty(value = "The revision used to build the version of the bundle") + @Schema(description = "The revision used to build the version of the bundle") public String getBuildRevision() { return buildRevision; } @@ -81,7 +79,7 @@ public class BuildInfo { this.buildRevision = buildRevision; } - @ApiModelProperty(value = "The timestamp the version of the bundle was built") + @Schema(description = "The timestamp the version of the bundle was built") public long getBuilt() { return built; } @@ -90,7 +88,7 @@ public class BuildInfo { this.built = built; } - @ApiModelProperty(value = "The identity of the user that performed the build") + @Schema(description = "The identity of the user that performed the build") public String getBuiltBy() { return builtBy; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/Bundle.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/Bundle.java index 8268757c1c..99a1dcbdf9 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/Bundle.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/Bundle.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; @@ -32,10 +31,9 @@ import org.apache.nifi.registry.bucket.BucketItemType; * * The {@link BundleVersion} represents the actually binary bundle which may contain one or more extensions. * - * Note: The @ApiModel annotation needs a value specified because there is another class called Bundle in a different + * Note: The annotation needs a value specified because there is another class called Bundle in a different * package for flows, and the model names must be unique since they won't carry the Java package structure forward. */ -@ApiModel("ExtensionBundle") @XmlRootElement public class Bundle extends BucketItem { @@ -55,7 +53,7 @@ public class Bundle extends BucketItem { super(BucketItemType.Bundle); } - @ApiModelProperty(value = "The type of the extension bundle") + @Schema(description = "The type of the extension bundle") public BundleType getBundleType() { return bundleType; } @@ -64,7 +62,7 @@ public class Bundle extends BucketItem { this.bundleType = bundleType; } - @ApiModelProperty(value = "The group id of the extension bundle") + @Schema(description = "The group id of the extension bundle") public String getGroupId() { return groupId; } @@ -73,7 +71,7 @@ public class Bundle extends BucketItem { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of the extension bundle") + @Schema(description = "The artifact id of the extension bundle") public String getArtifactId() { return artifactId; } @@ -82,7 +80,7 @@ public class Bundle extends BucketItem { this.artifactId = artifactId; } - @ApiModelProperty(value = "The number of versions of this extension bundle.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The number of versions of this extension bundle.", accessMode = Schema.AccessMode.READ_ONLY) public long getVersionCount() { return versionCount; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleInfo.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleInfo.java index 417796829f..3303d70d04 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleInfo.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleInfo.java @@ -16,10 +16,8 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel public class BundleInfo { private String bucketId; @@ -34,7 +32,7 @@ public class BundleInfo { private String systemApiVersion; - @ApiModelProperty(value = "The id of the bucket where the bundle is located") + @Schema(description = "The id of the bucket where the bundle is located") public String getBucketId() { return bucketId; } @@ -43,7 +41,7 @@ public class BundleInfo { this.bucketId = bucketId; } - @ApiModelProperty(value = "The name of the bucket where the bundle is located") + @Schema(description = "The name of the bucket where the bundle is located") public String getBucketName() { return bucketName; } @@ -52,7 +50,7 @@ public class BundleInfo { this.bucketName = bucketName; } - @ApiModelProperty(value = "The id of the bundle") + @Schema(description = "The id of the bundle") public String getBundleId() { return bundleId; } @@ -61,7 +59,7 @@ public class BundleInfo { this.bundleId = bundleId; } - @ApiModelProperty("The type of bundle (i.e. a NiFi NAR vs MiNiFi CPP)") + @Schema(description = "The type of bundle (i.e. a NiFi NAR vs MiNiFi CPP)") public BundleType getBundleType() { return bundleType; } @@ -70,7 +68,7 @@ public class BundleInfo { this.bundleType = bundleType; } - @ApiModelProperty(value = "The group id of the bundle") + @Schema(description = "The group id of the bundle") public String getGroupId() { return groupId; } @@ -79,7 +77,7 @@ public class BundleInfo { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of the bundle") + @Schema(description = "The artifact id of the bundle") public String getArtifactId() { return artifactId; } @@ -88,7 +86,7 @@ public class BundleInfo { this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of the bundle") + @Schema(description = "The version of the bundle") public String getVersion() { return version; } @@ -97,7 +95,7 @@ public class BundleInfo { this.version = version; } - @ApiModelProperty(value = "The version of the system API the bundle was built against") + @Schema(description = "The version of the system API the bundle was built against") public String getSystemApiVersion() { return systemApiVersion; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleType.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleType.java index e57311a907..9aa5f81d58 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleType.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleType.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; - import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * The possible types of extension bundles. */ -@ApiModel @XmlJavaTypeAdapter(BundleTypeAdapter.class) public enum BundleType { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersion.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersion.java index 0f99a528de..b38aaab660 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersion.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersion.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; @@ -26,7 +25,6 @@ import jakarta.xml.bind.annotation.XmlTransient; import org.apache.nifi.registry.bucket.Bucket; import org.apache.nifi.registry.link.LinkableEntity; -@ApiModel @XmlRootElement public class BundleVersion extends LinkableEntity { @@ -44,7 +42,7 @@ public class BundleVersion extends LinkableEntity { private Bucket bucket; - @ApiModelProperty(value = "The metadata about this version of the extension bundle") + @Schema(description = "The metadata about this version of the extension bundle") public BundleVersionMetadata getVersionMetadata() { return versionMetadata; } @@ -53,7 +51,7 @@ public class BundleVersion extends LinkableEntity { this.versionMetadata = versionMetadata; } - @ApiModelProperty(value = "The set of other bundle versions that this version is dependent on", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The set of other bundle versions that this version is dependent on", accessMode = Schema.AccessMode.READ_ONLY) public Set getDependencies() { return dependencies; } @@ -62,7 +60,7 @@ public class BundleVersion extends LinkableEntity { this.dependencies = dependencies; } - @ApiModelProperty(value = "The bundle this version is for", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The bundle this version is for", accessMode = Schema.AccessMode.READ_ONLY) public Bundle getBundle() { return bundle; } @@ -71,7 +69,7 @@ public class BundleVersion extends LinkableEntity { this.bundle = bundle; } - @ApiModelProperty(value = "The bucket that the extension bundle belongs to") + @Schema(description = "The bucket that the extension bundle belongs to") public Bucket getBucket() { return bucket; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionDependency.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionDependency.java index e1dbf6405f..ab58b46d31 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionDependency.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionDependency.java @@ -16,13 +16,11 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import java.util.Objects; -@ApiModel public class BundleVersionDependency { @NotBlank @@ -34,7 +32,7 @@ public class BundleVersionDependency { @NotBlank private String version; - @ApiModelProperty(value = "The group id of the bundle dependency") + @Schema(description = "The group id of the bundle dependency") public String getGroupId() { return groupId; } @@ -43,7 +41,7 @@ public class BundleVersionDependency { this.groupId = groupId; } - @ApiModelProperty(value = "The artifact id of the bundle dependency") + @Schema(description = "The artifact id of the bundle dependency") public String getArtifactId() { return artifactId; } @@ -52,7 +50,7 @@ public class BundleVersionDependency { this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of the bundle dependency") + @Schema(description = "The version of the bundle dependency") public String getVersion() { return version; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionMetadata.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionMetadata.java index d15f72e10f..09e078a25f 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionMetadata.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/bundle/BundleVersionMetadata.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.extension.bundle; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.link.LinkableEntity; import jakarta.validation.Valid; @@ -27,7 +26,6 @@ import jakarta.validation.constraints.NotNull; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Objects; -@ApiModel @XmlRootElement public class BundleVersionMetadata extends LinkableEntity implements Comparable { @@ -75,7 +73,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< private BuildInfo buildInfo; - @ApiModelProperty(value = "The id of this version of the extension bundle") + @Schema(description = "The id of this version of the extension bundle") public String getId() { return id; } @@ -84,7 +82,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.id = id; } - @ApiModelProperty(value = "The id of the extension bundle this version is for") + @Schema(description = "The id of the extension bundle this version is for") public String getBundleId() { return bundleId; } @@ -93,7 +91,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.bundleId = bundleId; } - @ApiModelProperty(value = "The id of the bucket the extension bundle belongs to", required = true) + @Schema(description = "The id of the bucket the extension bundle belongs to") public String getBucketId() { return bucketId; } @@ -118,7 +116,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.artifactId = artifactId; } - @ApiModelProperty(value = "The version of the extension bundle") + @Schema(description = "The version of the extension bundle") public String getVersion() { return version; } @@ -127,7 +125,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.version = version; } - @ApiModelProperty(value = "The timestamp of the create date of this version") + @Schema(description = "The timestamp of the create date of this version") public long getTimestamp() { return timestamp; } @@ -136,7 +134,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.timestamp = timestamp; } - @ApiModelProperty(value = "The identity that created this version") + @Schema(description = "The identity that created this version") public String getAuthor() { return author; } @@ -145,7 +143,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.author = author; } - @ApiModelProperty(value = "The description for this version") + @Schema(description = "The description for this version") public String getDescription() { return description; } @@ -154,7 +152,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.description = description; } - @ApiModelProperty(value = "The hex representation of the SHA-256 digest of the binary content for this version") + @Schema(description = "The hex representation of the SHA-256 digest of the binary content for this version") public String getSha256() { return sha256; } @@ -163,7 +161,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.sha256 = sha256; } - @ApiModelProperty(value = "Whether or not the client supplied a SHA-256 when uploading the bundle") + @Schema(description = "Whether or not the client supplied a SHA-256 when uploading the bundle") public Boolean getSha256Supplied() { return sha256Supplied; } @@ -172,7 +170,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.sha256Supplied = sha256Supplied; } - @ApiModelProperty(value = "The size of the binary content for this version in bytes") + @Schema(description = "The size of the binary content for this version in bytes") public long getContentSize() { return contentSize; } @@ -181,7 +179,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.contentSize = contentSize; } - @ApiModelProperty(value = "The version of the system API that this bundle version was built against") + @Schema(description = "The version of the system API that this bundle version was built against") public String getSystemApiVersion() { return systemApiVersion; } @@ -190,7 +188,7 @@ public class BundleVersionMetadata extends LinkableEntity implements Comparable< this.systemApiVersion = systemApiVersion; } - @ApiModelProperty(value = "The build information about this version") + @Schema(description = "The build information about this version") public BuildInfo getBuildInfo() { return buildInfo; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionFilterParams.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionFilterParams.java index d9d0fe9908..e50a782e87 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionFilterParams.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionFilterParams.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.extension.manifest.ExtensionType; import org.apache.nifi.registry.extension.bundle.BundleType; @@ -29,7 +28,6 @@ import java.util.Set; /** * Parameters for filtering on extensions. All parameters will be AND'd together, but tags will be OR'd. */ -@ApiModel public class ExtensionFilterParams { private final BundleType bundleType; @@ -49,17 +47,17 @@ public class ExtensionFilterParams { this.tags = Collections.unmodifiableSet(new HashSet<>(builder.tags)); } - @ApiModelProperty("The type of bundle") + @Schema(description = "The type of bundle") public BundleType getBundleType() { return bundleType; } - @ApiModelProperty("The type of extension") + @Schema(description = "The type of extension") public ExtensionType getExtensionType() { return extensionType; } - @ApiModelProperty("The tags") + @Schema(description = "The tags") public Set getTags() { return tags; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadata.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadata.java index 328ef98fbc..1d427c60c0 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadata.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadata.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.extension; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -33,7 +32,6 @@ import org.apache.nifi.registry.link.LinkAdapter; import org.apache.nifi.registry.link.LinkableDocs; import org.apache.nifi.registry.link.LinkableEntity; -@ApiModel public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, Comparable { private String name; @@ -48,7 +46,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C private boolean hasAdditionalDetails; private Link linkDocs; - @ApiModelProperty(value = "The name of the extension") + @Schema(description = "The name of the extension") public String getName() { return name; } @@ -57,7 +55,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.name = name; } - @ApiModelProperty(value = "The display name of the extension") + @Schema(description = "The display name of the extension") public String getDisplayName() { return displayName; } @@ -66,7 +64,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.displayName = displayName; } - @ApiModelProperty(value = "The type of the extension") + @Schema(description = "The type of the extension") public ExtensionType getType() { return type; } @@ -75,7 +73,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.type = type; } - @ApiModelProperty(value = "The description of the extension") + @Schema(description = "The description of the extension") public String getDescription() { return description; } @@ -84,7 +82,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.description = description; } - @ApiModelProperty(value = "The deprecation notice of the extension") + @Schema(description = "The deprecation notice of the extension") public DeprecationNotice getDeprecationNotice() { return deprecationNotice; } @@ -93,7 +91,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.deprecationNotice = deprecationNotice; } - @ApiModelProperty(value = "The tags of the extension") + @Schema(description = "The tags of the extension") public List getTags() { return tags; } @@ -102,7 +100,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.tags = tags; } - @ApiModelProperty(value = "The restrictions of the extension") + @Schema(description = "The restrictions of the extension") public Restricted getRestricted() { return restricted; } @@ -111,7 +109,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.restricted = restricted; } - @ApiModelProperty(value = "The service APIs provided by the extension") + @Schema(description = "The service APIs provided by the extension") public List getProvidedServiceAPIs() { return providedServiceAPIs; } @@ -120,7 +118,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.providedServiceAPIs = providedServiceAPIs; } - @ApiModelProperty(value = "The information for the bundle where this extension is located") + @Schema(description = "The information for the bundle where this extension is located") public BundleInfo getBundleInfo() { return bundleInfo; } @@ -129,7 +127,7 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C this.bundleInfo = bundleInfo; } - @ApiModelProperty(value = "Whether or not the extension has additional detail documentation") + @Schema(description = "Whether or not the extension has additional detail documentation") public boolean getHasAdditionalDetails() { return hasAdditionalDetails; } @@ -141,8 +139,8 @@ public class ExtensionMetadata extends LinkableEntity implements LinkableDocs, C @Override @XmlElement @XmlJavaTypeAdapter(LinkAdapter.class) - @ApiModelProperty(value = "A WebLink to the documentation for this extension.", - dataType = "org.apache.nifi.registry.link.JaxbLink", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "A WebLink to the documentation for this extension.", + type = "org.apache.nifi.registry.link.JaxbLink", accessMode = Schema.AccessMode.READ_ONLY) public Link getLinkDocs() { return linkDocs; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadataContainer.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadataContainer.java index ce1694a65f..4afa7f89ce 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadataContainer.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/ExtensionMetadataContainer.java @@ -16,19 +16,17 @@ */ package org.apache.nifi.extension; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.SortedSet; -@ApiModel public class ExtensionMetadataContainer { private int numResults; private ExtensionFilterParams filterParams; private SortedSet extensions; - @ApiModelProperty("The number of extensions in the response") + @Schema(description = "The number of extensions in the response") public int getNumResults() { return numResults; } @@ -37,7 +35,7 @@ public class ExtensionMetadataContainer { this.numResults = numResults; } - @ApiModelProperty("The filter parameters submitted for the request") + @Schema(description = "The filter parameters submitted for the request") public ExtensionFilterParams getFilterParams() { return filterParams; } @@ -46,7 +44,7 @@ public class ExtensionMetadataContainer { this.filterParams = filterParams; } - @ApiModelProperty("The metadata for the extensions") + @Schema(description = "The metadata for the extensions") public SortedSet getExtensions() { return extensions; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/TagCount.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/TagCount.java index 224472cdb3..6ce6110450 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/TagCount.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/TagCount.java @@ -16,19 +16,17 @@ */ package org.apache.nifi.extension; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Comparator; import java.util.Objects; -@ApiModel public class TagCount implements Comparable { private String tag; private int count; - @ApiModelProperty("The tag label") + @Schema(description = "The tag label") public String getTag() { return tag; } @@ -37,7 +35,7 @@ public class TagCount implements Comparable { this.tag = tag; } - @ApiModelProperty("The number of occurrences of the given tag") + @Schema(description = "The number of occurrences of the given tag") public int getCount() { return count; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoArtifact.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoArtifact.java index eb1006034c..8fc59269b3 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoArtifact.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoArtifact.java @@ -16,15 +16,13 @@ */ package org.apache.nifi.registry.extension.repo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.link.LinkableEntity; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Comparator; import java.util.Objects; -@ApiModel @XmlRootElement public class ExtensionRepoArtifact extends LinkableEntity implements Comparable { @@ -32,7 +30,7 @@ public class ExtensionRepoArtifact extends LinkableEntity implements Comparable< private String groupId; private String artifactId; - @ApiModelProperty(value = "The bucket name") + @Schema(description = "The bucket name") public String getBucketName() { return bucketName; } @@ -41,7 +39,7 @@ public class ExtensionRepoArtifact extends LinkableEntity implements Comparable< this.bucketName = bucketName; } - @ApiModelProperty("The group id") + @Schema(description = "The group id") public String getGroupId() { return groupId; } @@ -50,7 +48,7 @@ public class ExtensionRepoArtifact extends LinkableEntity implements Comparable< this.groupId = groupId; } - @ApiModelProperty("The artifact id") + @Schema(description = "The artifact id") public String getArtifactId() { return artifactId; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoBucket.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoBucket.java index 202b8ce22a..991095728a 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoBucket.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoBucket.java @@ -16,21 +16,19 @@ */ package org.apache.nifi.registry.extension.repo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.link.LinkableEntity; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Comparator; import java.util.Objects; -@ApiModel @XmlRootElement public class ExtensionRepoBucket extends LinkableEntity implements Comparable { private String bucketName; - @ApiModelProperty(value = "The name of the bucket") + @Schema(description = "The name of the bucket") public String getBucketName() { return bucketName; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoExtensionMetadata.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoExtensionMetadata.java index 6e428eda00..9ebd84222f 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoExtensionMetadata.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoExtensionMetadata.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.extension.repo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Comparator; import jakarta.ws.rs.core.Link; import jakarta.xml.bind.annotation.XmlElement; @@ -27,7 +26,6 @@ import org.apache.nifi.registry.link.LinkAdapter; import org.apache.nifi.registry.link.LinkableDocs; import org.apache.nifi.registry.link.LinkableEntity; -@ApiModel public class ExtensionRepoExtensionMetadata extends LinkableEntity implements LinkableDocs, Comparable { private ExtensionMetadata extensionMetadata; @@ -40,7 +38,7 @@ public class ExtensionRepoExtensionMetadata extends LinkableEntity implements Li this.extensionMetadata = extensionMetadata; } - @ApiModelProperty(value = "The extension metadata") + @Schema(description = "The extension metadata") public ExtensionMetadata getExtensionMetadata() { return extensionMetadata; } @@ -52,8 +50,8 @@ public class ExtensionRepoExtensionMetadata extends LinkableEntity implements Li @Override @XmlElement @XmlJavaTypeAdapter(LinkAdapter.class) - @ApiModelProperty(value = "A WebLink to the documentation for this extension.", - dataType = "org.apache.nifi.registry.link.JaxbLink", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "A WebLink to the documentation for this extension.", + type = "org.apache.nifi.registry.link.JaxbLink", accessMode = Schema.AccessMode.READ_ONLY) public Link getLinkDocs() { return linkDocs; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoGroup.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoGroup.java index 6b966a9daa..845b9ac84c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoGroup.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoGroup.java @@ -16,22 +16,20 @@ */ package org.apache.nifi.registry.extension.repo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.nifi.registry.link.LinkableEntity; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.Comparator; import java.util.Objects; -@ApiModel @XmlRootElement public class ExtensionRepoGroup extends LinkableEntity implements Comparable { private String bucketName; private String groupId; - @ApiModelProperty(value = "The bucket name") + @Schema(description = "The bucket name") public String getBucketName() { return bucketName; } @@ -40,7 +38,7 @@ public class ExtensionRepoGroup extends LinkableEntity implements Comparable { @@ -37,7 +35,7 @@ public class ExtensionRepoVersionSummary extends LinkableEntity implements Compa private String author; private Long timestamp; - @ApiModelProperty(value = "The bucket name") + @Schema(description = "The bucket name") public String getBucketName() { return bucketName; } @@ -46,7 +44,7 @@ public class ExtensionRepoVersionSummary extends LinkableEntity implements Compa this.bucketName = bucketName; } - @ApiModelProperty("The group id") + @Schema(description = "The group id") public String getGroupId() { return groupId; } @@ -55,7 +53,7 @@ public class ExtensionRepoVersionSummary extends LinkableEntity implements Compa this.groupId = groupId; } - @ApiModelProperty("The artifact id") + @Schema(description = "The artifact id") public String getArtifactId() { return artifactId; } @@ -64,7 +62,7 @@ public class ExtensionRepoVersionSummary extends LinkableEntity implements Compa this.artifactId = artifactId; } - @ApiModelProperty("The version") + @Schema(description = "The version") public String getVersion() { return version; } @@ -73,7 +71,7 @@ public class ExtensionRepoVersionSummary extends LinkableEntity implements Compa this.version = version; } - @ApiModelProperty("The identity of the user that created this version") + @Schema(description = "The identity of the user that created this version") public String getAuthor() { return author; } @@ -82,7 +80,7 @@ public class ExtensionRepoVersionSummary extends LinkableEntity implements Compa this.author = author; } - @ApiModelProperty("The timestamp of when this version was created") + @Schema(description = "The timestamp of when this version was created") public long getTimestamp() { return timestamp; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java index 52cf2eb062..c027b39120 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Min; import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.nifi.registry.bucket.BucketItem; @@ -35,7 +34,6 @@ import org.apache.nifi.registry.revision.entity.RevisionInfo; * @see VersionedFlowSnapshot */ @XmlRootElement -@ApiModel public class VersionedFlow extends BucketItem implements RevisableEntity { @Min(0) @@ -47,7 +45,7 @@ public class VersionedFlow extends BucketItem implements RevisableEntity { super(BucketItemType.Flow); } - @ApiModelProperty(value = "The number of versions of this flow.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The number of versions of this flow.", accessMode = Schema.AccessMode.READ_ONLY) public long getVersionCount() { return versionCount; } @@ -56,9 +54,9 @@ public class VersionedFlow extends BucketItem implements RevisableEntity { this.versionCount = versionCount; } - @ApiModelProperty( - value = "The revision of this entity used for optimistic-locking during updates.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The revision of this entity used for optimistic-locking during updates.", + accessMode = Schema.AccessMode.READ_ONLY ) @Override public RevisionInfo getRevision() { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java index 56d5ede01a..c68607255b 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java @@ -17,8 +17,7 @@ package org.apache.nifi.registry.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; import java.util.Objects; import jakarta.validation.Valid; @@ -44,7 +43,6 @@ import org.apache.nifi.registry.bucket.Bucket; * flow contents without any versioning or snapshot metadata. *

*/ -@ApiModel @XmlRootElement public class VersionedFlowSnapshot { @@ -74,7 +72,7 @@ public class VersionedFlowSnapshot { // read-only, only populated from retrieval of a snapshot private Bucket bucket; - @ApiModelProperty(value = "The metadata for this snapshot", required = true) + @Schema(description = "The metadata for this snapshot") public VersionedFlowSnapshotMetadata getSnapshotMetadata() { return snapshotMetadata; } @@ -83,7 +81,7 @@ public class VersionedFlowSnapshot { this.snapshotMetadata = snapshotMetadata; } - @ApiModelProperty(value = "The contents of the versioned flow", required = true) + @Schema(description = "The contents of the versioned flow") public VersionedProcessGroup getFlowContents() { return flowContents; } @@ -92,7 +90,7 @@ public class VersionedFlowSnapshot { this.flowContents = flowContents; } - @ApiModelProperty("The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow.") + @Schema(description = "The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow.") public Map getExternalControllerServices() { return externalControllerServices; } @@ -101,7 +99,7 @@ public class VersionedFlowSnapshot { this.externalControllerServices = externalControllerServices; } - @ApiModelProperty("Contains basic information about parameter providers referenced in the versioned flow.") + @Schema(description = "Contains basic information about parameter providers referenced in the versioned flow.") public Map getParameterProviders() { return parameterProviders; } @@ -110,7 +108,7 @@ public class VersionedFlowSnapshot { this.parameterProviders = parameterProviders; } - @ApiModelProperty(value = "The flow this snapshot is for", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The flow this snapshot is for", accessMode = Schema.AccessMode.READ_ONLY) public VersionedFlow getFlow() { return flow; } @@ -119,7 +117,7 @@ public class VersionedFlowSnapshot { this.flow = flow; } - @ApiModelProperty(value = "The bucket where the flow is located", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The bucket where the flow is located", accessMode = Schema.AccessMode.READ_ONLY) public Bucket getBucket() { return bucket; } @@ -128,7 +126,7 @@ public class VersionedFlowSnapshot { this.bucket = bucket; } - @ApiModelProperty(value = "The parameter contexts referenced by process groups in the flow contents. " + + @Schema(description = "The parameter contexts referenced by process groups in the flow contents. " + "The mapping is from the name of the context to the context instance, and it is expected that any " + "context in this map is referenced by at least one process group in this flow.") public Map getParameterContexts() { @@ -139,7 +137,7 @@ public class VersionedFlowSnapshot { this.parameterContexts = parameterContexts; } - @ApiModelProperty(value = "The optional encoding version of the flow contents.") + @Schema(description = "The optional encoding version of the flow contents.") public String getFlowEncodingVersion() { return flowEncodingVersion; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshotMetadata.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshotMetadata.java index ba3c70be5d..d54389b37c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshotMetadata.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshotMetadata.java @@ -16,8 +16,8 @@ */ package org.apache.nifi.registry.flow; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; @@ -27,7 +27,7 @@ import org.apache.nifi.registry.link.LinkableEntity; * The metadata information about a VersionedFlowSnapshot. This class implements Comparable in order * to sort based on the snapshot version in ascending order. */ -@ApiModel + public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Comparable { @NotBlank @@ -48,7 +48,7 @@ public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Com private String comments; - @ApiModelProperty(value = "The identifier of the bucket this snapshot belongs to.", required = true) + @Schema(description = "The identifier of the bucket this snapshot belongs to.") public String getBucketIdentifier() { return bucketIdentifier; } @@ -57,7 +57,7 @@ public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Com this.bucketIdentifier = bucketIdentifier; } - @ApiModelProperty(value = "The identifier of the flow this snapshot belongs to.", required = true) + @Schema(description = "The identifier of the flow this snapshot belongs to.") public String getFlowIdentifier() { return flowIdentifier; } @@ -66,7 +66,7 @@ public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Com this.flowIdentifier = flowIdentifier; } - @ApiModelProperty(value = "The version of this snapshot of the flow.", required = true) + @Schema(description = "The version of this snapshot of the flow.") public int getVersion() { return version; } @@ -75,7 +75,7 @@ public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Com this.version = version; } - @ApiModelProperty(value = "The timestamp when the flow was saved, as milliseconds since epoch.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The timestamp when the flow was saved, as milliseconds since epoch.", accessMode = Schema.AccessMode.READ_ONLY) public long getTimestamp() { return timestamp; } @@ -84,7 +84,7 @@ public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Com this.timestamp = timestamp; } - @ApiModelProperty(value = "The user that created this snapshot of the flow.", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "The user that created this snapshot of the flow.", accessMode = Schema.AccessMode.READ_ONLY) public String getAuthor() { return author; } @@ -93,7 +93,7 @@ public class VersionedFlowSnapshotMetadata extends LinkableEntity implements Com this.author = author; } - @ApiModelProperty("The comments provided by the user when creating the snapshot.") + @Schema(description = "The comments provided by the user when creating the snapshot.") public String getComments() { return comments; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/JaxbLink.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/JaxbLink.java index 4de9e01f54..bc22046eb1 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/JaxbLink.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/JaxbLink.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlAnyAttribute; import jakarta.xml.bind.annotation.XmlAttribute; @@ -28,7 +27,6 @@ import java.util.Map; /** * Copy of JAX-RS Link.JaxbLink so that Swagger annotations can be applied properly so that getUri() lines up with "href". */ -@ApiModel public class JaxbLink { private URI uri; @@ -66,7 +64,7 @@ public class JaxbLink { * @return underlying URI. */ @XmlAttribute(name = "href") - @ApiModelProperty(name = "href", value = "The href for the link") + @Schema(name = "href", description = "The href for the link") public URI getUri() { return uri; } @@ -77,7 +75,7 @@ public class JaxbLink { * @return parameter map. */ @XmlAnyAttribute - @ApiModelProperty(name = "params", value = "The params for the link") + @Schema(name = "params", description = "The params for the link") public Map getParams() { if (params == null) { params = new HashMap<>(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/LinkableEntity.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/LinkableEntity.java index 8da0076f2b..6c2a10bb1e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/LinkableEntity.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/link/LinkableEntity.java @@ -16,8 +16,7 @@ */ package org.apache.nifi.registry.link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.ws.rs.core.Link; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -25,15 +24,14 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * Base classes for domain objects that want to provide a hypermedia link. */ -@ApiModel public abstract class LinkableEntity { private Link link; @XmlElement @XmlJavaTypeAdapter(LinkAdapter.class) - @ApiModelProperty(value = "An WebLink to this entity.", - dataType = "org.apache.nifi.registry.link.JaxbLink", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Schema(description = "An WebLink to this entity.", + type = "org.apache.nifi.registry.link.JaxbLink", accessMode = Schema.AccessMode.READ_ONLY) public Link getLink() { return link; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/serialization/jackson/SerializationContainer.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/serialization/jackson/SerializationContainer.java index 030d09c7ea..9f21f2d63d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/serialization/jackson/SerializationContainer.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/serialization/jackson/SerializationContainer.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.serialization.jackson; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; @@ -30,7 +30,7 @@ public class SerializationContainer { private Map header; private T content; - @ApiModelProperty("The serialization headers") + @Schema(description = "The serialization headers") public Map getHeader() { return header; } @@ -39,7 +39,7 @@ public class SerializationContainer { this.header = header; } - @ApiModelProperty("The serialized content") + @Schema(description = "The serialized content") public T getContent() { return content; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/pom.xml index ded04731a0..8cce75720e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/pom.xml @@ -26,7 +26,7 @@ - io.swagger + io.swagger.core.v3 swagger-annotations diff --git a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/src/main/java/org/apache/nifi/registry/revision/entity/RevisionInfo.java b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/src/main/java/org/apache/nifi/registry/revision/entity/RevisionInfo.java index 3137a640cb..cd2842f808 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/src/main/java/org/apache/nifi/registry/revision/entity/RevisionInfo.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-entity-model/src/main/java/org/apache/nifi/registry/revision/entity/RevisionInfo.java @@ -16,10 +16,9 @@ */ package org.apache.nifi.registry.revision.entity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; -@ApiModel(description = "The revision information for an entity managed through the REST API.") +@Schema(description = "The revision information for an entity managed through the REST API.") public class RevisionInfo { private String clientId; @@ -39,8 +38,8 @@ public class RevisionInfo { this.lastModifier = lastModifier; } - @ApiModelProperty( - value = "A client identifier used to make a request. By including a client identifier, the API can allow multiple requests " + + @Schema( + description = "A client identifier used to make a request. By including a client identifier, the API can allow multiple requests " + "without needing the current revision. Due to the asynchronous nature of requests/responses this was implemented to " + "allow the client to make numerous requests without having to wait for the previous response to come back." ) @@ -52,8 +51,8 @@ public class RevisionInfo { this.clientId = clientId; } - @ApiModelProperty( - value = "NiFi Registry employs an optimistic locking strategy where the client must include a revision in their request " + + @Schema( + description = "NiFi Registry employs an optimistic locking strategy where the client must include a revision in their request " + "when performing an update. In a response to a mutable flow request, this field represents the updated base version." ) public Long getVersion() { @@ -64,9 +63,9 @@ public class RevisionInfo { this.version = version; } - @ApiModelProperty( - value = "The user that last modified the entity.", - accessMode = ApiModelProperty.AccessMode.READ_ONLY + @Schema( + description = "The user that last modified the entity.", + accessMode = Schema.AccessMode.READ_ONLY ) public String getLastModifier() { return lastModifier; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml index 944a40ff8e..a63d0ff0a6 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml @@ -26,10 +26,10 @@ ${project.basedir}/src/main/resources/swagger - ${project.build.directory}/swagger ${project.basedir}/src/main/asciidoc ${project.build.directory}/asciidoc ${project.build.directory}/${project.artifactId}-${project.version}/docs/ + ${docs.dir}/rest-api/ @@ -76,7 +76,7 @@ copy-resources - ${docs.dir}/rest-api/images + ${api.docs.dir}/images src/main/resources/images @@ -89,17 +89,17 @@ io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.2.19 org.apache.nifi.registry.web.api - ${swagger.generated.dir} + ${api.docs.dir} swagger JSONANDYAML true 200 ${project.build.outputDirectory}/openapi.yaml + org.apache.nifi.swagger.integration.StandardObjectMapperProcessor @@ -109,11 +109,17 @@ + + + org.apache.nifi + nifi-swagger-integration + 2.0.0-SNAPSHOT + + io.swagger.codegen.v3 swagger-codegen-maven-plugin - 3.0.50 compile @@ -121,8 +127,8 @@ generate - ${swagger.generated.dir}/swagger.yaml - ${docs.dir}/rest-api/ + ${api.docs.dir}/swagger.yaml + ${api.docs.dir} html ${project.basedir}/src/main/resources/templates false @@ -269,7 +275,7 @@ jaxb-runtime
- io.swagger + io.swagger.core.v3 swagger-annotations diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/asciidoc/rest-api.adoc b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/asciidoc/rest-api.adoc deleted file mode 100644 index 4430d836a8..0000000000 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/asciidoc/rest-api.adoc +++ /dev/null @@ -1,20 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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. - -include::{generated}/overview.adoc[] -include::{generated}/security.adoc[] -include::{generated}/paths.adoc[] -include::{generated}/definitions.adoc[] \ No newline at end of file diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessPolicyResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessPolicyResource.java index 9fc83452bb..5dc63342d2 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessPolicyResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessPolicyResource.java @@ -16,19 +16,20 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.Collections; import java.util.List; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -61,14 +62,7 @@ import org.springframework.stereotype.Component; */ @Component @Path("/policies") -@Api( - value = "policies", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing access policies.") -}) +@Tag(name = "Policies") public class AccessPolicyResource extends ApplicationResource { @Autowired @@ -86,24 +80,28 @@ public class AccessPolicyResource extends ApplicationResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create access policy", - response = AccessPolicy.class, + @Operation( + summary = "Create access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") }) public Response createAccessPolicy( @Context final HttpServletRequest httpServletRequest, - @ApiParam(value = "The access policy configuration details.", required = true) - final AccessPolicy requestAccessPolicy) { + @Parameter(description = "The access policy configuration details.", required = true) final AccessPolicy requestAccessPolicy) { AccessPolicy createdPolicy = serviceFacade.createAccessPolicy(requestAccessPolicy); String locationUri = generateAccessPolicyUri(createdPolicy); @@ -118,20 +116,28 @@ public class AccessPolicyResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get all access policies", - response = AccessPolicy.class, - responseContainer = "List", + @Operation( + summary = "Get all access policies", + responses = @ApiResponse( + content = @Content( + array = @ArraySchema(schema = @Schema(implementation = AccessPolicy.class)) + ) + ), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getAccessPolicies() { List accessPolicies = serviceFacade.getAccessPolicies(); if (accessPolicies == null) { @@ -151,22 +157,27 @@ public class AccessPolicyResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Get access policy", - response = AccessPolicy.class, + @Operation( + summary = "Get access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getAccessPolicy( - @ApiParam(value = "The access policy id.", required = true) + @Parameter(description = "The access policy id.", required = true) @PathParam("id") final String identifier) { final AccessPolicy accessPolicy = serviceFacade.getAccessPolicy(identifier); return generateOkResponse(accessPolicy).build(); @@ -184,29 +195,31 @@ public class AccessPolicyResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{action}/{resource: .+}") - @ApiOperation( - value = "Get access policy for resource", - notes = "Gets an access policy for the specified action and resource", - response = AccessPolicy.class, + @Operation( + summary = "Get access policy for resource", + description = "Gets an access policy for the specified action and resource", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getAccessPolicyForResource( - @ApiParam(value = "The request action.", allowableValues = "read, write, delete", required = true) - @PathParam("action") - final String action, - @ApiParam(value = "The resource of the policy.", required = true) - @PathParam("resource") - final String rawResource) { + @Parameter(description = "The request action.", required = true) + @PathParam("action") final String action, + @Parameter(description = "The resource of the policy.", required = true) + @PathParam("resource") final String rawResource) { // parse the action and resource type final RequestAction requestAction = RequestAction.valueOfValue(action); @@ -221,7 +234,7 @@ public class AccessPolicyResource extends ApplicationResource { * Update an access policy. * * @param httpServletRequest request - * @param identifier The id of the access policy to update. + * @param identifier The id of the access policy to update. * @param requestAccessPolicy An access policy. * @return the updated access policy. */ @@ -229,29 +242,31 @@ public class AccessPolicyResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Update access policy", - response = AccessPolicy.class, + @Operation( + summary = "Update access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") }) public Response updateAccessPolicy( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The access policy id.", required = true) - @PathParam("id") - final String identifier, - @ApiParam(value = "The access policy configuration details.", required = true) - final AccessPolicy requestAccessPolicy) { + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The access policy id.", required = true) + @PathParam("id") final String identifier, + @Parameter(description = "The access policy configuration details.", required = true) final AccessPolicy requestAccessPolicy) { if (requestAccessPolicy == null) { throw new IllegalArgumentException("Access policy details must be specified when updating a policy."); @@ -270,40 +285,41 @@ public class AccessPolicyResource extends ApplicationResource { * Remove a specified access policy. * * @param httpServletRequest request - * @param identifier The id of the access policy to remove. + * @param identifier The id of the access policy to remove. * @return The deleted access policy */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") - @ApiOperation( - value = "Delete access policy", - response = AccessPolicy.class, + @Operation( + summary = "Delete access policy", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "delete"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") }) public Response removeAccessPolicy( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true) - @QueryParam(VERSION) - final LongParameter version, - @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) + @QueryParam(VERSION) final LongParameter version, + @Parameter(description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") @QueryParam(CLIENT_ID) - @DefaultValue(StringUtils.EMPTY) - final ClientIdParameter clientId, - @ApiParam(value = "The access policy id.", required = true) - @PathParam("id") - final String identifier) { + @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, + @Parameter(description = "The access policy id.", required = true) + @PathParam("id") final String identifier) { final RevisionInfo revisionInfo = getRevisionInfo(version, clientId); final AccessPolicy deletedPolicy = serviceFacade.deleteAccessPolicy(identifier, revisionInfo); @@ -319,20 +335,28 @@ public class AccessPolicyResource extends ApplicationResource { @Path("/resources") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get available resources", - notes = "Gets the available resources that support access/authorization policies", - response = Resource.class, - responseContainer = "List", + @Operation( + summary = "Get available resources", + description = "Gets the available resources that support access/authorization policies", + responses = @ApiResponse( + content = @Content( + array = @ArraySchema(schema = @Schema(implementation = Resource.class)) + ) + ), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/policies") }) + @ExtensionProperty(name = "resource", value = "/policies")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403) }) public Response getResources() { final List resources = serviceFacade.getResources(); return generateOkResponse(resources).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java index c0f7d39f2a..8843816578 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java @@ -26,13 +26,7 @@ import com.nimbusds.openid.connect.sdk.AuthenticationErrorResponse; import com.nimbusds.openid.connect.sdk.AuthenticationResponseParser; import com.nimbusds.openid.connect.sdk.AuthenticationSuccessResponse; import io.jsonwebtoken.JwtException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; + import java.io.IOException; import java.net.URI; import java.security.NoSuchAlgorithmException; @@ -43,6 +37,13 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import javax.net.ssl.SSLContext; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -95,19 +96,12 @@ import org.springframework.stereotype.Component; @Component @Path("/access") -@Api( - value = "access", - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoints for obtaining an access token or checking access status.") -}) +@Tag(name = "Access") public class AccessResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(AccessResource.class); private static final String OIDC_REQUEST_IDENTIFIER = "oidc-request-identifier"; - private static final String OIDC_ERROR_TITLE = "Unable to continue login sequence"; private static final String REVOKE_ACCESS_TOKEN_LOGOUT = "oidc_access_token_logout"; private static final String ID_TOKEN_LOGOUT = "oidc_id_token_logout"; private static final String STANDARD_LOGOUT = "oidc_standard_logout"; @@ -150,14 +144,15 @@ public class AccessResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get access status", - notes = "Returns the current client's authenticated identity and permissions to top-level resources", - response = CurrentUser.class, - authorizations = {@Authorization(value = "Authorization")} + @Operation( + summary = "Get access status", + description = "Returns the current client's authenticated identity and permissions to top-level resources", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CurrentUser.class))) + ) + @ApiResponses( + { + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might be running unsecured.")} ) - @ApiResponses({ - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might be running unsecured.") }) public Response getAccessStatus(@Context HttpServletRequest httpServletRequest) { final NiFiUser user = NiFiUserUtils.getNiFiUser(); @@ -183,19 +178,20 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/token") - @ApiOperation( - value = "Create token trying all providers", - notes = "Creates a token for accessing the REST API via auto-detected method of verifying client identity claim credentials. " + + @Operation( + summary = "Create token trying all providers", + description = "Creates a token for accessing the REST API via auto-detected method of verifying client identity claim credentials. " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '.", - response = String.class + "in the format 'Authorization: Bearer '." + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with username/password."), + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with username/password."), - @ApiResponse(code = 500, message = HttpStatusMessages.MESSAGE_500) }) public Response createAccessTokenByTryingAllProviders(@Context HttpServletRequest httpServletRequest) { // only support access tokens when communicating over HTTPS @@ -215,7 +211,7 @@ public class AccessResource extends ApplicationResource { try { token = createAccessToken(provider, authenticationRequest); break; - } catch (final InvalidCredentialsException ice){ + } catch (final InvalidCredentialsException ice) { logger.debug("{}: the supplied client credentials are invalid.", provider.getClass().getSimpleName()); logger.debug("", ice); } @@ -249,21 +245,21 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/token/login") - @ApiOperation( - value = "Create token using basic auth", - notes = "Creates a token for accessing the REST API via username/password. The user credentials must be passed in standard HTTP Basic Auth format. " + + @Operation( + summary = "Create token using basic auth", + description = "Creates a token for accessing the REST API via username/password. The user credentials must be passed in standard HTTP Basic Auth format. " + "That is: 'Authorization: Basic ', where is the base64 encoded value of ':'. " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '.", - response = String.class, - authorizations = { @Authorization("BasicAuth") } + "in the format 'Authorization: Bearer '." + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with username/password."), + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with username/password."), - @ApiResponse(code = 500, message = HttpStatusMessages.MESSAGE_500) }) public Response createAccessTokenUsingBasicAuthCredentials(@Context HttpServletRequest httpServletRequest) { // only support access tokens when communicating over HTTPS @@ -292,8 +288,8 @@ public class AccessResource extends ApplicationResource { final String token; try { - token = createAccessToken(identityProvider, authenticationRequest); - } catch (final InvalidCredentialsException ice){ + token = createAccessToken(identityProvider, authenticationRequest); + } catch (final InvalidCredentialsException ice) { throw new UnauthorizedException("The supplied client credentials are not valid.", ice) .withAuthenticateChallenge(IdentityProviderUsage.AuthType.OTHER); } @@ -307,15 +303,15 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/logout") - @ApiOperation( - value = "Performs a logout for other providers that have been issued a JWT.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Performs a logout for other providers that have been issued a JWT.", + description = NON_GUARANTEED_ENDPOINT ) @ApiResponses( value = { - @ApiResponse(code = 200, message = "User was logged out successfully."), - @ApiResponse(code = 401, message = "Authentication token provided was empty or not in the correct JWT format."), - @ApiResponse(code = 500, message = "Client failed to log out."), + @ApiResponse(responseCode = "200", description = "User was logged out successfully."), + @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), + @ApiResponse(responseCode = "500", description = "Client failed to log out."), } ) public Response logout(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) { @@ -325,7 +321,7 @@ public class AccessResource extends ApplicationResource { final String userIdentity = NiFiUserUtils.getNiFiUserIdentity(); - if(userIdentity != null && !userIdentity.isEmpty()) { + if (userIdentity != null && !userIdentity.isEmpty()) { try { logger.info("Logging out user " + userIdentity); jwtService.deleteKey(userIdentity); @@ -343,15 +339,15 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/logout/complete") - @ApiOperation( - value = "Completes the logout sequence.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Completes the logout sequence.", + description = NON_GUARANTEED_ENDPOINT ) @ApiResponses( value = { - @ApiResponse(code = 200, message = "User was logged out successfully."), - @ApiResponse(code = 401, message = "Authentication token provided was empty or not in the correct JWT format."), - @ApiResponse(code = 500, message = "Client failed to log out."), + @ApiResponse(responseCode = "200", description = "User was logged out successfully."), + @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), + @ApiResponse(responseCode = "500", description = "Client failed to log out."), } ) public void logoutComplete(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws IOException { @@ -367,19 +363,20 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/token/kerberos") - @ApiOperation( - value = "Create token using kerberos", - notes = "Creates a token for accessing the REST API via Kerberos Service Tickets or SPNEGO Tokens (which includes Kerberos Service Tickets). " + + @Operation( + summary = "Create token using kerberos", + description = "Creates a token for accessing the REST API via Kerberos Service Tickets or SPNEGO Tokens (which includes Kerberos Service Tickets). " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '.", - response = String.class + "in the format 'Authorization: Bearer '." + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login Kerberos credentials."), + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login Kerberos credentials."), - @ApiResponse(code = 500, message = HttpStatusMessages.MESSAGE_500) }) public Response createAccessTokenUsingKerberosTicket(@Context HttpServletRequest httpServletRequest) { // only support access tokens when communicating over HTTPS @@ -402,7 +399,7 @@ public class AccessResource extends ApplicationResource { final String token; try { token = createAccessToken(kerberosSpnegoIdentityProvider, authenticationRequest); - } catch (final InvalidCredentialsException ice){ + } catch (final InvalidCredentialsException ice) { throw new UnauthorizedException("The supplied client credentials are not valid.", ice) .withAuthenticateChallenge(kerberosSpnegoIdentityProvider.getUsageInstructions().getAuthType()); } @@ -423,21 +420,22 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/token/identity-provider") - @ApiOperation( - value = "Create token using identity provider", - notes = "Creates a token for accessing the REST API via a custom identity provider. " + + @Operation( + summary = "Create token using identity provider", + description = "Creates a token for accessing the REST API via a custom identity provider. " + "The user credentials must be passed in a format understood by the custom identity provider, e.g., a third-party auth token in an HTTP header. " + "The exact format of the user credentials expected by the custom identity provider can be discovered by 'GET /access/token/identity-provider/usage'. " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '.", - response = String.class + "in the format 'Authorization: Bearer '." + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), - @ApiResponse(code = 500, message = HttpStatusMessages.MESSAGE_500) }) public Response createAccessTokenUsingIdentityProviderCredentials(@Context HttpServletRequest httpServletRequest) { // only support access tokens when communicating over HTTPS @@ -481,15 +479,16 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/token/identity-provider/usage") - @ApiOperation( - value = "Get identity provider usage", - notes = "Provides a description of how the currently configured identity provider expects credentials to be passed to POST /access/token/identity-provider", - response = String.class + @Operation( + summary = "Get identity provider usage", + description = "Provides a description of how the currently configured identity provider expects credentials to be passed to POST /access/token/identity-provider" + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), - @ApiResponse(code = 500, message = HttpStatusMessages.MESSAGE_500) }) public Response getIdentityProviderUsageInstructions(@Context HttpServletRequest httpServletRequest) { // if not configuration for login, don't consider credentials @@ -524,17 +523,18 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/token/identity-provider/test") - @ApiOperation( - value = "Test identity provider", - notes = "Tests the format of the credentials against this identity provider without preforming authentication on the credentials to validate them. " + - "The user credentials should be passed in a format understood by the custom identity provider as defined by 'GET /access/token/identity-provider/usage'.", - response = String.class + @Operation( + summary = "Test identity provider", + description = "Tests the format of the credentials against this identity provider without preforming authentication on the credentials to validate them. " + + "The user credentials should be passed in a format understood by the custom identity provider as defined by 'GET /access/token/identity-provider/usage'." + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = "The format of the credentials were not recognized by the currently configured identity provider."), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = "The format of the credentials were not recognized by the currently configured identity provider."), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), - @ApiResponse(code = 500, message = HttpStatusMessages.MESSAGE_500) }) public Response testIdentityProviderRecognizesCredentialsFormat(@Context HttpServletRequest httpServletRequest) { // only support access tokens when communicating over HTTPS @@ -569,9 +569,9 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/oidc/request") - @ApiOperation( - value = "Initiates a request to authenticate through the configured OpenId Connect provider.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Initiates a request to authenticate through the configured OpenId Connect provider.", + description = NON_GUARANTEED_ENDPOINT ) public void oidcRequest(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { // only consider user specific access over https @@ -596,9 +596,9 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/oidc/callback") - @ApiOperation( - value = "Redirect/callback URI for processing the result of the OpenId Connect login sequence.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Redirect/callback URI for processing the result of the OpenId Connect login sequence.", + description = NON_GUARANTEED_ENDPOINT ) public void oidcCallback(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { // only consider user specific access over https @@ -658,10 +658,9 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("/oidc/exchange") - @ApiOperation( - value = "Retrieves a JWT following a successful login sequence using the configured OpenId Connect provider.", - response = String.class, - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Retrieves a JWT following a successful login sequence using the configured OpenId Connect provider.", + description = NON_GUARANTEED_ENDPOINT ) public Response oidcExchange(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { // only consider user specific access over https @@ -696,9 +695,9 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/oidc/logout") - @ApiOperation( - value = "Performs a logout in the OpenId Provider.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Performs a logout in the OpenId Provider.", + description = NON_GUARANTEED_ENDPOINT ) public void oidcLogout(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { if (!httpServletRequest.isSecure()) { @@ -743,9 +742,9 @@ public class AccessResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.WILDCARD) @Path("/oidc/logout/callback") - @ApiOperation( - value = "Redirect/callback URI for processing the result of the OpenId Connect logout sequence.", - notes = NON_GUARANTEED_ENDPOINT + @Operation( + summary = "Redirect/callback URI for processing the result of the OpenId Connect logout sequence.", + description = NON_GUARANTEED_ENDPOINT ) public void oidcLogoutCallback(@Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws Exception { if (!httpServletRequest.isSecure()) { @@ -775,7 +774,7 @@ public class AccessResource extends ApplicationResource { final AuthorizationGrant authorizationGrant = new AuthorizationCodeGrant(authorizationCode, URI.create(getOidcLogoutCallback())); final String logoutMethod = determineLogoutMethod(); - switch(logoutMethod) { + switch (logoutMethod) { case REVOKE_ACCESS_TOKEN_LOGOUT: final String accessToken; try { @@ -840,7 +839,7 @@ public class AccessResource extends ApplicationResource { * Gets the value of a cookie matching the specified name. If no cookie with that name exists, null is returned. * * @param cookies the cookies - * @param name the name of the cookie + * @param name the name of the cookie * @return the value of the corresponding cookie, or null if the cookie does not exist */ private String getCookieValue(final Cookie[] cookies, final String name) { @@ -898,13 +897,13 @@ public class AccessResource extends ApplicationResource { /** * A helper function that generates a prioritized list of IdentityProviders to use to * attempt client authentication. - * + *

* Note: This is currently a hard-coded list order consisting of: - * + *

* - X509IdentityProvider (if available) * - KerberosProvider (if available) * - User-defined IdentityProvider (if available) - * + *

* However, in the future it could be entirely user-configurable * * @return a list of providers to use in order to authenticate the client. diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java index 8f4443007c..0dc4dba44d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java @@ -33,6 +33,7 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriBuilderException; import jakarta.ws.rs.core.UriInfo; + import java.net.URI; import java.net.URISyntaxException; import java.util.Objects; @@ -180,7 +181,7 @@ public class ApplicationResource { /** * Generates a 201 Created response with the specified content. * - * @param uri The URI + * @param uri The URI * @param entity entity * @return The response to be built */ diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java index 35b34b4142..d22c15e871 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java @@ -16,21 +16,20 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.io.IOException; import java.io.InputStream; import java.util.List; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; @@ -43,7 +42,6 @@ import org.apache.nifi.registry.event.EventFactory; import org.apache.nifi.registry.event.EventService; import org.apache.nifi.registry.extension.bundle.Bundle; import org.apache.nifi.registry.extension.bundle.BundleType; -import org.apache.nifi.registry.extension.bundle.BundleTypeValues; import org.apache.nifi.registry.extension.bundle.BundleVersion; import org.apache.nifi.registry.web.service.ServiceFacade; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; @@ -55,14 +53,7 @@ import org.springframework.stereotype.Component; @Component @Path("/buckets/{bucketId}/bundles") -@Api( - value = "bucket bundles", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Create extension bundles scoped to an existing bucket in the registry.") -}) +@Tag(name = "BucketBundles") public class BucketBundleResource extends ApplicationResource { private static final Logger LOGGER = LoggerFactory.getLogger(BucketBundleResource.class); @@ -76,9 +67,9 @@ public class BucketBundleResource extends ApplicationResource { @Path("{bundleType}") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create extension bundle version", - notes = "Creates a version of an extension bundle by uploading a binary artifact. " + + @Operation( + summary = "Create extension bundle version", + description = "Creates a version of an extension bundle by uploading a binary artifact. " + "If an extension bundle already exists in the given bucket with the same group id and artifact id " + "as that of the bundle being uploaded, then it will be added as a new version to the existing bundle. " + "If an extension bundle does not already exist in the given bucket with the same group id and artifact id, " + @@ -87,48 +78,31 @@ public class BucketBundleResource extends ApplicationResource { "If supplied, then this value will be compared against the SHA-256 computed by the server, and the bundle " + "will be rejected if the values do not match. If not supplied, the bundle will be accepted, but will be marked " + "to indicate that the client did not supply a SHA-256 during creation. " + NON_GUARANTEED_ENDPOINT, - response = BundleVersion.class, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BundleVersion.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) } ) - @ApiImplicitParams( - value = { - @ApiImplicitParam( - name = "file", - value = "The binary content of the bundle file being uploaded.", - required = true, - type = "file", - paramType = "formData"), - @ApiImplicitParam( - name = "sha256", - value = "Optional sha256 of the provided bundle", - required = false, - type = "string", - paramType = "formData") - } + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response createExtensionBundleVersion( @PathParam("bucketId") - @ApiParam(value = "The bucket identifier", required = true) - final String bucketId, + @Parameter(description = "The bucket identifier", required = true) final String bucketId, @PathParam("bundleType") - @ApiParam(value = "The type of the bundle", required = true, allowableValues = BundleTypeValues.ALL_VALUES) - final BundleType bundleType, - @FormDataParam("file") - final InputStream fileInputStream, - @FormDataParam("file") - final FormDataContentDisposition fileMetaData, - @FormDataParam("sha256") - final String clientSha256) throws IOException { + @Parameter(description = "The type of the bundle", required = true) final BundleType bundleType, + @FormDataParam("file") final InputStream fileInputStream, + @FormDataParam("file") final FormDataContentDisposition fileMetaData, + @FormDataParam("sha256") final String clientSha256) throws IOException { LOGGER.debug("Creating extension bundle version for bundle type {}", new Object[]{bundleType}); @@ -144,27 +118,29 @@ public class BucketBundleResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension bundles by bucket", - notes = NON_GUARANTEED_ENDPOINT, - response = Bundle.class, - responseContainer = "List", + @Operation( + summary = "Get extension bundles by bucket", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bundle.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getExtensionBundles( @PathParam("bucketId") - @ApiParam(value = "The bucket identifier", required = true) - final String bucketId) { + @Parameter(description = "The bucket identifier", required = true) final String bucketId) { final List bundles = serviceFacade.getBundlesByBucket(bucketId); return Response.status(Response.Status.OK).entity(bundles).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java index 355d49921d..7c852b92fb 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java @@ -16,19 +16,20 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.List; import java.util.SortedSet; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.BadRequestException; import jakarta.ws.rs.Consumes; @@ -64,14 +65,7 @@ import org.springframework.stereotype.Component; @Component @Path("/buckets/{bucketId}/flows") -@Api( - value = "bucket flows", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Create flows scoped to an existing bucket in the registry.") -}) +@Tag(name = "BucketFlows") public class BucketFlowResource extends ApplicationResource { @Autowired @@ -82,28 +76,31 @@ public class BucketFlowResource extends ApplicationResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create flow", - notes = "Creates a flow in the given bucket. The flow id is created by the server and populated in the returned entity.", - response = VersionedFlow.class, + @Operation( + summary = "Create flow", + description = "Creates a flow in the given bucket. The flow id is created by the server and populated in the returned entity.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response createFlow( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, - @ApiParam(value = "The details of the flow to create.", required = true) - final VersionedFlow flow) { + @Parameter(description = "The bucket identifier") final String bucketId, + @Parameter(description = "The details of the flow to create.", required = true) final VersionedFlow flow) { verifyPathParamsMatchBody(bucketId, flow); @@ -115,27 +112,30 @@ public class BucketFlowResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket flows", - notes = "Retrieves all flows in the given bucket.", - response = VersionedFlow.class, - responseContainer = "List", + @Operation( + summary = "Get bucket flows", + description = "Retrieves all flows in the given bucket.", + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlow.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlows( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId) { + @Parameter(description = "The bucket identifier") final String bucketId) { final List flows = serviceFacade.getFlows(bucketId); return Response.status(Response.Status.OK).entity(flows).build(); @@ -145,29 +145,32 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket flow", - notes = "Retrieves the flow with the given id in the given bucket.", - response = VersionedFlow.class, + @Operation( + summary = "Get bucket flow", + description = "Retrieves the flow with the given id in the given bucket.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlow( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final VersionedFlow flow = serviceFacade.getFlow(bucketId, flowId); return Response.status(Response.Status.OK).entity(flow).build(); @@ -177,31 +180,33 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Update bucket flow", - notes = "Updates the flow with the given id in the given bucket.", - response = VersionedFlow.class, + @Operation( + summary = "Update bucket flow", + description = "Updates the flow with the given id in the given bucket.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response updateFlow( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId, - @ApiParam(value = "The updated flow", required = true) - final VersionedFlow flow) { + @Parameter(description = "The flow identifier") final String flowId, + @Parameter(description = "The updated flow", required = true) final VersionedFlow flow) { verifyPathParamsMatchBody(bucketId, flowId, flow); @@ -217,35 +222,36 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Delete bucket flow", - notes = "Deletes a flow, including all saved versions of that flow.", - response = VersionedFlow.class, + @Operation( + summary = "Delete bucket flow", + description = "Deletes a flow, including all saved versions of that flow.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "delete"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response deleteFlow( - @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true) - @QueryParam(VERSION) - final LongParameter version, - @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") + @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) + @QueryParam(VERSION) final LongParameter version, + @Parameter(description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") @QueryParam(CLIENT_ID) - @DefaultValue(StringUtils.EMPTY) - final ClientIdParameter clientId, + @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final RevisionInfo revisionInfo = getRevisionInfo(version, clientId); final VersionedFlow deletedFlow = serviceFacade.deleteFlow(bucketId, flowId, revisionInfo); @@ -258,36 +264,36 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create flow version", - notes = "Creates the next version of a flow. The version number of the object being created must be the " + + @Operation( + summary = "Create flow version", + description = "Creates the next version of a flow. The version number of the object being created must be the " + "next available version integer. Flow versions are immutable after they are created.", - response = VersionedFlowSnapshot.class, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response createFlowVersion( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam(value = "The flow identifier") - final String flowId, - @ApiParam(value = "The new versioned flow snapshot.", required = true) - final VersionedFlowSnapshot snapshot, - @ApiParam( - value = "Whether source properties like author should be kept") - @QueryParam("preserveSourceProperties") - final boolean preserveSourceProperties) { + @Parameter(description = "The flow identifier") final String flowId, + @Parameter(description = "The new versioned flow snapshot.", required = true) final VersionedFlowSnapshot snapshot, + @Parameter(description = "Whether source properties like author should be kept") + @QueryParam("preserveSourceProperties") final boolean preserveSourceProperties) { verifyPathParamsMatchBody(bucketId, flowId, snapshot); @@ -316,32 +322,35 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions/import") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Import flow version", - notes = "Import the next version of a flow. The version number of the object being created will be the " + + @Operation( + summary = "Import flow version", + description = "Import the next version of a flow. The version number of the object being created will be the " + "next available version integer. Flow versions are immutable after they are created.", - response = VersionedFlowSnapshot.class, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "201", description = HttpStatusMessages.MESSAGE_201), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 201, message = HttpStatusMessages.MESSAGE_201), - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response importVersionedFlow( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam(value = "The flow identifier") - final String flowId, - @ApiParam("file") final VersionedFlowSnapshot versionedFlowSnapshot, + @Parameter(description = "The flow identifier") final String flowId, + @Parameter(description = "file") final VersionedFlowSnapshot versionedFlowSnapshot, @HeaderParam("Comments") final String comments) { final VersionedFlowSnapshot createdSnapshot = serviceFacade.importVersionedFlowSnapshot(versionedFlowSnapshot, bucketId, flowId, comments); @@ -354,29 +363,31 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket flow versions", - notes = "Gets summary information for all versions of a flow. Versions are ordered newest->oldest.", - response = VersionedFlowSnapshotMetadata.class, - responseContainer = "List", + @Operation( + summary = "Get bucket flow versions", + description = "Gets summary information for all versions of a flow. Versions are ordered newest->oldest.", + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlowVersions( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final SortedSet snapshots = serviceFacade.getFlowSnapshots(bucketId, flowId); return Response.status(Response.Status.OK).entity(snapshots).build(); @@ -386,28 +397,31 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions/latest") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get latest bucket flow version content", - notes = "Gets the latest version of a flow, including the metadata and content of the flow.", - response = VersionedFlowSnapshot.class, + @Operation( + summary = "Get latest bucket flow version content", + description = "Gets the latest version of a flow, including the metadata and content of the flow.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getLatestFlowVersion( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final VersionedFlowSnapshot lastSnapshot = serviceFacade.getLatestFlowSnapshot(bucketId, flowId); return Response.status(Response.Status.OK).entity(lastSnapshot).build(); @@ -417,28 +431,31 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions/latest/metadata") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get latest bucket flow version metadata", - notes = "Gets the metadata for the latest version of a flow.", - response = VersionedFlowSnapshotMetadata.class, + @Operation( + summary = "Get latest bucket flow version metadata", + description = "Gets the metadata for the latest version of a flow.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getLatestFlowVersionMetadata( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final VersionedFlowSnapshotMetadata latest = serviceFacade.getLatestFlowSnapshotMetadata(bucketId, flowId); return Response.status(Response.Status.OK).entity(latest).build(); @@ -448,28 +465,33 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions/{versionNumber: \\d+}/export") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Exports specified bucket flow version content", - notes = "Exports the specified version of a flow, including the metadata and content of the flow.", - response = VersionedFlowSnapshot.class, + @Operation( + summary = "Exports specified bucket flow version content", + description = "Exports the specified version of a flow, including the metadata and content of the flow.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")}) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409)}) public Response exportVersionedFlow( @PathParam("bucketId") - @ApiParam("The bucket identifier") final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") final String flowId, + @Parameter(description = "The flow identifier") final String flowId, @PathParam("versionNumber") - @ApiParam("The version number") final Integer versionNumber) { + @Parameter(description = "The version number") final Integer versionNumber) { final ExportedVersionedFlowSnapshot exportedVersionedFlowSnapshot = serviceFacade.exportFlowSnapshot(bucketId, flowId, versionNumber); @@ -489,32 +511,34 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/versions/{versionNumber: \\d+}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket flow version", - notes = "Gets the given version of a flow, including the metadata and content for the version.", - response = VersionedFlowSnapshot.class, + @Operation( + summary = "Get bucket flow version", + description = "Gets the given version of a flow, including the metadata and content for the version.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlowVersion( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId, + @Parameter(description = "The flow identifier") final String flowId, @PathParam("versionNumber") - @ApiParam("The version number") - final Integer versionNumber) { + @Parameter(description = "The version number") final Integer versionNumber) { final VersionedFlowSnapshot snapshot = serviceFacade.getFlowSnapshot(bucketId, flowId, versionNumber); return Response.status(Response.Status.OK).entity(snapshot).build(); @@ -524,35 +548,36 @@ public class BucketFlowResource extends ApplicationResource { @Path("{flowId}/diff/{versionA: \\d+}/{versionB: \\d+}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket flow diff", - notes = "Computes the differences between two given versions of a flow.", - response = VersionedFlowDifference.class, + @Operation( + summary = "Get bucket flow diff", + description = "Computes the differences between two given versions of a flow.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowDifference.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409)}) public Response getFlowDiff( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, + @Parameter(description = "The bucket identifier") final String bucketId, @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId, + @Parameter(description = "The flow identifier") final String flowId, @PathParam("versionA") - @ApiParam("The first version number") - final Integer versionNumberA, + @Parameter(description = "The first version number") final Integer versionNumberA, @PathParam("versionB") - @ApiParam("The second version number") - final Integer versionNumberB) { + @Parameter(description = "The second version number") final Integer versionNumberB) { final VersionedFlowDifference result = serviceFacade.getFlowDiff(bucketId, flowId, versionNumberA, versionNumberB); return Response.status(Response.Status.OK).entity(result).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java index 6c30b6b686..18878a891f 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java @@ -16,18 +16,19 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.List; import java.util.Set; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.BadRequestException; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -55,14 +56,7 @@ import org.springframework.stereotype.Component; @Component @Path("/buckets") -@Api( - value = "buckets", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Create named buckets in the registry to store NiFi objects such flows and extensions. Search for and retrieve existing buckets.") -}) +@Tag(name = "Buckets") public class BucketResource extends ApplicationResource { @Autowired @@ -73,26 +67,28 @@ public class BucketResource extends ApplicationResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create bucket", - response = Bucket.class, + @Operation( + summary = "Create bucket", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets") }) + @ExtensionProperty(name = "resource", value = "/buckets")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403) }) public Response createBucket( - @ApiParam(value = "The bucket to create", required = true) - final Bucket bucket, - @ApiParam( - value = "Whether source properties like identifier should be kept") - @QueryParam("preserveSourceProperties") - final boolean preserveSourceProperties) { + @Parameter(description = "The bucket to create", required = true) final Bucket bucket, + @Parameter(description = "Whether source properties like identifier should be kept") + @QueryParam("preserveSourceProperties") final boolean preserveSourceProperties) { final Bucket createdBucket = serviceFacade.createBucket(bucket, preserveSourceProperties); publish(EventFactory.bucketCreated(createdBucket)); @@ -102,14 +98,13 @@ public class BucketResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get all buckets", - notes = "The returned list will include only buckets for which the user is authorized." + + @Operation( + summary = "Get all buckets", + description = "The returned list will include only buckets for which the user is authorized." + "If the user is not authorized for any buckets, this returns an empty list.", - response = Bucket.class, - responseContainer = "List" + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bucket.class)))) ) - @ApiResponses({ @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401) }) + @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getBuckets() { // ServiceFacade will determine which buckets the user is authorized for // Note: We don't explicitly check for access to (READ, /buckets) because @@ -127,24 +122,28 @@ public class BucketResource extends ApplicationResource { @Path("{bucketId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket", - notes = "Gets the bucket with the given id.", - response = Bucket.class, + @Operation( + summary = "Get bucket", + description = "Gets the bucket with the given id.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404) }) public Response getBucket( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId) { + @Parameter(description = "The bucket identifier") final String bucketId) { final Bucket bucket = serviceFacade.getBucket(bucketId); return Response.status(Response.Status.OK).entity(bucket).build(); @@ -154,28 +153,31 @@ public class BucketResource extends ApplicationResource { @Path("{bucketId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Update bucket", - notes = "Updates the bucket with the given id.", - response = Bucket.class, + @Operation( + summary = "Update bucket", + description = "Updates the bucket with the given id.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response updateBucket( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId, - @ApiParam(value = "The updated bucket", required = true) - final Bucket bucket) { + @Parameter(description = "The bucket identifier") final String bucketId, + @Parameter(description = "The updated bucket", required = true) final Bucket bucket) { if (StringUtils.isBlank(bucketId)) { throw new BadRequestException("Bucket id cannot be blank"); @@ -200,32 +202,34 @@ public class BucketResource extends ApplicationResource { @Path("{bucketId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Delete bucket", - notes = "Deletes the bucket with the given id, along with all objects stored in the bucket", - response = Bucket.class, + @Operation( + summary = "Delete bucket", + description = "Deletes the bucket with the given id, along with all objects stored in the bucket", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "delete"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404) }) public Response deleteBucket( - @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true) - @QueryParam(VERSION) - final LongParameter version, - @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") + @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) + @QueryParam(VERSION) final LongParameter version, + @Parameter(description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") @QueryParam(CLIENT_ID) - @DefaultValue(StringUtils.EMPTY) - final ClientIdParameter clientId, + @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId) { + @Parameter(description = "The bucket identifier") final String bucketId) { if (StringUtils.isBlank(bucketId)) { throw new BadRequestException("Bucket id cannot be blank"); @@ -242,15 +246,14 @@ public class BucketResource extends ApplicationResource { @Path("fields") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket fields", - notes = "Retrieves bucket field names for searching or sorting on buckets.", - response = Fields.class + @Operation( + summary = "Get bucket fields", + description = "Retrieves bucket field names for searching or sorting on buckets.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Fields.class))) ) public Response getAvailableBucketFields() { final Set bucketFields = serviceFacade.getBucketFields(); final Fields fields = new Fields(bucketFields); return Response.status(Response.Status.OK).entity(fields).build(); } - } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java index 17c5c7d5b1..f0b39784fc 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java @@ -16,18 +16,19 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.List; import java.util.SortedSet; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.GET; @@ -53,14 +54,7 @@ import org.springframework.stereotype.Component; @Component @Path("/bundles") -@Api( - value = "bundles", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Gets metadata about extension bundles and their versions.") -}) +@Tag(name = "Bundles") public class BundleResource extends ApplicationResource { public static final String CONTENT_DISPOSITION_HEADER = "content-disposition"; @@ -75,28 +69,30 @@ public class BundleResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get all bundles", - notes = "Gets the metadata for all bundles across all authorized buckets with optional filters applied. " + + @Operation( + summary = "Get all bundles", + description = "Gets the metadata for all bundles across all authorized buckets with optional filters applied. " + "The returned results will include only items from buckets for which the user is authorized. " + "If the user is not authorized to any buckets, an empty list will be returned. " + NON_GUARANTEED_ENDPOINT, - response = Bundle.class, - responseContainer = "List" + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bundle.class)))) ) - @ApiResponses({ @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401) }) + @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getBundles( @QueryParam("bucketName") - @ApiParam("Optional bucket name to filter results. The value may be an exact match, or a wildcard, " + - "such as 'My Bucket%' to select all bundles where the bucket name starts with 'My Bucket'.") - final String bucketName, + @Parameter( + description = "Optional bucket name to filter results. The value may be an exact match, or a wildcard, " + + "such as 'My Bucket%' to select all bundles where the bucket name starts with 'My Bucket'." + ) final String bucketName, @QueryParam("groupId") - @ApiParam("Optional groupId to filter results. The value may be an exact match, or a wildcard, " + - "such as 'com.%' to select all bundles where the groupId starts with 'com.'.") - final String groupId, + @Parameter( + description = "Optional groupId to filter results. The value may be an exact match, or a wildcard, " + + "such as 'com.%' to select all bundles where the groupId starts with 'com.'." + ) final String groupId, @QueryParam("artifactId") - @ApiParam("Optional artifactId to filter results. The value may be an exact match, or a wildcard, " + - "such as 'nifi-%' to select all bundles where the artifactId starts with 'nifi-'.") - final String artifactId) { + @Parameter( + description = "Optional artifactId to filter results. The value may be an exact match, or a wildcard, " + + "such as 'nifi-%' to select all bundles where the artifactId starts with 'nifi-'." + ) final String artifactId) { final BundleFilterParams filterParams = BundleFilterParams.of(bucketName, groupId, artifactId); @@ -109,27 +105,30 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bundle", - notes = "Gets the metadata about an extension bundle. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalGetExtensionBundle", - response = Bundle.class, + @Operation( + summary = "Get bundle", + description = "Gets the metadata about an extension bundle. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bundle.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundle( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId) { + @Parameter(description = "The extension bundle identifier") final String bundleId) { final Bundle bundle = serviceFacade.getBundle(bundleId); return Response.status(Response.Status.OK).entity(bundle).build(); @@ -139,27 +138,30 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Delete bundle", - notes = "Deletes the given extension bundle and all of it's versions. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalDeleteExtensionBundle", - response = Bundle.class, + @Operation( + summary = "Delete bundle", + description = "Deletes the given extension bundle and all of it's versions. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bundle.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response deleteBundle( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId) { + @Parameter(description = "The extension bundle identifier") final String bundleId) { final Bundle deletedBundle = serviceFacade.deleteBundle(bundleId); publish(EventFactory.extensionBundleDeleted(deletedBundle)); @@ -172,28 +174,30 @@ public class BundleResource extends ApplicationResource { @Path("versions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get all bundle versions", - notes = "Gets the metadata about extension bundle versions across all authorized buckets with optional filters applied. " + + @Operation( + summary = "Get all bundle versions", + description = "Gets the metadata about extension bundle versions across all authorized buckets with optional filters applied. " + "If the user is not authorized to any buckets, an empty list will be returned. " + NON_GUARANTEED_ENDPOINT, - response = BundleVersionMetadata.class, - responseContainer = "List" + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BundleVersionMetadata.class)))) ) - @ApiResponses({ @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401) }) + @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getBundleVersions( @QueryParam("groupId") - @ApiParam("Optional groupId to filter results. The value may be an exact match, or a wildcard, " + - "such as 'com.%' to select all bundle versions where the groupId starts with 'com.'.") - final String groupId, + @Parameter( + description = "Optional groupId to filter results. The value may be an exact match, or a wildcard, " + + "such as 'com.%' to select all bundle versions where the groupId starts with 'com.'." + ) final String groupId, @QueryParam("artifactId") - @ApiParam("Optional artifactId to filter results. The value may be an exact match, or a wildcard, " + - "such as 'nifi-%' to select all bundle versions where the artifactId starts with 'nifi-'.") - final String artifactId, + @Parameter( + description = "Optional artifactId to filter results. The value may be an exact match, or a wildcard, " + + "such as 'nifi-%' to select all bundle versions where the artifactId starts with 'nifi-'." + ) final String artifactId, @QueryParam("version") - @ApiParam("Optional version to filter results. The value maye be an exact match, or a wildcard, " + - "such as '1.0.%' to select all bundle versions where the version starts with '1.0.'.") - final String version - ) { + @Parameter( + description = "Optional version to filter results. The value maye be an exact match, or a wildcard, " + + "such as '1.0.%' to select all bundle versions where the version starts with '1.0.'." + ) final String version + ) { final BundleVersionFilterParams filterParams = BundleVersionFilterParams.of(groupId, artifactId, version); final SortedSet bundleVersions = serviceFacade.getBundleVersions(filterParams); @@ -204,28 +208,30 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bundle versions", - notes = "Gets the metadata for the versions of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalGetBundleVersions", - response = BundleVersionMetadata.class, - responseContainer = "List", + @Operation( + summary = "Get bundle versions", + description = "Gets the metadata for the versions of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BundleVersionMetadata.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundleVersions( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId) { + @Parameter(description = "The extension bundle identifier") final String bundleId) { final SortedSet bundleVersions = serviceFacade.getBundleVersions(bundleId); return Response.status(Response.Status.OK).entity(bundleVersions).build(); @@ -235,30 +241,32 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bundle version", - notes = "Gets the descriptor for the given version of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalGetBundleVersion", - response = BundleVersion.class, + @Operation( + summary = "Get bundle version", + description = "Gets the descriptor for the given version of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BundleVersion.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundleVersion( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version) { + @Parameter(description = "The version of the bundle") final String version) { final BundleVersion bundleVersion = serviceFacade.getBundleVersion(bundleId, version); return Response.ok(bundleVersion).build(); @@ -268,30 +276,32 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}/content") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_OCTET_STREAM) - @ApiOperation( - value = "Get bundle version content", - notes = "Gets the binary content for the given version of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalGetBundleVersionContent", - response = byte[].class, + @Operation( + summary = "Get bundle version content", + description = "Gets the binary content for the given version of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundleVersionContent( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version) { + @Parameter(description = "The version of the bundle") final String version) { final StreamingContent streamingContent = serviceFacade.getBundleVersionContent(bundleId, version); @@ -299,7 +309,7 @@ public class BundleResource extends ApplicationResource { final StreamingOutput output = streamingContent.getOutput(); return Response.ok(output) - .header(CONTENT_DISPOSITION_HEADER,"attachment; filename = " + filename) + .header(CONTENT_DISPOSITION_HEADER, "attachment; filename = " + filename) .build(); } @@ -307,30 +317,31 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Delete bundle version", - notes = "Deletes the given extension bundle version and it's associated binary content. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalDeleteBundleVersion", - response = BundleVersion.class, + @Operation( + summary = "Delete bundle version", + description = "Deletes the given extension bundle version and it's associated binary content. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BundleVersion.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response deleteBundleVersion( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version) { + @Parameter(description = "The version of the bundle") final String version) { final BundleVersion deletedBundleVersion = serviceFacade.deleteBundleVersion(bundleId, version); publish(EventFactory.extensionBundleVersionDeleted(deletedBundleVersion)); @@ -341,31 +352,31 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}/extensions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bundle version extensions", - notes = "Gets the metadata about the extensions in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalGetBundleVersionExtensions", - response = ExtensionMetadata.class, - responseContainer = "List", + @Operation( + summary = "Get bundle version extensions", + description = "Gets the metadata about the extensions in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionMetadata.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getBundleVersionExtensions( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version) { + @Parameter(description = "The version of the bundle") final String version) { final SortedSet extensions = serviceFacade.getExtensionMetadata(bundleId, version); return Response.ok(extensions).build(); @@ -375,35 +386,35 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}/extensions/{name}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bundle version extension", - notes = "Gets the metadata about the extension with the given name in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, - nickname = "globalGetBundleVersionExtension", - response = org.apache.nifi.extension.manifest.Extension.class, - responseContainer = "List", + @Operation( + summary = "Get bundle version extension", + description = "Gets the metadata about the extension with the given name in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = org.apache.nifi.extension.manifest.Extension.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundleVersionExtension( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version, + @Parameter(description = "The version of the bundle") final String version, @PathParam("name") - @ApiParam("The fully qualified name of the extension") - final String name - ) { + @Parameter(description = "The fully qualified name of the extension") final String name + ) { final org.apache.nifi.extension.manifest.Extension extension = serviceFacade.getExtension(bundleId, version, name); @@ -414,32 +425,33 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}/extensions/{name}/docs") @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_HTML) - @ApiOperation( - value = "Get bundle version extension docs", - notes = "Gets the documentation for the given extension in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, - response = String.class, + @Operation( + summary = "Get bundle version extension docs", + description = "Gets the documentation for the given extension in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundleVersionExtensionDocs( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version, + @Parameter(description = "The version of the bundle") final String version, @PathParam("name") - @ApiParam("The fully qualified name of the extension") - final String name + @Parameter(description = "The fully qualified name of the extension") final String name ) { final StreamingOutput streamingOutput = serviceFacade.getExtensionDocs(bundleId, version, name); return Response.ok(streamingOutput).build(); @@ -449,32 +461,33 @@ public class BundleResource extends ApplicationResource { @Path("{bundleId}/versions/{version}/extensions/{name}/docs/additional-details") @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_HTML) - @ApiOperation( - value = "Get bundle version extension docs details", - notes = "Gets the additional details documentation for the given extension in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, - response = String.class, + @Operation( + summary = "Get bundle version extension docs details", + description = "Gets the additional details documentation for the given extension in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getBundleVersionExtensionAdditionalDetailsDocs( @PathParam("bundleId") - @ApiParam("The extension bundle identifier") - final String bundleId, + @Parameter(description = "The extension bundle identifier") final String bundleId, @PathParam("version") - @ApiParam("The version of the bundle") - final String version, + @Parameter(description = "The version of the bundle") final String version, @PathParam("name") - @ApiParam("The fully qualified name of the extension") - final String name + @Parameter(description = "The fully qualified name of the extension") final String name ) { final StreamingOutput streamingOutput = serviceFacade.getAdditionalDetailsDocs(bundleId, version, name); return Response.ok(streamingOutput).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java index a39c3cfc5a..5c80fd919e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java @@ -16,15 +16,14 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @@ -39,14 +38,7 @@ import org.springframework.stereotype.Component; @Component @Path("/config") -@Api( - value = "config", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Retrieves the configuration for this NiFi Registry.") -}) +@Tag(name = "Config") public class ConfigResource extends ApplicationResource { @Autowired @@ -59,19 +51,23 @@ public class ConfigResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get configration", - notes = "Gets the NiFi Registry configurations.", - response = RegistryConfiguration.class, + @Operation( + summary = "Get configration", + description = "Gets the NiFi Registry configurations.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RegistryConfiguration.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/policies,/tenants") }) + @ExtensionProperty(name = "resource", value = "/policies,/tenants")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401) }) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)} + ) public Response getConfiguration() { final RegistryConfiguration config = serviceFacade.getRegistryConfiguration(); return Response.status(Response.Status.OK).entity(config).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java index a4f4a3a473..b7ea435b4e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java @@ -16,18 +16,19 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.List; import java.util.SortedSet; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @@ -55,14 +56,7 @@ import org.springframework.stereotype.Component; @Component @Path("/extension-repository") -@Api( - value = "extension repository", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Interact with extension bundles via the hierarchy of bucket/group/artifact/version.") -}) +@Tag(name = "ExtensionRepository") public class ExtensionRepoResource extends ApplicationResource { public static final String CONTENT_DISPOSITION_HEADER = "content-disposition"; @@ -75,18 +69,20 @@ public class ExtensionRepoResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo buckets", - notes = "Gets the names of the buckets the current user is authorized for in order to browse the repo by bucket. " + NON_GUARANTEED_ENDPOINT, - response = ExtensionRepoBucket.class, - responseContainer = "List" + @Operation( + summary = "Get extension repo buckets", + description = "Gets the names of the buckets the current user is authorized for in order to browse the repo by bucket. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoBucket.class)))) + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoBuckets() { final SortedSet repoBuckets = serviceFacade.getExtensionRepoBuckets(getBaseUri()); return Response.status(Response.Status.OK).entity(repoBuckets).build(); @@ -96,27 +92,29 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo groups", - notes = "Gets the groups in the extension repository in the given bucket. " + NON_GUARANTEED_ENDPOINT, - response = ExtensionRepoGroup.class, - responseContainer = "List", + @Operation( + summary = "Get extension repo groups", + description = "Gets the groups in the extension repository in the given bucket. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoGroup.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getExtensionRepoGroups( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName + @Parameter(description = "The bucket name") final String bucketName ) { final SortedSet repoGroups = serviceFacade.getExtensionRepoGroups(getBaseUri(), bucketName); return Response.status(Response.Status.OK).entity(repoGroups).build(); @@ -126,30 +124,32 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo artifacts", - notes = "Gets the artifacts in the extension repository in the given bucket and group. " + NON_GUARANTEED_ENDPOINT, - response = ExtensionRepoArtifact.class, - responseContainer = "List", + @Operation( + summary = "Get extension repo artifacts", + description = "Gets the artifacts in the extension repository in the given bucket and group. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoArtifact.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoArtifacts( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group id") - final String groupId + @Parameter(description = "The group id") final String groupId ) { final SortedSet repoArtifacts = serviceFacade.getExtensionRepoArtifacts(getBaseUri(), bucketName, groupId); return Response.status(Response.Status.OK).entity(repoArtifacts).build(); @@ -159,33 +159,33 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo versions", - notes = "Gets the versions in the extension repository for the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT, - response = ExtensionRepoVersionSummary.class, - responseContainer = "List", + @Operation( + summary = "Get extension repo versions", + description = "Gets the versions in the extension repository for the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoVersionSummary.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getExtensionRepoVersions( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId + @Parameter(description = "The artifact identifier") final String artifactId ) { final SortedSet repoVersions = serviceFacade.getExtensionRepoVersions( getBaseUri(), bucketName, groupId, artifactId); @@ -196,35 +196,36 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo version", - notes = "Gets information about the version in the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT, - response = ExtensionRepoVersion.class, + @Operation( + summary = "Get extension repo version", + description = "Gets information about the version in the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ExtensionRepoVersion.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersion( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version + @Parameter(description = "The version") final String version ) { final ExtensionRepoVersion repoVersion = serviceFacade.getExtensionRepoVersion( getBaseUri(), bucketName, groupId, artifactId, version); @@ -235,36 +236,36 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}/extensions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo extensions", - notes = "Gets information about the extensions in the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - response = ExtensionMetadata.class, - responseContainer = "List", + @Operation( + summary = "Get extension repo extensions", + description = "Gets information about the extensions in the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionMetadata.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersionExtensions( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version + @Parameter(description = "The version") final String version ) { final List extensionRepoExtensions = @@ -278,39 +279,39 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}/extensions/{name}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension repo extension", - notes = "Gets information about the extension with the given name in " + + @Operation( + summary = "Get extension repo extension", + description = "Gets information about the extension with the given name in " + "the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - response = org.apache.nifi.extension.manifest.Extension.class, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = org.apache.nifi.extension.manifest.Extension.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersionExtension( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version, + @Parameter(description = "The version") final String version, @PathParam("name") - @ApiParam("The fully qualified name of the extension") - final String name + @Parameter(description = "The fully qualified name of the extension") final String name ) { final org.apache.nifi.extension.manifest.Extension extension = serviceFacade.getExtensionRepoExtension( @@ -322,39 +323,38 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}/extensions/{name}/docs") @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_HTML) - @ApiOperation( - value = "Get extension repo extension docs", - notes = "Gets the documentation for the extension with the given name in " + + @Operation( + summary = "Get extension repo extension docs", + description = "Gets the documentation for the extension with the given name in " + "the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - response = String.class, extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersionExtensionDocs( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version, + @Parameter(description = "The version") final String version, @PathParam("name") - @ApiParam("The fully qualified name of the extension") - final String name + @Parameter(description = "The fully qualified name of the extension") final String name ) { final StreamingOutput streamingOutput = serviceFacade.getExtensionRepoExtensionDocs( getBaseUri(), bucketName, groupId, artifactId, version, name); @@ -365,39 +365,38 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}/extensions/{name}/docs/additional-details") @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_HTML) - @ApiOperation( - value = "Get extension repo extension details", - notes = "Gets the additional details documentation for the extension with the given name in " + + @Operation( + summary = "Get extension repo extension details", + description = "Gets the additional details documentation for the extension with the given name in " + "the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - response = String.class, extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersionExtensionAdditionalDetailsDocs( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version, + @Parameter(description = "The version") final String version, @PathParam("name") - @ApiParam("The fully qualified name of the extension") - final String name + @Parameter(description = "The fully qualified name of the extension") final String name ) { final StreamingOutput streamingOutput = serviceFacade.getExtensionRepoExtensionAdditionalDocs( getBaseUri(), bucketName, groupId, artifactId, version, name); @@ -408,44 +407,45 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}/content") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_OCTET_STREAM) - @ApiOperation( - value = "Get extension repo version content", - notes = "Gets the binary content of the bundle with the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - response = byte[].class, + @Operation( + summary = "Get extension repo version content", + description = "Gets the binary content of the bundle with the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersionContent( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version + @Parameter(description = "The version") final String version ) { final StreamingContent streamingContent = serviceFacade.getExtensionRepoVersionContent( - bucketName, groupId, artifactId, version); + bucketName, groupId, artifactId, version); final String filename = streamingContent.getFilename(); final StreamingOutput streamingOutput = streamingContent.getOutput(); return Response.ok(streamingOutput) - .header(CONTENT_DISPOSITION_HEADER,"attachment; filename = " + filename) + .header(CONTENT_DISPOSITION_HEADER, "attachment; filename = " + filename) .build(); } @@ -453,36 +453,36 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{bucketName}/{groupId}/{artifactId}/{version}/sha256") @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) - @ApiOperation( - value = "Get extension repo version checksum", - notes = "Gets the hex representation of the SHA-256 digest for the binary content of the bundle " + + @Operation( + summary = "Get extension repo version checksum", + description = "Gets the hex representation of the SHA-256 digest for the binary content of the bundle " + "with the given bucket, group, artifact, and version." + NON_GUARANTEED_ENDPOINT, - response = String.class, extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionRepoVersionSha256( @PathParam("bucketName") - @ApiParam("The bucket name") - final String bucketName, + @Parameter(description = "The bucket name") final String bucketName, @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version + @Parameter(description = "The version") final String version ) { final String sha256Hex = serviceFacade.getExtensionRepoVersionSha256(bucketName, groupId, artifactId, version); return Response.ok(sha256Hex, MediaType.TEXT_PLAIN).build(); @@ -492,29 +492,28 @@ public class ExtensionRepoResource extends ApplicationResource { @Path("{groupId}/{artifactId}/{version}/sha256") @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) - @ApiOperation( - value = "Get global extension repo version checksum", - notes = "Gets the hex representation of the SHA-256 digest for the binary content with the given bucket, group, artifact, and version. " + + @Operation( + summary = "Get global extension repo version checksum", + description = "Gets the hex representation of the SHA-256 digest for the binary content with the given bucket, group, artifact, and version. " + "Since the same group-artifact-version can exist in multiple buckets, this will return the checksum of the first one returned. " + - "This will be consistent since the checksum must be the same when existing in multiple buckets. " + NON_GUARANTEED_ENDPOINT, - response = String.class + "This will be consistent since the checksum must be the same when existing in multiple buckets. " + NON_GUARANTEED_ENDPOINT + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getGlobalExtensionRepoVersionSha256( @PathParam("groupId") - @ApiParam("The group identifier") - final String groupId, + @Parameter(description = "The group identifier") final String groupId, @PathParam("artifactId") - @ApiParam("The artifact identifier") - final String artifactId, + @Parameter(description = "The artifact identifier") final String artifactId, @PathParam("version") - @ApiParam("The version") - final String version + @Parameter(description = "The version") final String version ) { // Since we are using the filter params which are optional in the service layer, we need to validate these path params here diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java index 9795166711..a984a7c316 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java @@ -16,17 +16,18 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Collections; import java.util.Set; import java.util.SortedSet; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @@ -42,20 +43,12 @@ import org.apache.nifi.extension.manifest.ExtensionType; import org.apache.nifi.extension.manifest.ProvidedServiceAPI; import org.apache.nifi.registry.event.EventService; import org.apache.nifi.registry.extension.bundle.BundleType; -import org.apache.nifi.registry.extension.bundle.BundleTypeValues; import org.apache.nifi.registry.web.service.ServiceFacade; import org.springframework.stereotype.Component; @Component @Path("/extensions") -@Api( - value = "extensions", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Find and retrieve extensions.") -}) +@Tag(name = "Extensions") public class ExtensionResource extends ApplicationResource { public ExtensionResource(final ServiceFacade serviceFacade, final EventService eventService) { @@ -65,30 +58,29 @@ public class ExtensionResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get all extensions", - notes = "Gets the metadata for all extensions that match the filter params and are part of bundles located in buckets the " + + @Operation( + summary = "Get all extensions", + description = "Gets the metadata for all extensions that match the filter params and are part of bundles located in buckets the " + "current user is authorized for. If the user is not authorized to any buckets, an empty result set will be returned." + NON_GUARANTEED_ENDPOINT, - response = ExtensionMetadataContainer.class + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ExtensionMetadataContainer.class))) + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensions( @QueryParam("bundleType") - @ApiParam(value = "The type of bundles to return", allowableValues = BundleTypeValues.ALL_VALUES) - final BundleType bundleType, + @Parameter(description = "The type of bundles to return") final BundleType bundleType, @QueryParam("extensionType") - @ApiParam(value = "The type of extensions to return") - final ExtensionType extensionType, + @Parameter(description = "The type of extensions to return") final ExtensionType extensionType, @QueryParam("tag") - @ApiParam(value = "The tags to filter on, will be used in an OR statement") - final Set tags - ) { + @Parameter(description = "The tags to filter on, will be used in an OR statement") final Set tags + ) { final ExtensionFilterParams filterParams = new ExtensionFilterParams.Builder() .bundleType(bundleType) @@ -110,32 +102,31 @@ public class ExtensionResource extends ApplicationResource { @Path("provided-service-api") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extensions providing service API", - notes = "Gets the metadata for extensions that provide the specified API and are part of bundles located in buckets the " + + @Operation( + summary = "Get extensions providing service API", + description = "Gets the metadata for extensions that provide the specified API and are part of bundles located in buckets the " + "current user is authorized for. If the user is not authorized to any buckets, an empty result set will be returned." + NON_GUARANTEED_ENDPOINT, - response = ExtensionMetadataContainer.class + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ExtensionMetadataContainer.class))) + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getExtensionsProvidingServiceAPI( @QueryParam("className") - @ApiParam(value = "The name of the service API class", required = true) - final String className, + @Parameter(description = "The name of the service API class", required = true) final String className, @QueryParam("groupId") - @ApiParam(value = "The groupId of the bundle containing the service API class", required = true) - final String groupId, + @Parameter(description = "The groupId of the bundle containing the service API class", required = true) final String groupId, @QueryParam("artifactId") - @ApiParam(value = "The artifactId of the bundle containing the service API class", required = true) - final String artifactId, + @Parameter(description = "The artifactId of the bundle containing the service API class", required = true) final String artifactId, @QueryParam("version") - @ApiParam(value = "The version of the bundle containing the service API class", required = true) - final String version + @Parameter(description = "The version of the bundle containing the service API class", required = true) final String version ) { final ProvidedServiceAPI serviceAPI = new ProvidedServiceAPI(); serviceAPI.setClassName(className); @@ -156,19 +147,21 @@ public class ExtensionResource extends ApplicationResource { @Path("/tags") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get extension tags", - notes = "Gets all the extension tags known to this NiFi Registry instance, along with the " + + @Operation( + summary = "Get extension tags", + description = "Gets all the extension tags known to this NiFi Registry instance, along with the " + "number of extensions that have the given tag." + NON_GUARANTEED_ENDPOINT, - response = TagCount.class, - responseContainer = "List" + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = TagCount.class)))) + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getTags() { final SortedSet tags = serviceFacade.getExtensionTags(); return Response.status(Response.Status.OK).entity(tags).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java index 1beaab7611..3eea6ecc5a 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java @@ -16,18 +16,19 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.Set; import java.util.SortedSet; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @@ -46,14 +47,7 @@ import org.springframework.stereotype.Component; @Component @Path("/flows") -@Api( - value = "flows", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for accessing metadata about flows.") -}) +@Tag(name = "Flows") public class FlowResource extends ApplicationResource { @Autowired @@ -65,10 +59,10 @@ public class FlowResource extends ApplicationResource { @Path("fields") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get flow fields", - notes = "Retrieves the flow field names that can be used for searching or sorting on flows.", - response = Fields.class + @Operation( + summary = "Get flow fields", + description = "Retrieves the flow field names that can be used for searching or sorting on flows.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Fields.class))) ) public Response getAvailableFlowFields() { final Set flowFields = serviceFacade.getFlowFields(); @@ -80,27 +74,30 @@ public class FlowResource extends ApplicationResource { @Path("{flowId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get flow", - notes = "Gets a flow by id.", - nickname = "globalGetFlow", - response = VersionedFlow.class, + @Operation( + summary = "Get flow", + description = "Gets a flow by id.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlow( @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final VersionedFlow flow = serviceFacade.getFlow(flowId); return Response.status(Response.Status.OK).entity(flow).build(); @@ -110,27 +107,29 @@ public class FlowResource extends ApplicationResource { @Path("{flowId}/versions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get flow versions", - notes = "Gets summary information for all versions of a given flow. Versions are ordered newest->oldest.", - nickname = "globalGetFlowVersions", - response = VersionedFlowSnapshotMetadata.class, - responseContainer = "List", + @Operation( + summary = "Get flow versions", + description = "Gets summary information for all versions of a given flow. Versions are ordered newest->oldest.", + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlowVersions( @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final SortedSet snapshots = serviceFacade.getFlowSnapshots(flowId); return Response.status(Response.Status.OK).entity(snapshots).build(); @@ -140,30 +139,32 @@ public class FlowResource extends ApplicationResource { @Path("{flowId}/versions/{versionNumber: \\d+}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get flow version", - notes = "Gets the given version of a flow, including metadata and flow content.", - nickname = "globalGetFlowVersion", - response = VersionedFlowSnapshot.class, + @Operation( + summary = "Get flow version", + description = "Gets the given version of a flow, including metadata and flow content.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getFlowVersion( @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId, + @Parameter(description = "The flow identifier") final String flowId, @PathParam("versionNumber") - @ApiParam("The version number") - final Integer versionNumber) { + @Parameter(description = "The version number") final Integer versionNumber) { final VersionedFlowSnapshot snapshot = serviceFacade.getFlowSnapshot(flowId, versionNumber); return Response.status(Response.Status.OK).entity(snapshot).build(); @@ -173,26 +174,29 @@ public class FlowResource extends ApplicationResource { @Path("{flowId}/versions/latest") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get latest flow version", - notes = "Gets the latest version of a flow, including metadata and flow content.", - nickname = "globalGetLatestFlowVersion", - response = VersionedFlowSnapshot.class, + @Operation( + summary = "Get latest flow version", + description = "Gets the latest version of a flow, including metadata and flow content.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getLatestFlowVersion( @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final VersionedFlowSnapshot lastSnapshot = serviceFacade.getLatestFlowSnapshot(flowId); return Response.status(Response.Status.OK).entity(lastSnapshot).build(); @@ -202,29 +206,31 @@ public class FlowResource extends ApplicationResource { @Path("{flowId}/versions/latest/metadata") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get latest flow version metadata", - notes = "Gets the metadata for the latest version of a flow.", - nickname = "globalGetLatestFlowVersionMetadata", - response = VersionedFlowSnapshotMetadata.class, + @Operation( + summary = "Get latest flow version metadata", + description = "Gets the metadata for the latest version of a flow.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getLatestFlowVersionMetadata( @PathParam("flowId") - @ApiParam("The flow identifier") - final String flowId) { + @Parameter(description = "The flow identifier") final String flowId) { final VersionedFlowSnapshotMetadata latestMetadata = serviceFacade.getLatestFlowSnapshotMetadata(flowId); return Response.status(Response.Status.OK).entity(latestMetadata).build(); } - } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java index d4046a4b89..b60ab3b4e5 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java @@ -16,18 +16,19 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.util.List; import java.util.Set; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @@ -46,14 +47,7 @@ import org.springframework.stereotype.Component; @Component @Path("/items") -@Api( - value = "items", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Retrieve items across all buckets for which the user is authorized.") -}) +@Tag(name = "Items") public class ItemResource extends ApplicationResource { @Context @@ -68,14 +62,13 @@ public class ItemResource extends ApplicationResource { @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get all items", - notes = "Get items across all buckets. The returned items will include only items from buckets for which the user is authorized. " + + @Operation( + summary = "Get all items", + description = "Get items across all buckets. The returned items will include only items from buckets for which the user is authorized. " + "If the user is not authorized to any buckets, an empty list will be returned.", - response = BucketItem.class, - responseContainer = "List" + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BucketItem.class)))) ) - @ApiResponses({ @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401) }) + @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getItems() { // Service facade with return only items from authorized buckets // Note: We don't explicitly check for access to (READ, /buckets) or @@ -93,27 +86,29 @@ public class ItemResource extends ApplicationResource { @Path("{bucketId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get bucket items", - notes = "Gets the items located in the given bucket.", - response = BucketItem.class, - responseContainer = "List", - nickname = "getItemsInBucket", + @Operation( + summary = "Get bucket items", + description = "Gets the items located in the given bucket.", + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BucketItem.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") }) + @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404) }) public Response getItems( @PathParam("bucketId") - @ApiParam("The bucket identifier") - final String bucketId) { + @Parameter(description = "The bucket identifier") final String bucketId) { final List items = serviceFacade.getBucketItems(bucketId); return Response.status(Response.Status.OK).entity(items).build(); @@ -123,10 +118,10 @@ public class ItemResource extends ApplicationResource { @Path("fields") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get item fields", - notes = "Retrieves the item field names for searching or sorting on bucket items.", - response = Fields.class + @Operation( + summary = "Get item fields", + description = "Retrieves the item field names for searching or sorting on bucket items.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Fields.class))) ) public Response getAvailableBucketItemFields() { final Set bucketFields = serviceFacade.getBucketItemFields(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/RegistryAboutResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/RegistryAboutResource.java index b7841b5196..43a6eff091 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/RegistryAboutResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/RegistryAboutResource.java @@ -16,11 +16,11 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; @@ -34,14 +34,7 @@ import org.springframework.stereotype.Component; @Component @Path("/about") -@Api( - value = "about", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Retrieves the version information for this NiFi Registry.") -}) +@Tag(name = "About") public class RegistryAboutResource extends ApplicationResource { @Autowired @@ -53,10 +46,10 @@ public class RegistryAboutResource extends ApplicationResource { @GET @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Get version", - notes = "Gets the NiFi Registry version.", - response = RegistryAbout.class + @Operation( + summary = "Get version", + description = "Gets the NiFi Registry version.", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RegistryAbout.class))) ) public Response getVersion() { final String implVersion = RegistryAbout.class.getPackage().getImplementationVersion(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java index 5140495a90..935ef6c680 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java @@ -16,18 +16,19 @@ */ package org.apache.nifi.registry.web.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import java.net.URI; import java.util.List; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -59,14 +60,7 @@ import org.springframework.stereotype.Component; */ @Component @Path("tenants") -@Api( - value = "tenants", - authorizations = {@Authorization("Authorization")}, - tags = {"Swagger Resource"} -) -@SwaggerDefinition(tags = { - @Tag(name = "Swagger Resource", description = "Endpoint for managing users and user groups.") -}) +@Tag(name = "Tenants") public class TenantResource extends ApplicationResource { @Autowired @@ -89,27 +83,29 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("users") - @ApiOperation( - value = "Create user", - notes = NON_GUARANTEED_ENDPOINT, - response = User.class, + @Operation( + summary = "Create user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response createUser( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The user configuration details.", required = true) - final User requestUser) { + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The user configuration details.", required = true) final User requestUser) { final User createdUser = serviceFacade.createUser(requestUser); publish(EventFactory.userCreated(createdUser)); @@ -127,22 +123,25 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("users") - @ApiOperation( - value = "Get all users", - notes = NON_GUARANTEED_ENDPOINT, - response = User.class, - responseContainer = "List", + @Operation( + summary = "Get all users", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = User.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getUsers() { // get all the users final List users = serviceFacade.getUsers(); @@ -161,24 +160,28 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("users/{id}") - @ApiOperation( - value = "Get user", - notes = NON_GUARANTEED_ENDPOINT, - response = User.class, + @Operation( + summary = "Get user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getUser( - @ApiParam(value = "The user id.", required = true) + @Parameter(description = "The user id.", required = true) @PathParam("id") final String identifier) { final User user = serviceFacade.getUser(identifier); return generateOkResponse(user).build(); @@ -196,30 +199,32 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("users/{id}") - @ApiOperation( - value = "Update user", - notes = NON_GUARANTEED_ENDPOINT, - response = User.class, + @Operation( + summary = "Update user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response updateUser( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The user id.", required = true) - @PathParam("id") - final String identifier, - @ApiParam(value = "The user configuration details.", required = true) - final User requestUser) { + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The user id.", required = true) + @PathParam("id") final String identifier, + @Parameter(description = "The user configuration details.", required = true) final User requestUser) { if (requestUser == null) { throw new IllegalArgumentException("User details must be specified when updating a user."); @@ -238,42 +243,43 @@ public class TenantResource extends ApplicationResource { * Removes the specified user. * * @param httpServletRequest request - * @param identifier The id of the user to remove. + * @param identifier The id of the user to remove. * @return A entity containing the client id and an updated revision. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("users/{id}") - @ApiOperation( - value = "Delete user", - notes = NON_GUARANTEED_ENDPOINT, - response = User.class, + @Operation( + summary = "Delete user", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "delete"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response removeUser( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true) - @QueryParam(VERSION) - final LongParameter version, - @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) + @QueryParam(VERSION) final LongParameter version, + @Parameter(description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") @QueryParam(CLIENT_ID) - @DefaultValue(StringUtils.EMPTY) - final ClientIdParameter clientId, - @ApiParam(value = "The user id.", required = true) - @PathParam("id") - final String identifier) { + @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, + @Parameter(description = "The user id.", required = true) + @PathParam("id") final String identifier) { final RevisionInfo revisionInfo = getRevisionInfo(version, clientId); final User user = serviceFacade.deleteUser(identifier, revisionInfo); @@ -295,27 +301,30 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups") - @ApiOperation( - value = "Create user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroup.class, + @Operation( + summary = "Create user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response createUserGroup( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The user group configuration details.", required = true) - final UserGroup requestUserGroup) { + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The user group configuration details.", required = true) final UserGroup requestUserGroup) { final UserGroup createdGroup = serviceFacade.createUserGroup(requestUserGroup); publish(EventFactory.userGroupCreated(createdGroup)); @@ -333,23 +342,26 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups") - @ApiOperation( - value = "Get user groups", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroup.class, - responseContainer = "List", + @Operation( + summary = "Get user groups", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserGroup.class)))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + ) public Response getUserGroups() { final List userGroups = serviceFacade.getUserGroups(); return generateOkResponse(userGroups).build(); @@ -365,24 +377,29 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups/{id}") - @ApiOperation( - value = "Get user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroup.class, + @Operation( + summary = "Get user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "read"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getUserGroup( - @ApiParam(value = "The user group id.", required = true) + @Parameter(description = "The user group id.", required = true) @PathParam("id") final String identifier) { final UserGroup userGroup = serviceFacade.getUserGroup(identifier); return generateOkResponse(userGroup).build(); @@ -400,30 +417,32 @@ public class TenantResource extends ApplicationResource { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups/{id}") - @ApiOperation( - value = "Update user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroup.class, + @Operation( + summary = "Update user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "write"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response updateUserGroup( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The user group id.", required = true) - @PathParam("id") - final String identifier, - @ApiParam(value = "The user group configuration details.", required = true) - final UserGroup requestUserGroup) { + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The user group id.", required = true) + @PathParam("id") final String identifier, + @Parameter(description = "The user group configuration details.", required = true) final UserGroup requestUserGroup) { if (requestUserGroup == null) { throw new IllegalArgumentException("User group details must be specified to update a user group."); @@ -442,42 +461,43 @@ public class TenantResource extends ApplicationResource { * Removes the specified user group. * * @param httpServletRequest request - * @param identifier The id of the user group to remove. + * @param identifier The id of the user group to remove. * @return The deleted user group. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("user-groups/{id}") - @ApiOperation( - value = "Delete user group", - notes = NON_GUARANTEED_ENDPOINT, - response = UserGroup.class, + @Operation( + summary = "Delete user group", + description = NON_GUARANTEED_ENDPOINT, + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), extensions = { - @Extension(name = "access-policy", properties = { + @Extension( + name = "access-policy", properties = { @ExtensionProperty(name = "action", value = "delete"), - @ExtensionProperty(name = "resource", value = "/tenants") }) + @ExtensionProperty(name = "resource", value = "/tenants")} + ) + } + ) + @ApiResponses( + { + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) } ) - @ApiResponses({ - @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), - @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), - @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), - @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), - @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response removeUserGroup( - @Context - final HttpServletRequest httpServletRequest, - @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true) - @QueryParam(VERSION) - final LongParameter version, - @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") + @Context final HttpServletRequest httpServletRequest, + @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) + @QueryParam(VERSION) final LongParameter version, + @Parameter(description = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.") @QueryParam(CLIENT_ID) - @DefaultValue(StringUtils.EMPTY) - final ClientIdParameter clientId, - @ApiParam(value = "The user group id.", required = true) - @PathParam("id") - final String identifier) { + @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, + @Parameter(description = "The user group id.", required = true) + @PathParam("id") final String identifier) { final RevisionInfo revisionInfo = getRevisionInfo(version, clientId); final UserGroup userGroup = serviceFacade.deleteUserGroup(identifier, revisionInfo); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/service/ExportedVersionedFlowSnapshot.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/service/ExportedVersionedFlowSnapshot.java index 8f567422cb..a8382efa4b 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/service/ExportedVersionedFlowSnapshot.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/service/ExportedVersionedFlowSnapshot.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.registry.web.service; -import io.swagger.annotations.ApiModel; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; @@ -31,7 +30,6 @@ import org.apache.nifi.registry.flow.VersionedFlowSnapshot; * * @see VersionedFlowSnapshot */ -@ApiModel public class ExportedVersionedFlowSnapshot { @Valid diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/openapi/openapi.yaml b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/openapi/openapi.yaml index d82acbcc7e..a82884e70c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/openapi/openapi.yaml +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/openapi/openapi.yaml @@ -20,6 +20,7 @@ openAPI: description: REST API definition for Apache NiFi Registry web services contact: email: dev@nifi.apache.org + url: https://nifi.apache.org license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html diff --git a/nifi-toolkit/nifi-toolkit-api/pom.xml b/nifi-toolkit/nifi-toolkit-api/pom.xml index 1d3b0b86ea..3847b3b103 100644 --- a/nifi-toolkit/nifi-toolkit-api/pom.xml +++ b/nifi-toolkit/nifi-toolkit-api/pom.xml @@ -21,7 +21,6 @@ language governing permissions and limitations under the License. --> nifi-toolkit-api - org.apache.nifi nifi-web-api @@ -29,15 +28,9 @@ language governing permissions and limitations under the License. --> war - - - io.swagger - swagger-annotations - io.swagger.core.v3 swagger-annotations - 2.2.9 org.glassfish.jersey.core @@ -63,10 +56,6 @@ language governing permissions and limitations under the License. --> com.fasterxml.jackson.datatype jackson-datatype-jsr310 - - javax.annotation - javax.annotation-api - @@ -74,14 +63,14 @@ language governing permissions and limitations under the License. --> io.swagger.codegen.v3 swagger-codegen-maven-plugin - 3.0.50 + package generate - ${project.parent.parent.basedir}/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/target/swagger/swagger.json + ${project.parent.parent.basedir}/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/target/nifi-web-api-${project.version}/docs/rest-api/swagger.json java false false diff --git a/pom.xml b/pom.xml index afc1d682db..5d73af259d 100644 --- a/pom.xml +++ b/pom.xml @@ -153,7 +153,7 @@ 6.0.0 6.0.15 6.2.0 - 1.6.12 + 2.2.20 2.2.224 3.9.1 3.1.8 @@ -565,7 +565,7 @@ ${json.smart.version} - io.swagger + io.swagger.core.v3 swagger-annotations ${swagger.annotations.version} @@ -930,6 +930,16 @@ jacoco-maven-plugin 0.8.11 + + io.swagger.core.v3 + swagger-maven-plugin-jakarta + 2.2.20 + + + io.swagger.codegen.v3 + swagger-codegen-maven-plugin + 3.0.52 +