10 changed files with 623 additions and 45 deletions
@ -1,59 +1,82 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# |
|||
# listcaslibs.py December 2017 |
|||
# listcaslibs.py |
|||
# January 2019 |
|||
# |
|||
# listcaslibs an example of how easy it is to build a new tool. This tool is not really needed as you can do this easily with the CLI |
|||
# it is here for demo purposes. It lists the caslibs and there details accepting the cas server as a parameter |
|||
# Usage: |
|||
# listcaslibs.py [--noheader] [-d] |
|||
# |
|||
# Examples: |
|||
# |
|||
# Change History |
|||
# 1. Return list of all CAS libraries on all servers |
|||
# ./listcaslibs.py |
|||
# |
|||
# 27JAN2017 Comments added |
|||
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# |
|||
# Copyright © 2018, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at |
|||
# Licensed under the Apache License, Version 2.0 (the License); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
|||
# express or implied. See the License for the specific language governing permissions and limitations under the License. |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
import argparse |
|||
from sharedfunctions import callrestapi,printresult |
|||
debug=False |
|||
|
|||
# setup command-line arguements. In this block which is common to all the tools you setup what parameters |
|||
# are passed to the tool |
|||
# the --output parameter is a common one which supports the three styles of output json, simple or csv |
|||
# Import Python modules |
|||
import argparse |
|||
import sys |
|||
from sharedfunctions import callrestapi |
|||
|
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("-s","--server", help="The CAS SERVER.",required='True',default="cas-shared-default") |
|||
parser.add_argument("-o","--output", help="Output Style", choices=['csv','json','simple'],default='json') |
|||
args = parser.parse_args() |
|||
casserver=args.server |
|||
output_style=args.output |
|||
# Define exception handler so that we only output trace info from errors when in debug mode |
|||
def exception_handler(exception_type, exception, traceback, debug_hook=sys.excepthook): |
|||
if debug: |
|||
debug_hook(exception_type, exception, traceback) |
|||
else: |
|||
print "%s: %s" % (exception_type.__name__, exception) |
|||
|
|||
sys.excepthook = exception_handler |
|||
|
|||
# set the request type |
|||
reqtype='get' |
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("--noheader", action='store_true', help="Do not print the header row") |
|||
parser.add_argument("-d","--debug", action='store_true', help="Debug") |
|||
args = parser.parse_args() |
|||
noheader=args.noheader |
|||
debug=args.debug |
|||
|
|||
# set the endpoint to call |
|||
reqval='/casManagement/servers/'+casserver+'/caslibs' |
|||
# Print header row unless noheader argument was specified |
|||
if not noheader: |
|||
print('server,caslib') |
|||
|
|||
endpoint='/casManagement/servers' |
|||
method='get' |
|||
|
|||
#make the rest call using the callrestapi function. You can have one or many calls |
|||
caslib_result_json=callrestapi(reqval,reqtype) |
|||
#make the rest call |
|||
serverlist_result_json=callrestapi(endpoint,method) |
|||
|
|||
# example of overriding the columns for csv output |
|||
cols=['name','type','path','scope','attributes','description'] |
|||
if debug: |
|||
print(serverlist_result_json) |
|||
print('serverlist_result_json is a '+type(serverlist_result_json).__name__+' object') #serverlist_result_json is a dict object |
|||
|
|||
# print result accepts |
|||
# the json returned |
|||
# the output style |
|||
# optionally the columns for csv outtput, if you don't pass in columns you get defaults |
|||
servers = serverlist_result_json['items'] |
|||
|
|||
# You can just print results r post process the results as you need to |
|||
for server in servers: |
|||
servername=server['name'] |
|||
|
|||
printresult(caslib_result_json,output_style,cols) |
|||
# List the caslibs in this server |
|||
endpoint='/casManagement/servers/'+servername+'/caslibs?excludeItemLinks=true' |
|||
method='get' |
|||
caslibs_result_json=callrestapi(endpoint,method) |
|||
if debug: |
|||
print(caslibs_result_json) |
|||
print('caslibs_result_json is a '+type(caslibs_result_json).__name__+' object') #caslibs_result_json is a dict object |
|||
caslibs=caslibs_result_json['items'] |
|||
|
|||
for caslib in caslibs: |
|||
print(server['name']+','+caslib['name']) |
|||
|
|||
@ -0,0 +1,59 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# |
|||
# listcaslibs.py December 2017 |
|||
# |
|||
# listcaslibs an example of how easy it is to build a new tool. This tool is not really needed as you can do this easily with the CLI |
|||
# it is here for demo purposes. It lists the caslibs and there details accepting the cas server as a parameter |
|||
# |
|||
# |
|||
# Change History |
|||
# |
|||
# 27JAN2017 Comments added |
|||
# |
|||
# |
|||
# Copyright © 2018, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
|||
# express or implied. See the License for the specific language governing permissions and limitations under the License. |
|||
# |
|||
|
|||
import argparse |
|||
from sharedfunctions import callrestapi,printresult |
|||
|
|||
# setup command-line arguements. In this block which is common to all the tools you setup what parameters |
|||
# are passed to the tool |
|||
# the --output parameter is a common one which supports the three styles of output json, simple or csv |
|||
|
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("-s","--server", help="The CAS SERVER.",required='True',default="cas-shared-default") |
|||
parser.add_argument("-o","--output", help="Output Style", choices=['csv','json','simple'],default='json') |
|||
args = parser.parse_args() |
|||
casserver=args.server |
|||
output_style=args.output |
|||
|
|||
# set the request type |
|||
reqtype='get' |
|||
|
|||
# set the endpoint to call |
|||
reqval='/casManagement/servers/'+casserver+'/caslibs' |
|||
|
|||
#make the rest call using the callrestapi function. You can have one or many calls |
|||
caslib_result_json=callrestapi(reqval,reqtype) |
|||
|
|||
# example of overriding the columns for csv output |
|||
cols=['name','type','path','scope','attributes','description'] |
|||
|
|||
# print result accepts |
|||
# the json returned |
|||
# the output style |
|||
# optionally the columns for csv outtput, if you don't pass in columns you get defaults |
|||
|
|||
# You can just print results r post process the results as you need to |
|||
|
|||
printresult(caslib_result_json,output_style,cols) |
|||
|
|||
@ -0,0 +1,108 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# |
|||
# listcaslibsandeffectiveaccess.py |
|||
# January 2019 |
|||
# |
|||
# Usage: |
|||
# listcaslibsandeffectiveaccess.py [--noheader] [-d] |
|||
# |
|||
# Examples: |
|||
# |
|||
# 1. Return list of all effective access on all CAS libraries on all servers |
|||
# ./listcaslibsandeffectiveaccess.py |
|||
# |
|||
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the License); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
debug=False |
|||
|
|||
|
|||
# Import Python modules |
|||
import argparse |
|||
import sys |
|||
from sharedfunctions import callrestapi |
|||
|
|||
# Define exception handler so that we only output trace info from errors when in debug mode |
|||
def exception_handler(exception_type, exception, traceback, debug_hook=sys.excepthook): |
|||
if debug: |
|||
debug_hook(exception_type, exception, traceback) |
|||
else: |
|||
print "%s: %s" % (exception_type.__name__, exception) |
|||
|
|||
sys.excepthook = exception_handler |
|||
|
|||
identity_cols=['identity','identityType'] |
|||
permissions=['readInfo','select','limitedPromote','promote','createTable','dropTable','deleteSource','insert','update','delete','alterTable','alterCaslib','manageAccess'] |
|||
|
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("--noheader", action='store_true', help="Do not print the header row") |
|||
parser.add_argument("-d","--debug", action='store_true', help="Debug") |
|||
args = parser.parse_args() |
|||
noheader=args.noheader |
|||
debug=args.debug |
|||
|
|||
# Print header row unless noheader argument was specified |
|||
if not noheader: |
|||
print('server,caslib,'+','.join(map(str, identity_cols))+','+','.join(map(str, permissions))) |
|||
|
|||
endpoint='/casManagement/servers' |
|||
method='get' |
|||
|
|||
#make the rest call |
|||
serverlist_result_json=callrestapi(endpoint,method) |
|||
|
|||
if debug: |
|||
print(serverlist_result_json) |
|||
print('serverlist_result_json is a '+type(serverlist_result_json).__name__+' object') #serverlist_result_json is a dict object |
|||
|
|||
servers = serverlist_result_json['items'] |
|||
|
|||
for server in servers: |
|||
servername=server['name'] |
|||
|
|||
# List the caslibs in this server |
|||
endpoint='/casManagement/servers/'+servername+'/caslibs?excludeItemLinks=true' |
|||
method='get' |
|||
caslibs_result_json=callrestapi(endpoint,method) |
|||
if debug: |
|||
print(caslibs_result_json) |
|||
print('caslibs_result_json is a '+type(caslibs_result_json).__name__+' object') #caslibs_result_json is a dict object |
|||
caslibs=caslibs_result_json['items'] |
|||
|
|||
for caslib in caslibs: |
|||
caslibname=caslib['name'] |
|||
#print(servername+','+caslibname) |
|||
|
|||
# Get effective Access Controls on this caslib |
|||
endpoint='/casAccessManagement/servers/'+servername+'/caslibControls/'+caslibname+'?accessControlType=effective' |
|||
method='get' |
|||
caslibaccess_result_json=callrestapi(endpoint,method) |
|||
|
|||
#print(caslibaccess_result_json) |
|||
for ai in caslibaccess_result_json['items']: |
|||
output=servername+','+caslibname |
|||
for col in identity_cols: |
|||
if col in ai: |
|||
output=output+','+ai[col] |
|||
else: |
|||
output=output+',' |
|||
for col in permissions: |
|||
if col in ai: |
|||
output=output+','+ai[col] |
|||
else: |
|||
output=output+',' |
|||
print output |
|||
|
|||
@ -0,0 +1,109 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# |
|||
# listcastables.py |
|||
# January 2019 |
|||
# |
|||
# Usage: |
|||
# listcastables.py [--noheader] [-d] |
|||
# |
|||
# Examples: |
|||
# |
|||
# 1. Return list of all CAS tables in all CAS libraries on all servers |
|||
# ./listcastables.py |
|||
# |
|||
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the License); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
debug=False |
|||
|
|||
# Import Python modules |
|||
import argparse |
|||
import sys |
|||
from sharedfunctions import callrestapi |
|||
|
|||
# Define exception handler so that we only output trace info from errors when in debug mode |
|||
def exception_handler(exception_type, exception, traceback, debug_hook=sys.excepthook): |
|||
if debug: |
|||
debug_hook(exception_type, exception, traceback) |
|||
else: |
|||
print "%s: %s" % (exception_type.__name__, exception) |
|||
|
|||
sys.excepthook = exception_handler |
|||
|
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("--noheader", action='store_true', help="Do not print the header row") |
|||
parser.add_argument("-d","--debug", action='store_true', help="Debug") |
|||
args = parser.parse_args() |
|||
noheader=args.noheader |
|||
debug=args.debug |
|||
|
|||
# Print header row unless noheader argument was specified |
|||
if not noheader: |
|||
print('server,caslib,table') |
|||
|
|||
endpoint='/casManagement/servers' |
|||
method='get' |
|||
|
|||
#make the rest call |
|||
serverlist_result_json=callrestapi(endpoint,method) |
|||
|
|||
if debug: |
|||
print(serverlist_result_json) |
|||
print('serverlist_result_json is a '+type(serverlist_result_json).__name__+' object') #serverlist_result_json is a dict object |
|||
|
|||
servers = serverlist_result_json['items'] |
|||
|
|||
for server in servers: |
|||
servername=server['name'] |
|||
#print(servername) |
|||
|
|||
# List the caslibs in this server |
|||
endpoint='/casManagement/servers/'+servername+'/caslibs?excludeItemLinks=true' |
|||
method='get' |
|||
caslibs_result_json=callrestapi(endpoint,method) |
|||
if debug: |
|||
print(caslibs_result_json) |
|||
print('caslibs_result_json is a '+type(caslibs_result_json).__name__+' object') #caslibs_result_json is a dict object |
|||
caslibs=caslibs_result_json['items'] |
|||
|
|||
for caslib in caslibs: |
|||
caslibname=caslib['name'] |
|||
#print('a: '+servername+','+caslibname) |
|||
|
|||
# List the tables in the caslib |
|||
endpoint='/casManagement/servers/'+servername+'/caslibs/'+caslibname+'/tables?excludeItemLinks=true' |
|||
method='get' |
|||
#print('about to list tables') |
|||
|
|||
tables_result_json=callrestapi(endpoint,method,stoponerror=False) |
|||
|
|||
if debug: |
|||
print(tables_result_json) |
|||
print('tables_result_json is a '+type(tables_result_json).__name__+' object') #tables_result_json is a dict object |
|||
if tables_result_json is not None: |
|||
if tables_result_json['count']==0: |
|||
print(servername+','+caslibname+',[0 tables]') |
|||
if 'items' not in tables_result_json: |
|||
print(servername+','+caslibname+','+tables_result_json['message']) |
|||
else: |
|||
tables=tables_result_json['items'] |
|||
|
|||
for table in tables: |
|||
tablename=table['name'] |
|||
print(servername+','+caslibname+','+tablename) |
|||
else: |
|||
#tables_result_json is None |
|||
print(servername+','+caslibname+',[error getting tables]') |
|||
@ -0,0 +1,130 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# |
|||
# listcastablesandeffectiveaccess.py |
|||
# January 2019 |
|||
# |
|||
# Usage: |
|||
# listcastablesandeffectiveaccess.py [--noheader] [-d] |
|||
# |
|||
# Examples: |
|||
# |
|||
# 1. Return list of all effective access on all CAS tables in all CAS libraries on all servers |
|||
# ./listcastablesandeffectiveaccess.py |
|||
# |
|||
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the License); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
debug=False |
|||
|
|||
|
|||
# Import Python modules |
|||
import argparse |
|||
import sys |
|||
from sharedfunctions import callrestapi |
|||
|
|||
# Define exception handler so that we only output trace info from errors when in debug mode |
|||
def exception_handler(exception_type, exception, traceback, debug_hook=sys.excepthook): |
|||
if debug: |
|||
debug_hook(exception_type, exception, traceback) |
|||
else: |
|||
print "%s: %s" % (exception_type.__name__, exception) |
|||
|
|||
sys.excepthook = exception_handler |
|||
|
|||
identity_cols=['identity','identityType'] |
|||
permissions=['readInfo','select','limitedPromote','promote','createTable','dropTable','deleteSource','insert','update','delete','alterTable','alterCaslib','manageAccess'] |
|||
|
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("--noheader", action='store_true', help="Do not print the header row") |
|||
parser.add_argument("-d","--debug", action='store_true', help="Debug") |
|||
args = parser.parse_args() |
|||
noheader=args.noheader |
|||
debug=args.debug |
|||
|
|||
# Print header row unless noheader argument was specified |
|||
if not noheader: |
|||
print('server,caslib,table,'+','.join(map(str, identity_cols))+','+','.join(map(str, permissions))) |
|||
|
|||
endpoint='/casManagement/servers' |
|||
method='get' |
|||
|
|||
#make the rest call |
|||
serverlist_result_json=callrestapi(endpoint,method) |
|||
|
|||
if debug: |
|||
print(serverlist_result_json) |
|||
print('serverlist_result_json is a '+type(serverlist_result_json).__name__+' object') #serverlist_result_json is a dict object |
|||
|
|||
servers = serverlist_result_json['items'] |
|||
|
|||
for server in servers: |
|||
servername=server['name'] |
|||
|
|||
# List the caslibs in this server |
|||
endpoint='/casManagement/servers/'+servername+'/caslibs?excludeItemLinks=true' |
|||
method='get' |
|||
caslibs_result_json=callrestapi(endpoint,method) |
|||
if debug: |
|||
print(caslibs_result_json) |
|||
print('caslibs_result_json is a '+type(caslibs_result_json).__name__+' object') #caslibs_result_json is a dict object |
|||
caslibs=caslibs_result_json['items'] |
|||
|
|||
for caslib in caslibs: |
|||
caslibname=caslib['name'] |
|||
#print(servername+','+caslibname) |
|||
|
|||
# Get the tables in the caslib |
|||
endpoint='/casManagement/servers/'+servername+'/caslibs/'+caslibname+'/tables?excludeItemLinks=true' |
|||
method='get' |
|||
#print('about to list tables') |
|||
|
|||
tables_result_json=callrestapi(endpoint,method,stoponerror=False) |
|||
|
|||
if debug: |
|||
print(tables_result_json) |
|||
print('tables_result_json is a '+type(tables_result_json).__name__+' object') #tables_result_json is a dict object |
|||
if tables_result_json is not None: |
|||
if tables_result_json['count']==0: |
|||
print(servername+','+caslibname+',[0 tables]') |
|||
if 'items' not in tables_result_json: |
|||
print(servername+','+caslibname+','+tables_result_json['message']) |
|||
else: |
|||
tables=tables_result_json['items'] |
|||
for table in tables: |
|||
tablename=table['name'] |
|||
# Get effective Access Controls on this table |
|||
endpoint='/casAccessManagement/servers/'+servername+'/caslibs/'+caslibname+'/tableControls/'+tablename+'?accessControlType=effective' |
|||
method='get' |
|||
tableaccess_result_json=callrestapi(endpoint,method) |
|||
|
|||
#print(tableaccess_result_json) |
|||
for ai in tableaccess_result_json['items']: |
|||
output=servername+','+caslibname+','+tablename |
|||
for col in identity_cols: |
|||
if col in ai: |
|||
output=output+','+ai[col] |
|||
else: |
|||
output=output+',' |
|||
for col in permissions: |
|||
if col in ai: |
|||
output=output+','+ai[col] |
|||
else: |
|||
output=output+',' |
|||
print output |
|||
else: |
|||
#tables_result_json is None |
|||
print(servername+','+caslibname+',[error getting tables]') |
|||
|
|||
@ -0,0 +1,91 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# |
|||
# listgroupsandmembers.py |
|||
# January 2019 |
|||
# |
|||
# Usage: |
|||
# listgroupsandmembers.py [--noheader] [-d] |
|||
# |
|||
# Examples: |
|||
# |
|||
# 1. Return list of all groups and all their members |
|||
# ./listgroupsandmembers.py |
|||
# |
|||
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the License); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
debug=False |
|||
|
|||
# Import Python modules |
|||
import argparse |
|||
import sys |
|||
from sharedfunctions import callrestapi |
|||
|
|||
# Define exception handler so that we only output trace info from errors when in debug mode |
|||
def exception_handler(exception_type, exception, traceback, debug_hook=sys.excepthook): |
|||
if debug: |
|||
debug_hook(exception_type, exception, traceback) |
|||
else: |
|||
print "%s: %s" % (exception_type.__name__, exception) |
|||
|
|||
sys.excepthook = exception_handler |
|||
|
|||
parser = argparse.ArgumentParser() |
|||
parser.add_argument("--noheader", action='store_true', help="Do not print the header row") |
|||
parser.add_argument("-d","--debug", action='store_true', help="Debug") |
|||
args = parser.parse_args() |
|||
noheader=args.noheader |
|||
debug=args.debug |
|||
|
|||
# Print header row unless noheader argument was specified |
|||
if not noheader: |
|||
print('groupid,groupname,grouptype,groupproviderid,memberid,membername,membertype,memberproviderid') |
|||
|
|||
endpoint='/identities/groups' |
|||
method='get' |
|||
|
|||
#make the rest call |
|||
groupslist_result_json=callrestapi(endpoint,method) |
|||
|
|||
if debug: |
|||
print(groupslist_result_json) |
|||
print('groupslist_result_json is a '+type(groupslist_result_json).__name__+' object') #groupslist_result_json is a dict object |
|||
|
|||
groups = groupslist_result_json['items'] |
|||
|
|||
for group in groups: |
|||
groupid=group['id'] |
|||
groupname=group['name'] |
|||
grouptype=group['type'] |
|||
groupproviderid=group['providerId'] |
|||
|
|||
# List the members of this group |
|||
endpoint='/identities/groups/'+groupid+'/members' |
|||
method='get' |
|||
members_result_json=callrestapi(endpoint,method) |
|||
if debug: |
|||
print(members_result_json) |
|||
print('members_result_json is a '+type(members_result_json).__name__+' object') #members_result_json is a dict object |
|||
|
|||
members=members_result_json['items'] |
|||
|
|||
for member in members: |
|||
memberid=member['id'] |
|||
membername=member['name'] |
|||
membertype=member['type'] |
|||
memberproviderid=member['providerId'] |
|||
|
|||
print(groupid+','+groupname+','+grouptype+','+groupproviderid+','+memberid+','+membername+','+membertype+','+memberproviderid) |
|||
Loading…
Reference in new issue