Skip to content

Commit

Permalink
adjust supported region (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
830d953e authored Nov 22, 2023
1 parent f5e4cf2 commit 398382f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 34 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ If you plan on using a Trend Vision One region, be sure to pass in region parame

| Command Line Arguments | Value | Optional |
| :------------------ | :----------------------- | :------- |
| --region or -r | The region you obtained your API key. Value provided must be one of the Vision One regions, e.g. `us-east-1`, `eu-central-1`, `ap-northeast-1`, `ap-southeast-2`, `ap-southeast-1`, etc. | Yes, either -r or -a
| --region or -r | The region you obtained your API key. Value provided must be one of the Vision One regions, e.g. `us-east-1`, `eu-central-1`, `ap-southeast-1`, `ap-southeast-2`, `ap-northeast-1` | Yes, either -r or -a |
| --addr or -a | Trend Vision One File Security server, such as: antimalware.__REGION__.cloudone.trendmicro.com:443 | Yes, either -r or -a |
| --api_key | Vision One API Key | No |
| --filename or -f | File to be scanned | No |
Expand All @@ -64,23 +64,23 @@ If you plan on using a Trend Vision One region, be sure to pass in region parame
Make sure to customize the example program by configuring it with the API key from your Vision One account, found in your Vision One Dashboard. Assign the value of your Vision One Region's `API_KEY` to the variable and set `FILENAME` to the desired target file.

```sh
python3 client.py -f FILENAME -r us-1 --api_key API_KEY
python3 client.py -f FILENAME -r us-east-1 --tls true --api_key API_KEY
```

or

using File Security server address `-a` instead of region `-r`:

```sh
python3 client.py -f FILENAME -a antimalware._REGION_.cloudone.trendmicro.com:443 --api_key API_KEY
python3 client.py -f FILENAME -a antimalware._REGION_.cloudone.trendmicro.com:443 --tls true --api_key API_KEY
```

or

using asynchronous IO example program:

```sh
python3 client_aio.py -f FILENAME -a antimalware._REGION_.cloudone.trendmicro.com:443 --api_key API_KEY
python3 client_aio.py -f FILENAME -a antimalware._REGION_.cloudone.trendmicro.com:443 --tls true --api_key API_KEY
```

### Code Examples
Expand Down
2 changes: 1 addition & 1 deletion amaas/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.1"
__version__ = "1.0.2"
13 changes: 6 additions & 7 deletions amaas/grpc/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
C1Regions = [C1_AU_REGION, C1_CA_REGION, C1_DE_REGION, C1_GB_REGION, C1_IN_REGION, C1_JP_REGION, C1_SG_REGION,
C1_US_REGION, C1_TREND_REGION]
V1Regions = [AWS_AU_REGION, AWS_DE_REGION, AWS_IN_REGION, AWS_JP_REGION, AWS_SG_REGION, AWS_US_REGION]
SupportedV1Regions = V1Regions
SupportedV1Regions = [AWS_AU_REGION, AWS_DE_REGION, AWS_JP_REGION, AWS_SG_REGION, AWS_US_REGION]
SupportedC1Regions = [C1_AU_REGION, C1_CA_REGION, C1_DE_REGION, C1_GB_REGION, C1_IN_REGION, C1_JP_REGION, C1_SG_REGION,
C1_US_REGION]

Expand Down Expand Up @@ -97,14 +97,13 @@ def _init_by_region_util(region, api_key, enable_tls=True, ca_cert=None, is_aio_
}

# make sure it is valid V1 or C1 region
if region not in AllValidRegions:
raise AMaasException(AMaasErrorCode.MSG_ID_ERR_INVALID_REGION, region, AllValidRegions)

# map it to C1 region if it is V1 region
if region in SupportedV1Regions:
if region not in SupportedV1Regions:
raise AMaasException(AMaasErrorCode.MSG_ID_ERR_INVALID_REGION, region, SupportedV1Regions)
else:
# map it to C1 region if it is V1 region
c1_region = V1ToC1RegionMapping.get(region)
if not c1_region:
raise AMaasException(AMaasErrorCode.MSG_ID_ERR_INVALID_REGION, region, AllValidRegions)
raise AMaasException(AMaasErrorCode.MSG_ID_ERR_INVALID_REGION, region, SupportedV1Regions)
region = c1_region

host = mapping.get(region, None)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
"License :: OSI Approved :: MIT License",
],
python_requires='>=3.7',
Expand Down
2 changes: 0 additions & 2 deletions tests/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions tests/test_simply.py

This file was deleted.

4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ commands =
flake8 .
check-manifest --ignore 'tox.ini,tests/**,tools/**,examples/**,docs/**,*.md,Pipfile*,**/scan.proto'
make -f {toxinidir}/tools/Makefile build
pytest tests {posargs}
# pytest tests {posargs}
python -m twine check dist/*

[flake8]
exclude = .tox,*.egg,build,data
select = E,W,F
select = E,W,F

0 comments on commit 398382f

Please sign in to comment.