Skip to content

Commit

Permalink
Add dogwrap site option to send to US3 site (#749)
Browse files Browse the repository at this point in the history
* Add dogwrap site option to send to US3 site

* add us5 site to all site and api_host config locations

Co-authored-by: Kevin Zou <kevin.zou@datadoghq.com>
Co-authored-by: Kevin Zou <17015060+nkzou@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 10, 2023
1 parent 8874a57 commit 11079a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions datadog/dogshell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ def main():

parser.add_argument(
"--api_host",
help="Datadog site to send data, us (datadoghq.com), eu (datadoghq.eu) or us3 (us3.datadoghq.com), default: us",
help="Datadog site to send data, us (datadoghq.com), eu (datadoghq.eu), us3 (us3.datadoghq.com), \
or us5 (us5.datadoghq.com), default: us",
dest="api_host",
choices=["datadoghq.com", "us", "datadoghq.eu", "eu", "us3.datadoghq.com", "us3"],
choices=["datadoghq.com", "us", "datadoghq.eu", "eu", "us3.datadoghq.com", "us3", "us5.datadoghq.com", "us5"],
)

config = DogshellConfig()
Expand Down
2 changes: 2 additions & 0 deletions datadog/dogshell/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def load(self, config_file, api_key, app_key, api_host):
self["api_host"] = "https://datadoghq.eu"
elif api_host in ("us3.datadoghq.com", "us3"):
self["api_host"] = "https://us3.datadoghq.com"
elif api_host in ("us5.datadoghq.com", "us5"):
self["api_host"] = "https://us5.datadoghq.com"

if api_key is not None and app_key is not None:
self["api_key"] = api_key
Expand Down
10 changes: 7 additions & 3 deletions datadog/dogshell/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ def parse_options(raw_args=None):
action="store",
type="choice",
default="datadoghq.com",
choices=["datadoghq.com", "us", "datadoghq.eu", "eu"],
help="The site \
to send data, us (datadoghq.com) or eu (datadoghq.eu), default: us",
choices=["datadoghq.com", "us", "datadoghq.eu", "eu", "us3.datadoghq.com", "us3", "us5.datadoghq.com", "us5"],
help="The site to send data. Accepts us (datadoghq.com), eu (datadoghq.eu), \
us3 (us3.datadoghq.com), or us5 (us5.datadoghq.com), default: us",
)
parser.add_option(
"-m",
Expand Down Expand Up @@ -421,6 +421,10 @@ def main():

if options.site in ("datadoghq.eu", "eu"):
api_host = "https://api.datadoghq.eu"
elif options.site in ("us3.datadoghq.com", "us3"):
api_host = "https://api.us3.datadoghq.com"
elif options.site in ("us5.datadoghq.com", "us5"):
api_host = "https://api.us5.datadoghq.com"
else:
api_host = "https://api.datadoghq.com"

Expand Down

0 comments on commit 11079a5

Please sign in to comment.