lordgamez commented on code in PR #1875: URL: https://github.com/apache/nifi-minifi-cpp/pull/1875#discussion_r1853752810
########## extensions/couchbase/processors/PutCouchbaseKey.h: ########## @@ -0,0 +1,161 @@ +/** + * + * 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. + */ +#pragma once + +#include <memory> +#include <string> +#include <utility> + +#include "core/AbstractProcessor.h" +#include "core/ProcessSession.h" +#include "utils/Enum.h" +#include "core/logging/LoggerConfiguration.h" +#include "CouchbaseClusterService.h" +#include "couchbase/persist_to.hxx" +#include "couchbase/replicate_to.hxx" + +namespace magic_enum::customize { + +template <> +constexpr customize_t enum_name<::couchbase::persist_to>(::couchbase::persist_to value) noexcept { + switch (value) { + case ::couchbase::persist_to::none: + return "NONE"; + case ::couchbase::persist_to::active: + return "ACTIVE"; + case ::couchbase::persist_to::one: + return "ONE"; + case ::couchbase::persist_to::two: + return "TWO"; + case ::couchbase::persist_to::three: + return "THREE"; + case ::couchbase::persist_to::four: + return "FOUR"; + } + return invalid_tag; +} + +template <> +constexpr customize_t enum_name<::couchbase::replicate_to>(::couchbase::replicate_to value) noexcept { + switch (value) { + case ::couchbase::replicate_to::none: + return "NONE"; + case ::couchbase::replicate_to::one: + return "ONE"; + case ::couchbase::replicate_to::two: + return "TWO"; + case ::couchbase::replicate_to::three: + return "THREE"; + } + return invalid_tag; +} +} // namespace magic_enum::customize + +namespace org::apache::nifi::minifi::couchbase::processors { + +class PutCouchbaseKey final : public core::AbstractProcessor<PutCouchbaseKey> { + public: + using core::AbstractProcessor<PutCouchbaseKey>::AbstractProcessor; + + EXTENSIONAPI static constexpr const char* Description = "Put a document to Couchbase Server via Key/Value access."; + + EXTENSIONAPI static constexpr auto CouchbaseClusterControllerService = core::PropertyDefinitionBuilder<>::createProperty("Couchbase Cluster Controller Service") + .withDescription("A Couchbase Cluster Controller Service which manages connections to a Couchbase cluster.") + .withAllowedTypes<controllers::CouchbaseClusterService>() + .isRequired(true) + .build(); + EXTENSIONAPI static constexpr auto BucketName = core::PropertyDefinitionBuilder<>::createProperty("Bucket Name") + .withDescription("The name of bucket to access.") + .withDefaultValue("default") + .isRequired(true) + .supportsExpressionLanguage(true) + .build(); + EXTENSIONAPI static constexpr auto ScopeName = core::PropertyDefinitionBuilder<>::createProperty("Scope Name") + .withDescription("Scope to use inside the bucket. If not specified, the _default scope is used.") + .supportsExpressionLanguage(true) + .build(); + EXTENSIONAPI static constexpr auto CollectionName = core::PropertyDefinitionBuilder<>::createProperty("Collection Name") + .withDescription("Collection to use inside the bucket scope. If not specified, the _default collection is used.") + .supportsExpressionLanguage(true) + .build(); + EXTENSIONAPI static constexpr auto DocumentType = core::PropertyDefinitionBuilder<3>::createProperty("Document Type") Review Comment: Updated in https://github.com/apache/nifi-minifi-cpp/pull/1875/commits/e99afe0d8127c14de5379fbd0f5ee8da7f2ace9c -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
