From 42d33786a1a2da97a7243d7a42d2f28f9a20026a Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Wed, 1 May 2024 13:33:13 -0700 Subject: [PATCH] Updated `gam report ` to retry/handle the following error: ERROR: 503: serviceNotAvailable - The service is currently unavailable. --- docs/Authorization.md | 5 +- docs/GamUpdates.md | 7 + docs/How-to-Upgrade-from-Standard-GAM.md | 4 +- docs/Resources.md | 251 ++++++++++++++++++++++- docs/Version-and-Help.md | 12 +- src/GamUpdate.txt | 8 +- src/gam/__init__.py | 5 +- 7 files changed, 277 insertions(+), 15 deletions(-) diff --git a/docs/Authorization.md b/docs/Authorization.md index 2d2e1c00..8f7b2683 100644 --- a/docs/Authorization.md +++ b/docs/Authorization.md @@ -206,6 +206,9 @@ perform these steps and then retry the create project command. * Click in the Select a role box * Type project creator in the Filter box * Click Project Creator +* Click + Add Another Role +* Type organization policy administrator in the Filter box +* Click Orgainzation Policy Administrator * Click Save ## Authorize Service Account Key Uploads @@ -245,7 +248,7 @@ perform these steps and then you should be able to authorize and use your projec Wait a couple of minutes for the policy updates to complete and then do the following to upload the service account key: ``` -gam upload sakey +gam upload sakey [admin ] ``` ## Authorize GAM to create projects diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 1518ca5e..6d2f0c53 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,13 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation +### 6.75.02 + +Updated `gam report ` to retry/handle the following error: +``` +ERROR: 503: serviceNotAvailable - The service is currently unavailable. +``` + ### 6.75.01 Added option `admin ` to `gam upload sakey`. diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index ccee9186..fca4dfa5 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -335,7 +335,7 @@ writes the credentials into the file oauth2.txt. admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found -GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -1009,7 +1009,7 @@ writes the credentials into the file oauth2.txt. C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>gam version WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found -GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Resources.md b/docs/Resources.md index e56cd5a7..b40dc0ff 100644 --- a/docs/Resources.md +++ b/docs/Resources.md @@ -1,6 +1,7 @@ # Resources - [API documentation](#api-documentation) - [Definitions](#definitions) +- [Region Codes](#region-codes) - [Special quoting](#special-quoting) - [Manage buildings](#manage-buildings) - [Display buildings](#display-buildings) @@ -121,6 +122,252 @@ See [Collections of Items](Collections-of-Items) uservisibledescription ::= "(,)*" ``` + +## Region Codes + +| Region | Code | +|--------|------| +| Afghanistan | AF | +| Aland Islands | AX | +| Albania | AL | +| Algeria | DZ | +| American Samoa | AS | +| Andorra | AD | +| Angola | AO | +| Anguilla | AI | +| Antarctica | AQ | +| Antigua & Barbuda | AG | +| Argentina | AR | +| Armenia | AM | +| Aruba | AW | +| Ascension Island | AC | +| Australia | AU | +| Austria | AT | +| Azerbaijan | AZ | +| Bahamas | BS | +| Bahrain | BH | +| Bangladesh | BD | +| Barbados | BB | +| Belarus | BY | +| Belgium | BE | +| Belize | BZ | +| Benin | BJ | +| Bermuda | BM | +| Bhutan | BT | +| Bolivia | BO | +| Bosnia & Herzegovina | BA | +| Botswana | BW | +| Bouvet Island | BV | +| Brazil | BR | +| British Indian Ocean Territory | IO | +| British Virgin Islands | VG | +| Brunei | BN | +| Bulgaria | BG | +| Burkina Faso | BF | +| Burundi | BI | +| Cambodia | KH | +| Cameroon | CM | +| Canada | CA | +| Canary Islands | IC | +| Cape Verde | CV | +| Caribbean Netherlands | BQ | +| Cayman Islands | KY | +| Central African Republic | CF | +| Ceuta & Melilla | EA | +| Chad | TD | +| Chile | CL | +| China | CN | +| Christmas Island | CX | +| Clipperton Island | CP | +| Cocos (Keeling) Islands | CC | +| Columbia | CO | +| Comoros | KM | +| Congo - Brazzaville | CG | +| Congo - Kinshasa | CD | +| Cook Islands | CK | +| Costa Rica | CR | +| Cote d’Ivoire | CI | +| Croatia | HR | +| Cuba | CU | +| Curacao | CW | +| Cyprus | CY | +| Czech Republic | CZ | +| Falkland Islands | FK | +| Faroe Islands | FO | +| Fiji | FJ | +| Finland | FI | +| France | FR | +| Gabon | GA | +| Gambia | GM | +| Georgia | GE | +| Germany | DE | +| Ghana | GH | +| Gibraltar | GI | +| Greece | GR | +| Greenland | GL | +| Grenada | GD | +| Guadeloupe | GP | +| Guam | GU | +| Guatemala | GT | +| Guernsey | GG | +| Guinea | GN | +| Guinea-Bissau | GW | +| Guyana | GY | +| Haiti | HT | +| Heard & McDonald Islands | HM | +| Honduras | HN | +| Hong Kong SAR China | HK | +| Hungary | HU | +| Iceland | IS | +| India | IN | +| Indonesia | ID | +| Iran | IR | +| Iraq | IQ | +| Ireland | IE | +| Isle of Man | IM | +| Israel | IL | +| Italy | IT | +| Jamaica | JM | +| Japan | JP | +| Jersey | JE | +| Jordan | JO | +| Kazakhstan | KZ | +| Kenya | KE | +| Kiribati | KI | +| Kosovo | XK | +| Kuwait | KW | +| Kyrgyzstan | KG | +| Laos | LA | +| Latvia | LV | +| Lebanon | LB | +| Lesotho | LS | +| Liberia | LR | +| Libya | LY | +| Liechtenstein | LI | +| Lithuania | LT | +| Luxembourg | LU | +| Macau SAR China | MO | +| Macedonia | MK | +| Madagascar | MG | +| Malawi | MW | +| Malaysia | MY | +| Maldives | MV | +| Mali | ML | +| Malta | MT | +| Marshall Islands | MH | +| Martinique | MQ | +| Mauritania | MR | +| Mauritius | MU | +| Mayotte | YT | +| Mexico | MX | +| Micronesia | FM | +| Moldova | MD | +| Monaco | MC | +| Mongolia | MN | +| Montenegro | ME | +| Montserrat | MS | +| Morocco | MA | +| Mozambique | MZ | +| Myanmar | MM | +| Namibia | NA | +| Nauru | NR | +| Nepal | NP | +| Netherlands | NL | +| New Caledonia | NC | +| New Zealand | NZ | +| Nicaragua | NI | +| Niger | NE | +| Nigeria | NG | +| Niue | NU | +| Norfolk Island | NF | +| North Korea | KP | +| Northern Mariana Islands | MP | +| Norway | NO | +| Oman | OM | +| Pakistan | PK | +| Palau | PW | +| Palestinia Territories | PS | +| Panama | PA | +| Papua New Guinea | PG | +| Paraguay | PY | +| Peru | PE | +| Philippines | PH | +| Pitcairn Islands | PN | +| Poland | PL | +| Portugal | PT | +| Puerto Rico | PR | +| Qatar | QA | +| Reunion | RE | +| Romania | RO | +| Russia | RU | +| Rwanda | RW | +| Samoa | WS | +| San Marino | SM | +| Sao Tomm & Principe | ST | +| Saudi Arabia | SA | +| Senegal | SN | +| Serbia | RS | +| Seychelles | SC | +| Sierra Leone | SL | +| Singapore | SG | +| Sint Maarten | SX | +| Slovakia | SK | +| Slovenia | SI | +| Solomon Islands | SB | +| Somalia | SO | +| South Africa | ZA | +| South Georgia & South Sandwich Islands | GS | +| South Korea | KR | +| South Sudan | SS | +| Spain | ES | +| Sri Lanka | LK | +| St. Barthelemy | BL | +| St. Helena | SH | +| St. Kitts & Nevis | KN | +| St. Lucia | LC | +| St. Martin | MF | +| St. Pierre & Miquelon | PM | +| St. Vincent & Grenadines | VC | +| Sudan | SD | +| Suriname | SR | +| Svalbard & Jan Mayen | SJ | +| Swaziland | SZ | +| Sweden | SE | +| Switzerland | CH | +| Syria | SY | +| Taiwan | TW | +| Tajikistan | TJ | +| Tanzania | TZ | +| Thailand | TH | +| Timor-Leste | TL | +| Togo | TG | +| Tokelau | TK | +| Tonga | TO | +| Trinidad & Tobago | TT | +| Tristan da Cunha | TA | +| Tunisia | TN | +| Turkey | TR | +| Turkmenistan | TM | +| Turks & Caicos Islands | TC | +| Tuvalu | TV | +| U.S. Outlying Islands | UM | +| U.S. Virgin Islands | VI | +| Uganda | UG | +| Ukraine | UA | +| United Arab Emirates | AE | +| United Kingdom | GB | +| United States | US | +| Unknown Region | ZZ | +| Uraguay | UY | +| Uzbekistan | UZ | +| Vanuatu | VU | +| Vatican City | VA | +| Venezuela | VE | +| Vietnam | VN | +| Yemen | YE | +| Zambia | ZM | +| Zimbabwe | ZW | + ## Special quoting When entering `` with `s`containing spaces, enclose the list in `"` and the names containing spaces in `'`. ``` @@ -133,10 +380,8 @@ When creating a building, at a minimum you must enter `address|addresslines` and * Enter a single-line address as `address "123 Main Street"` * Enter a multi-line address as `addresslines "123 Main Street\nAnytown, US"` - -For `country|regioncode` see: http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html ``` -gam create|add building * +gam create|add building * gam update building * gam delete building ``` diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 773b0d31..2fdc8563 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,7 +3,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00 Print the current version of Gam with details and time offset information ``` gam version timeoffset -GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second Print the current version of Gam with extended details and SSL information ``` gam version extended -GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.75.01 + Latest: 6.75.02 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.75.01 +6.75.02 ``` In Linux/MacOS you can do: ``` @@ -82,7 +82,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.75.02 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 454f65c6..11d34e0f 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,11 +2,17 @@ Merged GAM-Team version +6.75.02 + +Updated `gam report ` to retry/handle the following error: +``` +ERROR: 503: serviceNotAvailable - The service is currently unavailable. +``` + 6.75.01 Added option `admin ` to `gam upload sakey`. - 6.75.00 Updated `gam create project` to simplify handling the situation where your workspace is configured to disable service account private key uploads. diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 6e1c875d..0b30db94 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -13881,7 +13881,8 @@ def doReport(): try: feed = callGAPIpages(service, 'list', 'items', pageMessage=pageMessage, maxItems=maxActivities, - throwReasons=[GAPI.BAD_REQUEST, GAPI.INVALID, GAPI.INVALID_INPUT, GAPI.AUTH_ERROR], + throwReasons=[GAPI.BAD_REQUEST, GAPI.INVALID, GAPI.INVALID_INPUT, GAPI.AUTH_ERROR, GAPI.SERVICE_NOT_AVAILABLE], + retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS, applicationName=report, userKey=user, customerId=customerId, actorIpAddress=actorIpAddress, orgUnitID=orgUnitId, startTime=startEndTime.startTime, endTime=startEndTime.endTime, @@ -13893,7 +13894,7 @@ def doReport(): continue printErrorMessage(BAD_REQUEST_RC, Msg.BAD_REQUEST) break - except (GAPI.invalid, GAPI.invalidInput) as e: + except (GAPI.invalid, GAPI.invalidInput, GAPI.serviceNotAvailable) as e: systemErrorExit(GOOGLE_API_ERROR_RC, str(e)) except GAPI.authError: accessErrorExit(None)