Skip to content

Commit

Permalink
MINIFICPP-2441: Refactored Creating Properties via to_array to Auto D…
Browse files Browse the repository at this point in the history
…etermine Number of Properties

Closes #1859

Signed-off-by: Martin Zink <[email protected]>
  • Loading branch information
james94 authored and martinzink committed Aug 21, 2024
1 parent 1e19967 commit 76c33cb
Show file tree
Hide file tree
Showing 120 changed files with 234 additions and 231 deletions.
4 changes: 2 additions & 2 deletions extensions/aws/controllerservices/AWSCredentialsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ class AWSCredentialsService : public core::controller::ControllerService {
EXTENSIONAPI static constexpr auto CredentialsFile = core::PropertyDefinitionBuilder<>::createProperty("Credentials File")
.withDescription("Path to a file containing AWS access key and secret key in properties file format. Properties used: accessKey and secretKey")
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 4>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
UseDefaultCredentials,
AccessKey,
SecretKey,
CredentialsFile
};
});


EXTENSIONAPI static constexpr bool SupportsDynamicProperties = false;
Expand Down
4 changes: 2 additions & 2 deletions extensions/aws/processors/DeleteS3Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class DeleteS3Object : public S3Processor {
.withDescription("The Version of the Object to delete")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::array<core::PropertyReference, 2>{
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::to_array<core::PropertyReference>({
ObjectKey,
Version
});
}));


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "FlowFiles are routed to success relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/aws/processors/FetchS3Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class FetchS3Object : public S3Processor {
.withDescription("If true, indicates that the requester consents to pay any charges associated with retrieving "
"objects from the S3 bucket. This sets the 'x-amz-request-payer' header to 'requester'.")
.build();
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::array<core::PropertyReference, 3>{
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::to_array<core::PropertyReference>({
ObjectKey,
Version,
RequesterPays
});
}));


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "FlowFiles are routed to success relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/aws/processors/ListS3.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ class ListS3 : public S3Processor {
.withDescription("If true, indicates that the requester consents to pay any charges associated with listing the S3 bucket. This sets the 'x-amz-request-payer' header to 'requester'. "
"Note that this setting is only used if Write User Metadata is true.")
.build();
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::array<core::PropertyReference, 7>{
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::to_array<core::PropertyReference>({
Delimiter,
Prefix,
UseVersions,
MinimumObjectAge,
WriteObjectTags,
WriteUserMetadata,
RequesterPays
});
}));


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "FlowFiles are routed to success relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/aws/processors/PutS3Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class PutS3Object : public S3Processor {
.withDefaultValue("7 days")
.isRequired(true)
.build();
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::array<core::PropertyReference, 14>{
EXTENSIONAPI static constexpr auto Properties = minifi::utils::array_cat(S3Processor::Properties, std::to_array<core::PropertyReference>({
ObjectKey,
ContentType,
StorageClass,
Expand All @@ -153,7 +153,7 @@ class PutS3Object : public S3Processor {
MultipartPartSize,
MultipartUploadAgeOffInterval,
MultipartUploadMaxAgeThreshold
});
}));


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "FlowFiles are routed to success relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/aws/processors/S3Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class S3Processor : public core::Processor {
.withDefaultValue("false")
.isRequired(true)
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 13>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
Bucket,
AccessKey,
SecretKey,
Expand All @@ -172,7 +172,7 @@ class S3Processor : public core::Processor {
ProxyUsername,
ProxyPassword,
UseDefaultCredentials
};
});


explicit S3Processor(std::string_view name, const minifi::utils::Identifier& uuid, std::shared_ptr<core::logging::Logger> logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ class AzureStorageCredentialsService : public core::controller::ControllerServic
.withPropertyType(core::StandardPropertyTypes::BOOLEAN_TYPE)
.withDefaultValue("false")
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 6>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
StorageAccountName,
StorageAccountKey,
SASToken,
CommonStorageAccountEndpointSuffix,
ConnectionString,
UseManagedIdentityCredentials
};
});


EXTENSIONAPI static constexpr bool SupportsDynamicProperties = false;
Expand Down
4 changes: 2 additions & 2 deletions extensions/azure/processors/AzureBlobStorageProcessorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ class AzureBlobStorageProcessorBase : public AzureStorageProcessorBase {
.withPropertyType(core::StandardPropertyTypes::BOOLEAN_TYPE)
.withDefaultValue("false")
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureStorageProcessorBase::Properties, std::array<core::PropertyReference, 7>{
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureStorageProcessorBase::Properties, std::to_array<core::PropertyReference>({
ContainerName,
StorageAccountName,
StorageAccountKey,
SASToken,
CommonStorageAccountEndpointSuffix,
ConnectionString,
UseManagedIdentityCredentials
});
}));


void onSchedule(core::ProcessContext& context, core::ProcessSessionFactory& session_factory) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AzureBlobStorageSingleBlobProcessorBase : public AzureBlobStorageProcessor
.withDescription("The filename of the blob. If left empty the filename attribute will be used by default.")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageProcessorBase::Properties, std::array<core::PropertyReference, 1>{Blob});
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageProcessorBase::Properties, std::to_array<core::PropertyReference>({Blob}));

protected:
explicit AzureBlobStorageSingleBlobProcessorBase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AzureDataLakeStorageFileProcessorBase : public AzureDataLakeStorageProcess
.withDescription("The filename in Azure Storage. If left empty the filename attribute will be used by default.")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageProcessorBase::Properties, std::array<core::PropertyReference, 1>{FileName});
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageProcessorBase::Properties, std::to_array<core::PropertyReference>({FileName}));

explicit AzureDataLakeStorageFileProcessorBase(std::string_view name, const minifi::utils::Identifier& uuid, const std::shared_ptr<core::logging::Logger> &logger)
: AzureDataLakeStorageProcessorBase(name, uuid, logger) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class AzureDataLakeStorageProcessorBase : public AzureStorageProcessorBase {
"If left empty it designates the root directory. The directory will be created if not already existing.")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureStorageProcessorBase::Properties, std::array<core::PropertyReference, 2>{
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureStorageProcessorBase::Properties, std::to_array<core::PropertyReference>({
FilesystemName,
DirectoryName
});
}));


explicit AzureDataLakeStorageProcessorBase(std::string_view name, const minifi::utils::Identifier& uuid, const std::shared_ptr<core::logging::Logger> &logger)
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure/processors/AzureStorageProcessorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AzureStorageProcessorBase : public core::Processor {
EXTENSIONAPI static constexpr auto AzureStorageCredentialsService = core::PropertyDefinitionBuilder<>::createProperty("Azure Storage Credentials Service")
.withDescription("Name of the Azure Storage Credentials Service used to retrieve the connection string from.")
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 1>{AzureStorageCredentialsService};
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({AzureStorageCredentialsService});

AzureStorageProcessorBase(std::string_view name, const minifi::utils::Identifier& uuid, const std::shared_ptr<core::logging::Logger>& logger)
: core::Processor(name, uuid),
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure/processors/DeleteAzureBlobStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DeleteAzureBlobStorage final : public AzureBlobStorageSingleBlobProcessorB
.withDefaultValue(magic_enum::enum_name(storage::OptionalDeletion::NONE))
.withAllowedValues(magic_enum::enum_names<storage::OptionalDeletion>())
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageSingleBlobProcessorBase::Properties, std::array<core::PropertyReference, 1>{DeleteSnapshotsOption});
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageSingleBlobProcessorBase::Properties, std::to_array<core::PropertyReference>({DeleteSnapshotsOption}));

EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All successfully processed FlowFiles are routed to this relationship"};
EXTENSIONAPI static constexpr auto Failure = core::RelationshipDefinition{"failure", "Unsuccessful operations will be transferred to the failure relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/azure/processors/FetchAzureBlobStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class FetchAzureBlobStorage final : public AzureBlobStorageSingleBlobProcessorBa
"An empty value or a value that extends beyond the end of the blob will read to the end of the blob.")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageSingleBlobProcessorBase::Properties, std::array<core::PropertyReference, 2>{
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageSingleBlobProcessorBase::Properties, std::to_array<core::PropertyReference>({
RangeStart,
RangeLength
});
}));


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All successfully processed FlowFiles are routed to this relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/azure/processors/FetchAzureDataLakeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class FetchAzureDataLakeStorage final : public AzureDataLakeStorageFileProcessor
.withDefaultValue("0")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageFileProcessorBase::Properties, std::array<core::PropertyReference, 3>{
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageFileProcessorBase::Properties, std::to_array<core::PropertyReference>({
RangeStart,
RangeLength,
NumberOfRetries
});
}));


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "Files that have been successfully fetched from Azure storage are transferred to this relationship"};
Expand Down
4 changes: 2 additions & 2 deletions extensions/azure/processors/ListAzureBlobStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class ListAzureBlobStorage final : public AzureBlobStorageProcessorBase {
.withDescription("Search prefix for listing")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageProcessorBase::Properties, std::array<core::PropertyReference, 2>{
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageProcessorBase::Properties, std::to_array<core::PropertyReference>({
ListingStrategy,
Prefix
});
}));

EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All FlowFiles that are received are routed to success"};
EXTENSIONAPI static constexpr auto Relationships = std::array{Success};
Expand Down
4 changes: 2 additions & 2 deletions extensions/azure/processors/ListAzureDataLakeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class ListAzureDataLakeStorage final : public AzureDataLakeStorageProcessorBase
.withDefaultValue(magic_enum::enum_name(azure::EntityTracking::timestamps))
.withAllowedValues(magic_enum::enum_names<azure::EntityTracking>())
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageProcessorBase::Properties, std::array<core::PropertyReference, 4>{
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageProcessorBase::Properties, std::to_array<core::PropertyReference>({
RecurseSubdirectories,
FileFilter,
PathFilter,
ListingStrategy
});
}));

EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All FlowFiles that are received are routed to success"};
EXTENSIONAPI static constexpr auto Relationships = std::array{Success};
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure/processors/PutAzureBlobStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PutAzureBlobStorage final : public AzureBlobStorageSingleBlobProcessorBase
.withPropertyType(core::StandardPropertyTypes::BOOLEAN_TYPE)
.withDefaultValue("false")
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageSingleBlobProcessorBase::Properties, std::array<core::PropertyReference, 1>{CreateContainer});
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureBlobStorageSingleBlobProcessorBase::Properties, std::to_array<core::PropertyReference>({CreateContainer}));

EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All successfully processed FlowFiles are routed to this relationship"};
EXTENSIONAPI static constexpr auto Failure = core::RelationshipDefinition{"failure", "Unsuccessful operations will be transferred to the failure relationship"};
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure/processors/PutAzureDataLakeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PutAzureDataLakeStorage final : public AzureDataLakeStorageFileProcessorBa
.withDefaultValue(magic_enum::enum_name(azure::FileExistsResolutionStrategy::fail))
.withAllowedValues(magic_enum::enum_names<azure::FileExistsResolutionStrategy>())
.build();
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageFileProcessorBase::Properties, std::array<core::PropertyReference, 1>{ConflictResolutionStrategy});
EXTENSIONAPI static constexpr auto Properties = utils::array_cat(AzureDataLakeStorageFileProcessorBase::Properties, std::to_array<core::PropertyReference>({ConflictResolutionStrategy}));

EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "Files that have been successfully written to Azure storage are transferred to this relationship"};
EXTENSIONAPI static constexpr auto Failure = core::RelationshipDefinition{"failure", "Files that could not be written to Azure storage for some reason are transferred to this relationship"};
Expand Down
2 changes: 1 addition & 1 deletion extensions/bustache/ApplyTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ApplyTemplate : public core::Processor {
EXTENSIONAPI static constexpr core::PropertyDefinition Template = core::PropertyDefinitionBuilder<>::createProperty("Template")
.withDescription("Path to the input mustache template file")
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 1>{Template};
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({Template});

EXTENSIONAPI static constexpr core::RelationshipDefinition Success{"success", "success operational on the flow record"};
EXTENSIONAPI static constexpr auto Relationships = std::array{Success};
Expand Down
4 changes: 2 additions & 2 deletions extensions/civetweb/processors/ListenHTTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ListenHTTP : public core::Processor {
.withPropertyType(core::StandardPropertyTypes::UNSIGNED_LONG_TYPE)
.withDefaultValue(ListenHTTP::DEFAULT_BUFFER_SIZE_STR)
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 10>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
BasePath,
Port,
AuthorizedDNPattern,
Expand All @@ -123,7 +123,7 @@ class ListenHTTP : public core::Processor {
HeadersAsAttributesRegex,
BatchSize,
BufferSize
};
});


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All files are routed to success"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class ElasticsearchCredentialsControllerService : public core::controller::Contr
.withDescription("The API Key to use")
.isSensitive(true)
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 3>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
Username,
Password,
ApiKey
};
});


EXTENSIONAPI static constexpr bool SupportsDynamicProperties = false;
Expand Down
4 changes: 2 additions & 2 deletions extensions/elasticsearch/PostElasticsearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ class PostElasticsearch : public core::Processor {
"For all other Actions, the attribute must evaluate to a non-empty value.")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 7>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
Action,
MaxBatchSize,
ElasticCredentials,
SSLContext,
Hosts,
Index,
Identifier
};
});

EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All flowfiles that succeed in being transferred into Elasticsearch go here."};
EXTENSIONAPI static constexpr auto Failure = core::RelationshipDefinition{"failure", "All flowfiles that fail for reasons unrelated to server availability go to this relationship."};
Expand Down
4 changes: 2 additions & 2 deletions extensions/execute-process/ExecuteProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ class ExecuteProcess : public core::Processor {
.withPropertyType(core::StandardPropertyTypes::BOOLEAN_TYPE)
.withDefaultValue("false")
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 5>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
Command,
CommandArguments,
WorkingDir,
BatchDuration,
RedirectErrorStream
};
});


EXTENSIONAPI static constexpr auto Success = core::RelationshipDefinition{"success", "All created FlowFiles are routed to this relationship."};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DummyProcessor : public core::Processor {
.withDescription("A property which supports expression language")
.supportsExpressionLanguage(true)
.build();
static constexpr auto Properties = std::array<core::PropertyReference, 2>{SimpleProperty, ExpressionLanguageProperty};
static constexpr auto Properties = std::to_array<core::PropertyReference>({SimpleProperty, ExpressionLanguageProperty});
static constexpr auto Relationships = std::array<core::RelationshipDefinition, 0>{};
static constexpr bool SupportsDynamicProperties = true;
static constexpr bool SupportsDynamicRelationships = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#pragma once

#include <filesystem>
#include <string>
#include <memory>
Expand Down Expand Up @@ -82,11 +83,11 @@ class GCPCredentialsControllerService : public core::controller::ControllerServi
.isRequired(false)
.isSensitive(true)
.build();
EXTENSIONAPI static constexpr auto Properties = std::array<core::PropertyReference, 3>{
EXTENSIONAPI static constexpr auto Properties = std::to_array<core::PropertyReference>({
CredentialsLoc,
JsonFilePath,
JsonContents
};
});


EXTENSIONAPI static constexpr bool SupportsDynamicProperties = false;
Expand Down
Loading

0 comments on commit 76c33cb

Please sign in to comment.