You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "pvillard31 (via GitHub)" <gi...@apache.org> on 2024/11/20 19:51:40 UTC
[PR] NIFI-14029 - BitBucket Registry Client [nifi]
pvillard31 opened a new pull request, #9547:
URL: https://github.com/apache/nifi/pull/9547
# Summary
[NIFI-14029](https://issues.apache.org/jira/browse/NIFI-14029) - BitBucket Registry Client
Adding an implementation of the Registry Client to integrate with BitBucket. For reference, APIs are described here:
https://developer.atlassian.com/cloud/bitbucket/rest/intro
In addition to the implementation itself, two bugs are fixed:
- NPE in case the initialization fails for some reason. In this case, we already called `clientInitialized.set(true)` and this caused to always have the directory exclusion filter being `null`. This is now fixed.
- NPE in the `deregisterFlow` method. This happens when we start version control and for some reason, something fails after the file has been committed. In that case, we delete the content in the repo. Because we didn't populate the snapshot metadata, this was causing a NPE.
````
java.lang.NullPointerException: Cannot invoke "org.apache.nifi.registry.flow.RegisteredFlowSnapshotMetadata.setBucketIdentifier(String)" because "snapshotMetadata" is null
at org.apache.nifi.registry.flow.git.AbstractGitFlowRegistryClient.updateBucketReferences(AbstractGitFlowRegistryClient.java:548)
at org.apache.nifi.registry.flow.git.AbstractGitFlowRegistryClient.deregisterFlow(AbstractGitFlowRegistryClient.java:255)
````
Regarding the implementation itself. Three authentication methods are supported:
- Basic Auth with Username and App Password
- OAuth 2.0 - I tested the Client Credentials Flow with OAuth Consumers. Note that the endpoint to configure in the controller service for OAuth is `https://bitbucket.org/site/oauth2/access_token`. It is important to also note that, when using the Client Credentials flow, the permissions/scopes set at the OAuth Consumer level in the BitBucket Admin UI are ignored and it will inherit the permissions of the **owner** of the OAuth Consumer. This is quite misleading...
- Access Token - I have not tested this option as this is a paid option of BitBucket.
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
### Pull Request Tracking
- [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
- [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
### Pull Request Formatting
- [ ] Pull Request based on current revision of the `main` branch
- [ ] Pull Request refers to a feature branch with one commit containing changes
# Verification
Please indicate the verification steps performed prior to pull request creation.
### Build
- [ ] Build completed using `mvn clean install -P contrib-check`
- [ ] JDK 21
### Licensing
- [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
- [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
### Documentation
- [ ] Documentation formatting appears as expected in rendered files
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "mbegerau (via GitHub)" <gi...@apache.org>.
mbegerau commented on PR #9547:
URL: https://github.com/apache/nifi/pull/9547#issuecomment-2719054373
Great! No further comments from my side. I ran `mvn clean install` and tested everything from scratch and for me all registry functions are working with all three authentication types.
Let's hope it gets merged before 2.4.0 :crossed_fingers:
I'm not sure if any of the maintainers are using Bitbucket cloud or have access to it...
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "bbende (via GitHub)" <gi...@apache.org>.
bbende commented on code in PR #9547:
URL: https://github.com/apache/nifi/pull/9547#discussion_r1857204528
##########
nifi-extension-bundles/nifi-atlassian-bundle/nifi-atlassian-extensions/src/main/java/org/apache/nifi/atlassian/bitbucket/BitBucketFlowRegistryClient.java:
##########
@@ -0,0 +1,163 @@
+/*
+ * 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.atlassian.bitbucket;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.oauth2.OAuth2AccessTokenProvider;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.registry.flow.FlowRegistryClientConfigurationContext;
+import org.apache.nifi.registry.flow.FlowRegistryException;
+import org.apache.nifi.registry.flow.git.AbstractGitFlowRegistryClient;
+import org.apache.nifi.registry.flow.git.client.GitRepositoryClient;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+
+import java.util.List;
+
+@Tags({ "atlassian", "bitbucket", "registry", "flow" })
+@CapabilityDescription("Flow Registry Client that uses the BitBucket REST API to version control flows in a BitBucket Repository.")
+public class BitBucketFlowRegistryClient extends AbstractGitFlowRegistryClient {
+
+ static final PropertyDescriptor BITBUCKET_API_URL = new PropertyDescriptor.Builder()
+ .name("BitBucket API Instance")
+ .description("The instance of the BitBucket API")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .defaultValue("api.bitbucket.org")
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor BITBUCKET_API_VERSION = new PropertyDescriptor.Builder()
+ .name("BitBucket API Version")
+ .description("The version of the BitBucket API")
+ .defaultValue("2.0")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor WORKSPACE_NAME = new PropertyDescriptor.Builder()
+ .name("Workspace Name")
+ .description("The name of the workspace that contains the repository to connect to")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor REPOSITORY_NAME = new PropertyDescriptor.Builder()
+ .name("Repository Name")
+ .description("The name of the repository")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor AUTHENTICATION_TYPE = new PropertyDescriptor.Builder()
+ .name("Authentication Type")
+ .description("The type of authentication to use for accessing BitBucket")
+ .allowableValues(BitBucketAuthenticationType.class)
+ .defaultValue(BitBucketAuthenticationType.ACCESS_TOKEN)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor ACCESS_TOKEN = new PropertyDescriptor.Builder()
+ .name("Access Token")
+ .description("The access token to use for authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.ACCESS_TOKEN)
+ .build();
+
+ static final PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
+ .name("Username")
+ .description("The username to use for authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(false)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.BASIC_AUTH)
+ .build();
+
+ static final PropertyDescriptor APP_PASSWORD = new PropertyDescriptor.Builder()
+ .name("App Password")
+ .description("The App Password to use for authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.BASIC_AUTH)
+ .build();
+
+ static final PropertyDescriptor OAUTH_TOKEN_PROVIDER = new PropertyDescriptor.Builder()
+ .name("OAuth2 Access Token Provider")
+ .description("Service providing OAuth2 Access Tokens for authentication")
+ .identifiesControllerService(OAuth2AccessTokenProvider.class)
+ .required(true)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.OAUTH2)
+ .build();
+
+ static final PropertyDescriptor WEBCLIENT_SERVICE = new PropertyDescriptor.Builder()
+ .name("Web Client Service")
+ .description("The Web Client Service to use for communicating with BitBucket")
+ .required(true)
+ .identifiesControllerService(WebClientServiceProvider.class)
+ .build();
+
+ static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
+ WEBCLIENT_SERVICE,
+ BITBUCKET_API_URL,
+ BITBUCKET_API_VERSION,
+ WORKSPACE_NAME,
+ REPOSITORY_NAME,
+ AUTHENTICATION_TYPE,
+ ACCESS_TOKEN,
+ USERNAME,
+ APP_PASSWORD,
+ OAUTH_TOKEN_PROVIDER);
+
+ @Override
+ protected List<PropertyDescriptor> createPropertyDescriptors() {
+ return PROPERTY_DESCRIPTORS;
+ }
+
+ @Override
+ protected GitRepositoryClient createRepositoryClient(final FlowRegistryClientConfigurationContext context) throws FlowRegistryException {
+ return BitBucketRepositoryClient.builder()
+ .clientId(getIdentifier())
+ .apiUrl(context.getProperty(BITBUCKET_API_URL).getValue())
+ .apiVersion(context.getProperty(BITBUCKET_API_VERSION).getValue())
+ .workspace(context.getProperty(WORKSPACE_NAME).getValue())
+ .repoName(context.getProperty(REPOSITORY_NAME).getValue())
+ .repoPath(context.getProperty(REPOSITORY_PATH).getValue())
+ .authenticationType(context.getProperty(AUTHENTICATION_TYPE).asAllowableValue(BitBucketAuthenticationType.class))
+ .accessToken(context.getProperty(ACCESS_TOKEN).evaluateAttributeExpressions().getValue())
+ .username(context.getProperty(USERNAME).evaluateAttributeExpressions().getValue())
+ .appPassword(context.getProperty(APP_PASSWORD).evaluateAttributeExpressions().getValue())
+ .oauthService(context.getProperty(OAUTH_TOKEN_PROVIDER).asControllerService(OAuth2AccessTokenProvider.class))
+ .webClient(context.getProperty(WEBCLIENT_SERVICE).asControllerService(WebClientServiceProvider.class))
+ .build();
+ }
+
+ @Override
+ public boolean isStorageLocationApplicable(FlowRegistryClientConfigurationContext context, String location) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ protected String getStorageLocation(GitRepositoryClient repositoryClient) {
+ // TODO Auto-generated method stub
+ return null;
+ }
Review Comment:
Technically it shouldn't cause any problems to not implement these, but the pattern we used for GitHub and GitLab was to construct a string that is similar to the value you use when cloning the repo:
```
git@github.com:<owner>/<repo>.git
```
And then `isStorageLocationApplicable` checks if it starts with the prefix `git@github.com:`.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "mbegerau (via GitHub)" <gi...@apache.org>.
mbegerau commented on PR #9547:
URL: https://github.com/apache/nifi/pull/9547#issuecomment-2718542033
I have tested with the latest commit and I can confirm that **creating flows**, **commiting changes** and **changing versions** works with all three authentication methods. As far as I know there is no way yet to delete commits or entire flows with a git registry client.
Maybe you should consider applying the access token logic (if read, then assume read+write) also to the username/appPassword flow because with the current setup you need to give the app password "account:read" permission (same reason as for access token), otherwise "repository" and "repository:write" would be enough.
Since there is no "View Documentation" option for registry clients, maybe it could be helpful for the user to extend the "Authentication Type" descriptions. Here some bullet point ideas:
- Basic Auth: Username (not email) and App Password (link to [documentation](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)). List required permissions: repository, repository:read, (possibly account:read)
- Access Token: (link to [documentation](https://support.atlassian.com/bitbucket-cloud/docs/access-tokens/)). List required permissions: repository, repository:read
- OAuth: Only works with client credentials flow which requires OAuth consumers (link to [documentation](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)). OAuth consumer needs to be private, and callback url needs to be set, but can have any value.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "mbegerau (via GitHub)" <gi...@apache.org>.
mbegerau commented on PR #9547:
URL: https://github.com/apache/nifi/pull/9547#issuecomment-2718108841
First of all thanks @pvillard31 for initiating this PR. We are starting to migrate some projects from NiFi 1 to NiFi 2 and the new git registry client feature is actually one of the top reasons why we want to migrate, because it really reduces the complexity of the setup. Also my company is locked in to Atlassian tech stack which is why I'm looking forward to the Bitbucket implementation.
That being said, I checked out your branch today and tried to set it up. Here are my notes:
1. Naming: Doesn't really matter but the second "b" of Bitbucket is usually lowercase and we should probably keep it like that.
2. The atlassian bundle is missing in the [pom.xml of the nifi-assembly bundle](nifi-assembly/pom.xml). Without adding the dependency there the BitbucketFlowRegistryClient did not show up with the usual _mvnw install..._, because the nar file was not installed.
3. The Bitbucket access token flow would be our preferred authentication solution and it's not working. You said you can't test it due to being a paid service. Maybe we can debug this together. The reason for now is that the [endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-user-permissions-repositories-get) you use in the [checkRepoPermissions](https://github.com/pvillard31/nifi/blob/838e21cdbf0d2368c94e57797f728f7e2efff077/nifi-extension-bundles/nifi-atlassian-bundle/nifi-atlassian-extensions/src/main/java/org/apache/nifi/atlassian/bitbucket/BitBucketRepositoryClient.java#L395) method always returns _{"type": "error", "error": {"message": "Token is invalid, expired, or not supported for this endpoint."}}_ when used with an access token. From what I read in the [Access Token usage documentation](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#access-tokens) access tokens can't have the "account" scope. So all endpoints requiri
ng this scope will not work. For example the [/user endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get) does not work as well. Also it says "Access Tokens are not listed in any repository or workspace permission API response." So the [/permissions-config/users endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-permissions-config-users-get) actually works with access token, but it does not return any results. You can check for repository (read) and repository:write permissions indirectly, [Get a repository](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get) returns status code 200 with read permissions (404 otherwise) and [Create a commit by uploading a file](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-src-post) without a request body return
s status code 415 with write permissions (404 otherwise).
4. When I switched to oauth with client credentials it works. I tested creating a new flow, commiting a new version and returning to an old version.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "pvillard31 (via GitHub)" <gi...@apache.org>.
pvillard31 commented on PR #9547:
URL: https://github.com/apache/nifi/pull/9547#issuecomment-2718676588
Thanks @mbegerau - I have made some additional changes based on your feedback. I applied the same approach for checking permissions in case of basic auth.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "bbende (via GitHub)" <gi...@apache.org>.
bbende merged PR #9547:
URL: https://github.com/apache/nifi/pull/9547
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "pvillard31 (via GitHub)" <gi...@apache.org>.
pvillard31 commented on PR #9547:
URL: https://github.com/apache/nifi/pull/9547#issuecomment-2718335489
Thanks for the feedback @mbegerau - I have rebased against main and addressed your comments. I'm not sure I like the idea of trying a commit with an empty body to check if the error code is correct in order to assume write permissions. So for now, I just assumed that if we have read access (using the list branch endpoint), we assume write access. Happy to revisit if you feel strongly about it.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14029 - BitBucket Registry Client [nifi]
Posted by "pvillard31 (via GitHub)" <gi...@apache.org>.
pvillard31 commented on code in PR #9547:
URL: https://github.com/apache/nifi/pull/9547#discussion_r1857282504
##########
nifi-extension-bundles/nifi-atlassian-bundle/nifi-atlassian-extensions/src/main/java/org/apache/nifi/atlassian/bitbucket/BitBucketFlowRegistryClient.java:
##########
@@ -0,0 +1,163 @@
+/*
+ * 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.atlassian.bitbucket;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.oauth2.OAuth2AccessTokenProvider;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.registry.flow.FlowRegistryClientConfigurationContext;
+import org.apache.nifi.registry.flow.FlowRegistryException;
+import org.apache.nifi.registry.flow.git.AbstractGitFlowRegistryClient;
+import org.apache.nifi.registry.flow.git.client.GitRepositoryClient;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+
+import java.util.List;
+
+@Tags({ "atlassian", "bitbucket", "registry", "flow" })
+@CapabilityDescription("Flow Registry Client that uses the BitBucket REST API to version control flows in a BitBucket Repository.")
+public class BitBucketFlowRegistryClient extends AbstractGitFlowRegistryClient {
+
+ static final PropertyDescriptor BITBUCKET_API_URL = new PropertyDescriptor.Builder()
+ .name("BitBucket API Instance")
+ .description("The instance of the BitBucket API")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .defaultValue("api.bitbucket.org")
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor BITBUCKET_API_VERSION = new PropertyDescriptor.Builder()
+ .name("BitBucket API Version")
+ .description("The version of the BitBucket API")
+ .defaultValue("2.0")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor WORKSPACE_NAME = new PropertyDescriptor.Builder()
+ .name("Workspace Name")
+ .description("The name of the workspace that contains the repository to connect to")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor REPOSITORY_NAME = new PropertyDescriptor.Builder()
+ .name("Repository Name")
+ .description("The name of the repository")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor AUTHENTICATION_TYPE = new PropertyDescriptor.Builder()
+ .name("Authentication Type")
+ .description("The type of authentication to use for accessing BitBucket")
+ .allowableValues(BitBucketAuthenticationType.class)
+ .defaultValue(BitBucketAuthenticationType.ACCESS_TOKEN)
+ .required(true)
+ .build();
+
+ static final PropertyDescriptor ACCESS_TOKEN = new PropertyDescriptor.Builder()
+ .name("Access Token")
+ .description("The access token to use for authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.ACCESS_TOKEN)
+ .build();
+
+ static final PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
+ .name("Username")
+ .description("The username to use for authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(false)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.BASIC_AUTH)
+ .build();
+
+ static final PropertyDescriptor APP_PASSWORD = new PropertyDescriptor.Builder()
+ .name("App Password")
+ .description("The App Password to use for authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.BASIC_AUTH)
+ .build();
+
+ static final PropertyDescriptor OAUTH_TOKEN_PROVIDER = new PropertyDescriptor.Builder()
+ .name("OAuth2 Access Token Provider")
+ .description("Service providing OAuth2 Access Tokens for authentication")
+ .identifiesControllerService(OAuth2AccessTokenProvider.class)
+ .required(true)
+ .dependsOn(AUTHENTICATION_TYPE, BitBucketAuthenticationType.OAUTH2)
+ .build();
+
+ static final PropertyDescriptor WEBCLIENT_SERVICE = new PropertyDescriptor.Builder()
+ .name("Web Client Service")
+ .description("The Web Client Service to use for communicating with BitBucket")
+ .required(true)
+ .identifiesControllerService(WebClientServiceProvider.class)
+ .build();
+
+ static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
+ WEBCLIENT_SERVICE,
+ BITBUCKET_API_URL,
+ BITBUCKET_API_VERSION,
+ WORKSPACE_NAME,
+ REPOSITORY_NAME,
+ AUTHENTICATION_TYPE,
+ ACCESS_TOKEN,
+ USERNAME,
+ APP_PASSWORD,
+ OAUTH_TOKEN_PROVIDER);
+
+ @Override
+ protected List<PropertyDescriptor> createPropertyDescriptors() {
+ return PROPERTY_DESCRIPTORS;
+ }
+
+ @Override
+ protected GitRepositoryClient createRepositoryClient(final FlowRegistryClientConfigurationContext context) throws FlowRegistryException {
+ return BitBucketRepositoryClient.builder()
+ .clientId(getIdentifier())
+ .apiUrl(context.getProperty(BITBUCKET_API_URL).getValue())
+ .apiVersion(context.getProperty(BITBUCKET_API_VERSION).getValue())
+ .workspace(context.getProperty(WORKSPACE_NAME).getValue())
+ .repoName(context.getProperty(REPOSITORY_NAME).getValue())
+ .repoPath(context.getProperty(REPOSITORY_PATH).getValue())
+ .authenticationType(context.getProperty(AUTHENTICATION_TYPE).asAllowableValue(BitBucketAuthenticationType.class))
+ .accessToken(context.getProperty(ACCESS_TOKEN).evaluateAttributeExpressions().getValue())
+ .username(context.getProperty(USERNAME).evaluateAttributeExpressions().getValue())
+ .appPassword(context.getProperty(APP_PASSWORD).evaluateAttributeExpressions().getValue())
+ .oauthService(context.getProperty(OAUTH_TOKEN_PROVIDER).asControllerService(OAuth2AccessTokenProvider.class))
+ .webClient(context.getProperty(WEBCLIENT_SERVICE).asControllerService(WebClientServiceProvider.class))
+ .build();
+ }
+
+ @Override
+ public boolean isStorageLocationApplicable(FlowRegistryClientConfigurationContext context, String location) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ protected String getStorageLocation(GitRepositoryClient repositoryClient) {
+ // TODO Auto-generated method stub
+ return null;
+ }
Review Comment:
Thanks @bbende - I completely forgot to get back to this when I switched to the other class and testing... Will address now
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org