|
@@ -1,5 +1,30 @@
|
|
|
#!/usr/bin/env python3
|
|
|
+#
|
|
|
+# Copyright (c) 2017-2020 Joe Clarke <jclarke@cisco.com>
|
|
|
+# All rights reserved.
|
|
|
+#
|
|
|
+# Redistribution and use in source and binary forms, with or without
|
|
|
+# modification, are permitted provided that the following conditions
|
|
|
+# are met:
|
|
|
+# 1. Redistributions of source code must retain the above copyright
|
|
|
+# notice, this list of conditions and the following disclaimer.
|
|
|
+# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
+# notice, this list of conditions and the following disclaimer in the
|
|
|
+# documentation and/or other materials provided with the distribution.
|
|
|
+#
|
|
|
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
+# SUCH DAMAGE.
|
|
|
|
|
|
+from __future__ import print_function
|
|
|
import sys
|
|
|
import json
|
|
|
from argparse import ArgumentParser
|
|
@@ -7,18 +32,13 @@ from sparker import Sparker, ResourceType
|
|
|
|
|
|
|
|
|
def main():
|
|
|
- parser = ArgumentParser(description='Usage: ')
|
|
|
-
|
|
|
- parser.add_argument('-S', '--source-team', type=str,
|
|
|
- help='Name of the source Team of the Room')
|
|
|
- parser.add_argument('-s', '--source-room', type=str,
|
|
|
- help='Name of the source Room')
|
|
|
- parser.add_argument('-D', '--dest-team', type=str,
|
|
|
- help='Name of the destination Team of the Room')
|
|
|
- parser.add_argument('-d', '--dest-room', type=str,
|
|
|
- help='Name of the destination Room')
|
|
|
- parser.add_argument('-t', '--token', type=str,
|
|
|
- help='Webex Teams Token', required=True)
|
|
|
+ parser = ArgumentParser(description="Usage: ")
|
|
|
+
|
|
|
+ parser.add_argument("-S", "--source-team", type=str, help="Name of the source Team of the Room")
|
|
|
+ parser.add_argument("-s", "--source-room", type=str, help="Name of the source Room")
|
|
|
+ parser.add_argument("-D", "--dest-team", type=str, help="Name of the destination Team of the Room")
|
|
|
+ parser.add_argument("-d", "--dest-room", type=str, help="Name of the destination Room")
|
|
|
+ parser.add_argument("-t", "--token", type=str, help="Webex Teams Token", required=True)
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
spark = Sparker(token=args.token)
|
|
@@ -31,12 +51,12 @@ def main():
|
|
|
resource = args.source_room
|
|
|
type = ResourceType.ROOM
|
|
|
else:
|
|
|
- print('ERROR: Either a source Room or source Team must be specified')
|
|
|
+ print("ERROR: Either a source Room or source Team must be specified")
|
|
|
sys.exit(1)
|
|
|
|
|
|
members = spark.get_members(resource, type)
|
|
|
if not members:
|
|
|
- print('ERROR: Failed to get members')
|
|
|
+ print("ERROR: Failed to get members")
|
|
|
sys.exit(1)
|
|
|
|
|
|
if args.dest_team:
|
|
@@ -46,13 +66,13 @@ def main():
|
|
|
resource = args.dest_room
|
|
|
type = ResourceType.ROOM
|
|
|
else:
|
|
|
- print('ERROR: Either a destination Room or destination Team must be specified')
|
|
|
+ print("ERROR: Either a destination Room or destination Team must be specified")
|
|
|
sys.exit(1)
|
|
|
|
|
|
if not spark.add_members(members, resource, type):
|
|
|
- print('ERROR: Failed to add one or more members')
|
|
|
+ print("ERROR: Failed to add one or more members")
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
-if __name__ == '__main__':
|
|
|
+if __name__ == "__main__":
|
|
|
main()
|