Skip to content
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

Add IP Location APIs #3107

Merged
merged 20 commits into from
Dec 18, 2024
Merged

Add IP Location APIs #3107

merged 20 commits into from
Dec 18, 2024

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Nov 8, 2024

I extracted the rest-api-spec JSON files from #3019. We'll need a review from the Data Management team before merging.

@pquentin pquentin requested a review from joegallo November 8, 2024 09:49
@pquentin pquentin requested a review from a team as a code owner November 8, 2024 09:49

This comment was marked as outdated.

joegallo

This comment was marked as resolved.

This comment was marked as outdated.

@joegallo
Copy link
Contributor

joegallo commented Nov 8, 2024

I think we'll still need to make a change to Database.ts -- I'll reach out to you offline.

@lcawl
Copy link
Contributor

lcawl commented Nov 13, 2024

Thanks for creating this PR! I was looking at how to ensure the work from elastic/elasticsearch#116611 got carried over to the new API docs site and this PR already does a lot of the heavy lifting (we can port the examples over in a subsequent PR).

This was referenced Nov 15, 2024

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

specification/ingest/_types/Database.ts Outdated Show resolved Hide resolved
/** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.
* At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured.
*/
maxmind: Maxmind
Copy link
Member Author

Choose a reason for hiding this comment

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

We do need the maxmind key which is gone with this approach.

Also it's OK to have some duplication, eg I'm happy to keep the previous approach but simply add an ipinfo field and type, with one less field.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, yeah, I'll take a swing at fixing that -- it wasn't an intentional change in this second version of things, I just wasn't thoughtful enough about how I did it.

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about 31fd86a?

Copy link
Member Author

Choose a reason for hiding this comment

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

This looks great, thanks! Can you please confirm that the GeoIP APIs also accept ipinfo databases? I'm asking as DatabaseConfiguration is currently shared between the two APIs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, they do.

This comment was marked as outdated.

This comment was marked as outdated.

@joegallo
Copy link
Contributor

joegallo commented Dec 5, 2024

@pquentin I've got two more things on this one, one that's hopefully minor, and then one that might be more-than-minor:

1.) Can you help me diagnose and understand the failure on ingest.put_ip_location_database? I'm seeing 3/4 for the 'Request' column, and I'm not sure what there is to be done about that, if anything.

2.) The PUT needs to be able to handle ipinfo database configurations, too, and I didn't realize until just now that that's not currently covered. To make things slightly more difficult, the PUT API will not handle web and local configurations -- those are effectively read-only.

This comment was marked as outdated.

@pquentin
Copy link
Member Author

@pquentin I've got two more things on this one, one that's hopefully minor, and then one that might be more-than-minor: [...]

Sorry for the delay!

So 1. and 2. are the same actually! The failure is the one I mentioned in https://github.com/elastic/elasticsearch-specification/pull/3107/files#r1850637399. I can help you offline to get make validate api=ingest.put_ip_location_database branch=main to work if you're interested.

That said, I tried to fix those in my latest commit, please take a look.

Something else we need to do (possibly in a follow-up PR) is to apply the same changes to the existing GeoIP APIs.

Copy link
Contributor

@l-trotta l-trotta left a comment

Choose a reason for hiding this comment

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

LGTM!

This comment was marked as outdated.

1 similar comment
Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
ingest.delete_geoip_database 🟢 1/1 1/1
ingest.delete_ip_location_database 🟢 1/1 1/1
ingest.delete_pipeline 🟢 15/15 15/15
ingest.geo_ip_stats 🟢 1/1 1/1
ingest.get_geoip_database 🟢 6/6 6/6
ingest.get_ip_location_database 🟢 7/7 7/7
ingest.get_pipeline 🟢 22/22 22/22
ingest.processor_grok 🟢 1/1 1/1
ingest.put_geoip_database 🟢 3/3 3/3
ingest.put_ip_location_database 🟢 4/4 4/4
ingest.put_pipeline 🟢 60/60 60/60
ingest.simulate 🟢 10/10 10/10

You can validate these APIs yourself by using the make validate target.

Copy link
Contributor

@joegallo joegallo left a comment

Choose a reason for hiding this comment

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

Ship it!

@pquentin pquentin merged commit dae081f into main Dec 18, 2024
8 checks passed
@pquentin pquentin deleted the ip-location-apis branch December 18, 2024 05:08
github-actions bot pushed a commit that referenced this pull request Dec 18, 2024
* Add IP Location APIs

* Rename these files

* Reword this description

* Handle ipinfo in addition to maxmind

* A slightly more faithful alternative approach

* Remove accidentally-added line

* A more-correct implementation of the second approach

* Another approach using @Variants container

* Fix IP location APIs

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Quentin Pradet <[email protected]>

* Fix an import

and then make generate, etc

* Remove unused import

---------

Co-authored-by: Joe Gallo <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit dae081f)
github-actions bot pushed a commit that referenced this pull request Dec 18, 2024
* Add IP Location APIs

* Rename these files

* Reword this description

* Handle ipinfo in addition to maxmind

* A slightly more faithful alternative approach

* Remove accidentally-added line

* A more-correct implementation of the second approach

* Another approach using @Variants container

* Fix IP location APIs

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Quentin Pradet <[email protected]>

* Fix an import

and then make generate, etc

* Remove unused import

---------

Co-authored-by: Joe Gallo <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit dae081f)
github-actions bot pushed a commit that referenced this pull request Dec 18, 2024
* Add IP Location APIs

* Rename these files

* Reword this description

* Handle ipinfo in addition to maxmind

* A slightly more faithful alternative approach

* Remove accidentally-added line

* A more-correct implementation of the second approach

* Another approach using @Variants container

* Fix IP location APIs

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Quentin Pradet <[email protected]>

* Fix an import

and then make generate, etc

* Remove unused import

---------

Co-authored-by: Joe Gallo <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit dae081f)
pquentin added a commit that referenced this pull request Dec 18, 2024
* Add IP Location APIs

* Rename these files

* Reword this description

* Handle ipinfo in addition to maxmind

* A slightly more faithful alternative approach

* Remove accidentally-added line

* A more-correct implementation of the second approach

* Another approach using @Variants container

* Fix IP location APIs

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Quentin Pradet <[email protected]>

* Fix an import

and then make generate, etc

* Remove unused import

---------

Co-authored-by: Joe Gallo <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit dae081f)

Co-authored-by: Quentin Pradet <[email protected]>
pquentin added a commit that referenced this pull request Dec 18, 2024
* Add IP Location APIs

* Rename these files

* Reword this description

* Handle ipinfo in addition to maxmind

* A slightly more faithful alternative approach

* Remove accidentally-added line

* A more-correct implementation of the second approach

* Another approach using @Variants container

* Fix IP location APIs

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Quentin Pradet <[email protected]>

* Fix an import

and then make generate, etc

* Remove unused import

---------

Co-authored-by: Joe Gallo <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit dae081f)

Co-authored-by: Quentin Pradet <[email protected]>
pquentin added a commit that referenced this pull request Dec 18, 2024
* Add IP Location APIs

* Rename these files

* Reword this description

* Handle ipinfo in addition to maxmind

* A slightly more faithful alternative approach

* Remove accidentally-added line

* A more-correct implementation of the second approach

* Another approach using @Variants container

* Fix IP location APIs

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

* Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts

Co-authored-by: Quentin Pradet <[email protected]>

* Fix an import

and then make generate, etc

* Remove unused import

---------

Co-authored-by: Joe Gallo <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit dae081f)

Co-authored-by: Quentin Pradet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants