Skip to content

Add a CloudConnectionPool #4005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 9, 2019
Merged

Add a CloudConnectionPool #4005

merged 4 commits into from
Aug 9, 2019

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Aug 7, 2019

This PR allows Elastic Cloud users to use their Cloud Id to configure the client much like they would Logstash / Beats see: https://www.elastic.co/guide/en/cloud/current/ec-cloud-id.html

This also allows us to set some specific ConnectionSettings defaults.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments, mainly about documentation.

* [[cloud-connection-pool]]
* ==== CloudConnectionPool
*
* A specialized subclass of `SingleNodeConnectionPool that accepts a Cloud Id and credentials.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to Cloud docs for Cloud Id

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't use {ref_current} for https://www.elastic.co/guide/en/cloud/current/ec-cloud-id.html would need to add a new block I think.

Is my assumption correct @russcam ?

* ==== CloudConnectionPool
*
* A specialized subclass of `SingleNodeConnectionPool that accepts a Cloud Id and credentials.
* When used the client will also pick Elastic Cloud optmized defaults for the connection settings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to Elastic Cloud

*/
var credentials = new BasicAuthenticationCredentials("username", "password");
var pool = new CloudConnectionPool(cloudId, credentials);
pool.UsingSsl.Should().BeTrue();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should start steering away from emitting test assertions in documentation. I think it adds noise to the signal we're trying to display to users, in this case, how to configure the client for user with Elasticsearch Service on Elastic Cloud. We can prefix and assertions with // hide, and introduce a block scope {} and prefix, if needing to hide more.

public BasicAuthenticationCredentials()
{
}
//TODO remove this constructor in 8.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

{
}
//TODO remove this constructor in 8.0
public ApiKeyAuthenticationCredentials() { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@Mpdreamz
Copy link
Member Author

Mpdreamz commented Aug 9, 2019

Merging this in, will follow up with linking to the cloud id docs.

@Mpdreamz Mpdreamz merged commit fdb1933 into 7.x Aug 9, 2019
@Mpdreamz Mpdreamz deleted the feature/7.x/cloud-id-support branch August 9, 2019 09:20
Mpdreamz added a commit that referenced this pull request Aug 9, 2019
* Add CloudConnectionPool and overloads to the high/low level clients settings constructors to ease connecting to Elastic Cloud

* Add tests for the CloudConnectionPool

* Apply suggestions from code review

Co-Authored-By: Russ Cam <russ.cam@elastic.co>

* fix failing tests due to updated exception message

(cherry picked from commit fdb1933)
russcam pushed a commit that referenced this pull request Aug 13, 2019
* Add CloudConnectionPool and overloads to the high/low level clients settings constructors to ease connecting to Elastic Cloud

* Add tests for the CloudConnectionPool

* Apply suggestions from code review

Co-Authored-By: Russ Cam <russ.cam@elastic.co>

* fix failing tests due to updated exception message

(cherry picked from commit fdb1933)
(cherry picked from commit fd5716f)
@russcam russcam added the v6.8.2 label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants