diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 230b058d..d45f6806 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -696,17 +696,18 @@ jobs: $gam user $gam_user delete shareddrive "${driveid}" nukefromorbit echo "printer model count:" $gam print printermodels | wc -l - $gam create inboundssoprofile name "El Goog ${newbase}" loginurl https://www.google.com logouturl https://www.google.com changepasswordurl https://www.google.com entityid ElGoog - $gam create inboundssocredential profile "El Goog ${newbase}" generate_key - $gam create inboundssoassignment profile "El Goog ${newbase}" orgunit "${newou}" mode SAML_SSO + ssoprofile=$($gam create inboundssoprofile name "El Goog ${newbase}" loginurl https://www.google.com logouturl https://www.google.com changepasswordurl https://www.google.com entityid ElGoog name_only) + $gam create inboundssocredential profile "id:~~${ssoprofile}~~" generate_key + $gam create inboundssoassignment profile "id:~~${ssoprofile}~~" orgunit "${newou}" mode SAML_SSO $gam delete ou "${newou}" + $gam delete inboundssoprofile "id:~~${ssoprofile}~~" #$gam print printers #$gam create printer displayname "${newbase}" uri ipp://localhost:631 driverless description "made by $(gam_user)" ou / - #export CUSTOMER_ID="C01wfv983" - #export GA_DOMAIN="pdl.jaylee.us" - #touch $gampath/enabledasa.txt - #echo "using delegated admin service account" - #$gam print users + export CUSTOMER_ID="C01wfv983" + export GA_DOMAIN="pdl.jaylee.us" + touch $gampath/enabledasa.txt + echo "using delegated admin service account" + $gam print users - name: Archive production artifacts uses: actions/upload-artifact@v3 diff --git a/src/gam/gapi/cloudidentity/inboundsso.py b/src/gam/gapi/cloudidentity/inboundsso.py index e47a16b4..97c63ac0 100644 --- a/src/gam/gapi/cloudidentity/inboundsso.py +++ b/src/gam/gapi/cloudidentity/inboundsso.py @@ -40,6 +40,7 @@ def build(): '''parse cmd for profile create/update''' def parse_profile(body, i): + name_only = False while i < len(sys.argv): myarg = sys.argv[i].lower().replace('_', '') if myarg == 'name': @@ -48,6 +49,9 @@ def parse_profile(body, i): elif myarg == 'entityid': body.setdefault('idpConfig', {})['entityId'] = sys.argv[i+1] i += 2 + elif myarg == 'nameonly': + name_only = True + i += 1 elif myarg == 'loginurl': body.setdefault('idpConfig', {})['singleSignOnServiceUri'] = sys.argv[i+1] i += 2 @@ -59,7 +63,7 @@ def parse_profile(body, i): i += 2 else: controlflow.invalid_argument_exit(myarg, 'gam create/update inboundssoprofile') - return body + return (name_only, body) '''convert profile nice names to unique ID''' @@ -135,9 +139,12 @@ def create_profile(): 'customer': get_sso_customer(), 'displayName': 'SSO Profile' } - body = parse_profile(body, 3) + name_only, body = parse_profile(body, 3) result = gapi.call(ci.inboundSamlSsoProfiles(), 'create', body=body) - display.print_json(result) + if name_only: + print(result['response']['name']) + else: + display.print_json(result) '''gam print inboundssoprofiles''' @@ -184,14 +191,17 @@ def update_profile(): ci = build() name = profile_displayname_to_name(sys.argv[3], ci) body = {} - body = parse_profile(body, 4) + name_only, body = parse_profile(body, 4) updateMask = ','.join(body.keys()) result = gapi.call(ci.inboundSamlSsoProfiles(), 'patch', name=name, updateMask=updateMask, body=body) - display.print_json(result) + if name_only: + print(result['response']['name']) + else: + display.print_json(result) '''gam info inboundssoprofile'''