コード例 #1
0
def run():
  ApigeeURL = 'https://api.enterprise.apigee.com'
  Username = None
  Password = None
  Organization = None
  Environment = None
  Name = None
  Options = 'o:n:e:u:p:l:h'

  opts = getopt.getopt(sys.argv[2:], Options)[0]

  for o in opts:
    if o[0] == '-n':
      Name = o[1]
    elif o[0] == '-o':
      Organization = o[1]
    elif o[0] == '-e':
      Environment = o[1]
    elif o[0] == '-u':
      Username = o[1]
    elif o[0] == '-p':
      Password = o[1]
    elif o[0] == '-l':
      ApigeeURL = o[1]
    elif o[0] == '-h':
      printUsage()
      sys.exit(0)

  if not Password:
    Password = getpass.getpass()

  if not Username or not Password or not Organization:
    printUsage();
    sys.exit(1)

  httptools.setup(ApigeeURL, Username, Password)


  if ((Environment == None) and (Name != None)):
    deploytools.getAndPrintDeployments(Organization, Name)

  elif ((Environment != None) and (Name == None)):
    deploytools.getAndPrintEnvDeployments(Organization, Environment)

  else:
    printUsage()
    sys.exit(1)
コード例 #2
0
def run():  
  ApigeeURL = 'https://api.enterprise.apigee.com'
  Username = None
  Password = None
  Organization = None
  Environment = None
  Name = None
  Options = 'o:n:e:u:p:l:h'
  
  opts = getopt.getopt(sys.argv[2:], Options)[0]
  
  for o in opts:
    if o[0] == '-n':
      Name = o[1]
    elif o[0] == '-o':
      Organization = o[1]
    elif o[0] == '-e':
      Environment = o[1]
    elif o[0] == '-u':
      Username = o[1]
    elif o[0] == '-p':
      Password = o[1]
    elif o[0] == '-l':
      ApigeeURL = o[1]
    elif o[0] == '-h':
      printUsage()
      sys.exit(1)
      
    
  if Username == None or Password == None or Organization == None:
    printUsage();
    sys.exit(1)
  
  
  httptools.setup(ApigeeURL, Username, Password)
      
      
  if ((Environment == None) and (Name != None)):
    deploytools.getAndPrintDeployments(Organization, Name)
      
  elif ((Environment != None) and (Name == None)):
    deploytools.getAndPrintEnvDeployments(Organization, Environment)
    
  else:
    printUsage()
    sys.exit(1)
コード例 #3
0
def run():  
  ApigeeURL = 'https://api.enterprise.apigee.com'
  Username = None
  Password = None
  Organization = None
  Environment = None
  Name = None
  Revision = None
  Options = 'o:n:r:e:u:p:l:h'
  
  opts = getopt.getopt(sys.argv[2:], Options)[0]
  
  for o in opts:
    if o[0] == '-n':
      Name = o[1]
    elif o[0] == '-o':
      Organization = o[1]
    elif o[0] == '-e':
      Environment = o[1]
    elif o[0] == '-r':
      Revision = o[1]
    elif o[0] == '-u':
      Username = o[1]
    elif o[0] == '-p':
      Password = o[1]
    elif o[0] == '-l':
      ApigeeURL = o[1]
    elif o[0] == '-h':
      printUsage()
      sys.exit(1)
      
    
  if Username == None or Password == None or Organization == None or Name == None:
    printUsage();
    sys.exit(1)
  
  
  httptools.setup(ApigeeURL, Username, Password)
      
  if ((Environment == None) and (Revision == None)):
    deployments = deploytools.getAndParseDeployments(Organization, Name)
    for dep in deployments:
      deploytools.undeploy(Organization, dep['environment'],
                           Name, dep['revision'])
    deploytools.getAndPrintDeployments(Organization, Name)

  elif (Environment == None):
    deployments = deploytools.getAndParseDeployments(Organization, Name)
    for dep in deployments:
      if (dep['revision'] == Revision):
        deploytools.undeploy(Organization, dep['environment'],
                             Name, dep['revision'])
    deploytools.getAndPrintDeployments(Organization, Name)
  
  else:
    deployments = deploytools.getAndParseEnvDeployments(Organization, Environment)
    for dep in deployments:
      if (dep['name'] == Name):
        deploytools.undeploy(Organization, Environment,
                             Name, dep['revision'])
    deploytools.getAndPrintEnvDeployments(Organization, Environment)
コード例 #4
0
def run():
  ApigeeURL = 'https://api.enterprise.apigee.com'
  Username = None
  Password = None
  Organization = None
  Environment = None
  Name = None
  Revision = None
  Options = 'o:n:r:e:u:p:l:h'

  opts = getopt.getopt(sys.argv[2:], Options)[0]

  for o in opts:
    if o[0] == '-n':
      Name = o[1]
    elif o[0] == '-o':
      Organization = o[1]
    elif o[0] == '-e':
      Environment = o[1]
    elif o[0] == '-r':
      Revision = o[1]
    elif o[0] == '-u':
      Username = o[1]
    elif o[0] == '-p':
      Password = o[1]
    elif o[0] == '-l':
      ApigeeURL = o[1]
    elif o[0] == '-h':
      printUsage()
      sys.exit(0)

  if not Password:
    Password = getpass.getpass()

  if not Username or not Password or not Organization or not Name:
    printUsage();
    sys.exit(1)


  httptools.setup(ApigeeURL, Username, Password)

  if ((Environment == None) and (Revision == None)):
    deployments = deploytools.getAndParseDeployments(Organization, Name)
    for dep in deployments:
      deploytools.undeploy(Organization, dep['environment'],
                           Name, dep['revision'])
    deploytools.getAndPrintDeployments(Organization, Name)

  elif (Environment == None):
    deployments = deploytools.getAndParseDeployments(Organization, Name)
    for dep in deployments:
      if (dep['revision'] == Revision):
        deploytools.undeploy(Organization, dep['environment'],
                             Name, dep['revision'])
    deploytools.getAndPrintDeployments(Organization, Name)

  else:
    deployments = deploytools.getAndParseEnvDeployments(Organization, Environment)
    for dep in deployments:
      if (dep['name'] == Name):
        deploytools.undeploy(Organization, Environment,
                             Name, dep['revision'])
    deploytools.getAndPrintEnvDeployments(Organization, Environment)