コード例 #1
0
    def post(self):
        """
    Call site verification service with token.

    Call the site verification service and see if the
    token has been fulfilled (e.g. a dns entry added)
    """

        verification_type = self.json_data.get("verificationType")
        verification_identifier = self.json_data.get("verificationIdentifier")
        verification_method = self.json_data.get("verificationMethod")

        service = build(serviceName="siteVerification",
                        version="v1",
                        http=get_authorized_http())

        # try to do a verification,
        # which will test the method on the Google server side.
        service.webResource().insert(verificationMethod=verification_method,
                                     body={
                                         'site': {
                                             'type': verification_type,
                                             'identifier':
                                             verification_identifier
                                         },
                                         'verificationMethod':
                                         verification_method
                                     }).execute(num_retries=5)
コード例 #2
0
    def post(self):
        '''
    Call the site verification api and fetch the token value.
    '''

        # establish default values.
        verification_type = self.json_data['verificationType']
        identifier = self.json_data['verificationIdentifier']
        verification_method = self.json_data['verificationMethod']

        # build the site verification service.
        service = build(serviceName="siteVerification",
                        version="v1",
                        http=get_authorized_http())

        # fetch a verification token.
        response = service.webResource().getToken(
            body={
                'site': {
                    'type': verification_type,
                    'identifier': identifier
                },
                'verificationMethod': verification_method
            }).execute(num_retries=5)

        return {
            'verificationToken': response['token'],
            'verificationType': verification_type,
            'verificationMethod': verification_method,
            'verificationIdentifier': identifier
        }
コード例 #3
0
ファイル: buyflow.py プロジェクト: google/gfw-deployments
  def post(self):
    domain = self.json_data['domain']
    numberOfSeats = self.json_data['numberOfSeats']
    skuId = self.json_data['skuId']
    planName = self.json_data['planName']
    renewalType = self.json_data['renewalType']
    purchaseOrderId = self.json_data['purchaseOrderId']
    
    service = build(serviceName="reseller",
                    version=settings.RESELLER_API_VERSION,
                    http=get_authorized_http())

    response = service.subscriptions().insert(
      customerId=domain,
      body={
        'customerId': domain,
        'skuId': skuId,
        'plan': {
          'planName': planName,
        },
        'seats': {
          'numberOfSeats': numberOfSeats,
          'maximumNumberOfSeats': numberOfSeats
        },
        'renewalSettings': {
          'renewalType': renewalType
        },
        'purchaseOrderId': purchaseOrderId
      }).execute(num_retries=5)

    return response
コード例 #4
0
ファイル: buyflow.py プロジェクト: google/gfw-deployments
  def post(self):
    domain = self.json_data['domain']
    alternate_email = self.json_data['alternateEmail']
    phone_number = self.json_data['phoneNumber']
    contact_name = self.json_data['postalAddress.contactName']
    organization_name = self.json_data['postalAddress.organizationName']
    locality = self.json_data['postalAddress.locality']
    country_code = self.json_data['postalAddress.countryCode']
    region = self.json_data['postalAddress.region']
    postal_code = self.json_data['postalAddress.postalCode']
    address_line_1 = self.json_data['postalAddress.addressLine1']
    address_line_2 = self.json_data['postalAddress.addressLine2']

    service = build(serviceName="reseller",
                    version=settings.RESELLER_API_VERSION,
                    http=get_authorized_http())

    # test to see if the customer exists already.
    try:
      method = service.customers().get(
        customerId=domain).execute(num_retries=5)

      # call was successful, meaning the customer already exists, throw exception.
      raise Exception("That customer already exists")
    except HttpError, e:
      if int(e.resp['status']) == 404:
        pass
      else:
        # possible 500 error?
        raise
コード例 #5
0
    def post(self):
        domain = self.json_data['domain']
        username = "******" % domain
        password = "******"

        service = build(serviceName="admin",
                        version="directory_v1",
                        http=get_authorized_http())

        # create the user.
        service.users().insert(
            body={
                'primaryEmail': username,
                'name': {
                    'givenName': 'Admin',
                    'familyName': 'Admin',
                    'fullName': 'Admin Admin'
                },
                'suspended': False,
                'password': password
            }).execute(num_retries=5)

        # make the user a super admin.
        service.users().makeAdmin(userKey=username, body={
            'status': True
        }).execute(num_retries=5)

        return {'domain': domain, 'username': username, 'password': password}
コード例 #6
0
  def post(self):
    domain = self.json_data['domain']
    numberOfSeats = self.json_data['numberOfSeats']

    service = build(serviceName="reseller",
                    version=settings.RESELLER_API_VERSION,
                    http=get_authorized_http())

    response = service.subscriptions().insert(
      customerId=domain,
      body={
        'customerId': domain,
        'subscriptionId': "%s-apps" % domain,
        'skuId': ResellerSKU.GoogleApps,
        'plan': {
          'planName': ResellerPlanName.Flexible,
        },
        'seats': {
          'numberOfSeats': numberOfSeats,
          'maximumNumberOfSeats': numberOfSeats
        },
        'renewalSettings': {
          'renewalType': ResellerRenewalType.PayAsYouGo
        },
        'purchaseOrderId': 'G00gl39001'
      }).execute(num_retries=5)

    return response
コード例 #7
0
    def post(self):
        domain = self.json_data['domain']
        alternate_email = self.json_data['alternateEmail']
        phone_number = self.json_data['phoneNumber']
        contact_name = self.json_data['postalAddress.contactName']
        organization_name = self.json_data['postalAddress.organizationName']
        locality = self.json_data['postalAddress.locality']
        country_code = self.json_data['postalAddress.countryCode']
        region = self.json_data['postalAddress.region']
        postal_code = self.json_data['postalAddress.postalCode']
        address_line_1 = self.json_data['postalAddress.addressLine1']
        address_line_2 = self.json_data['postalAddress.addressLine2']

        service = build(serviceName="reseller",
                        version=settings.RESELLER_API_VERSION,
                        http=get_authorized_http())

        # test to see if the customer exists already.
        try:
            method = service.customers().get(customerId=domain).execute(
                num_retries=5)

            # call was successful, meaning the customer already exists, throw exception.
            raise Exception("That customer already exists")
        except HttpError, e:
            if int(e.resp['status']) == 404:
                pass
            else:
                # possible 500 error?
                raise
コード例 #8
0
  def post(self):
    """
    Call site verification service with token.

    Call the site verification service and see if the
    token has been fulfilled (e.g. a dns entry added)
    """

    verification_type = self.json_data.get("verificationType")
    verification_identifier = self.json_data.get("verificationIdentifier")
    verification_method = self.json_data.get("verificationMethod")

    service = build(serviceName="siteVerification",
                    version="v1",
                    http=get_authorized_http())

    # try to do a verification,
    # which will test the method on the Google server side.
    service.webResource().insert(
      verificationMethod=verification_method,
      body={
        'site': {
          'type': verification_type,
          'identifier': verification_identifier
        },
        'verificationMethod': verification_method
      }
    ).execute(num_retries=5)
コード例 #9
0
  def post(self):
    domain = self.json_data['domain']
    username = "******" % domain
    password = "******"

    service = build(serviceName="admin",
                    version="directory_v1",
                    http=get_authorized_http())

    # create the user.
    service.users().insert(body={
      'primaryEmail': username,
      'name': {
        'givenName': 'Admin',
        'familyName': 'Admin',
        'fullName': 'Admin Admin'
      },
      'suspended': False,
      'password': password
    }).execute(num_retries=5)

    # make the user a super admin.
    service.users().makeAdmin(
      userKey=username,
      body={
        'status': True
      }).execute(num_retries=5)

    return {
      'domain': domain,
      'username': username,
      'password': password
    }
コード例 #10
0
  def post(self):
    '''
    Call the site verification api and fetch the token value.
    '''

    # establish default values.
    verification_type = self.json_data['verificationType']
    identifier = self.json_data['verificationIdentifier']
    verification_method = self.json_data['verificationMethod']

    # build the site verification service.
    service = build(serviceName="siteVerification",
                    version="v1",
                    http=get_authorized_http())

    # fetch a verification token.
    response = service.webResource().getToken(body={
      'site': {
        'type': verification_type,
        'identifier': identifier
      },
      'verificationMethod': verification_method
    }).execute(num_retries=5)

    return {
      'verificationToken': response['token'],
      'verificationType': verification_type,
      'verificationMethod': verification_method,
      'verificationIdentifier': identifier
    }
コード例 #11
0
    def post(self):
        domain = self.json_data['domain']
        numberOfSeats = self.json_data['numberOfSeats']

        service = build(serviceName="reseller",
                        version=settings.RESELLER_API_VERSION,
                        http=get_authorized_http())

        response = service.subscriptions().insert(
            customerId=domain,
            body={
                'customerId': domain,
                'subscriptionId': "%s-apps" % domain,
                'skuId': ResellerSKU.GoogleApps,
                'plan': {
                    'planName': ResellerPlanName.Flexible,
                },
                'seats': {
                    'numberOfSeats': numberOfSeats,
                    'maximumNumberOfSeats': numberOfSeats
                },
                'renewalSettings': {
                    'renewalType': ResellerRenewalType.PayAsYouGo
                },
                'purchaseOrderId': 'G00gl39001'
            }).execute(num_retries=5)

        return response
コード例 #12
0
    def post(self):
        domain = self.json_data['domain']
        numberOfSeats = self.json_data['numberOfSeats']
        skuId = self.json_data['skuId']
        planName = self.json_data['planName']
        renewalType = self.json_data['renewalType']
        purchaseOrderId = self.json_data['purchaseOrderId']

        service = build(serviceName="reseller",
                        version=settings.RESELLER_API_VERSION,
                        http=get_authorized_http())

        response = service.subscriptions().insert(
            customerId=domain,
            body={
                'customerId': domain,
                'skuId': skuId,
                'plan': {
                    'planName': planName,
                },
                'seats': {
                    'numberOfSeats': numberOfSeats,
                    'maximumNumberOfSeats': numberOfSeats
                },
                'renewalSettings': {
                    'renewalType': renewalType
                },
                'purchaseOrderId': purchaseOrderId
            }).execute(num_retries=5)

        return response
コード例 #13
0
  def post(self):
    domain = self.json_data['domain']

    service = build(serviceName="licensing",
                    version='v1',
                    http=get_authorized_http())

    service.licenseAssignments().insert(
      productId=ResellerProduct.GoogleDrive,
      skuId=ResellerSKU.GoogleDriveStorage20GB,
      body={
        'userId': 'admin@%s' % domain
      }).execute(num_retries=5)
コード例 #14
0
    def post(self):
        domain = self.json_data['domain']

        service = build(serviceName="licensing",
                        version='v1',
                        http=get_authorized_http())

        service.licenseAssignments().insert(
            productId=ResellerProduct.GoogleDrive,
            skuId=ResellerSKU.GoogleDriveStorage20GB,
            body={
                'userId': 'admin@%s' % domain
            }).execute(num_retries=5)
コード例 #15
0
    def post(self):
        domain = self.json_data['domain']
        alternate_email = self.json_data['alternateEmail']
        phone_number = self.json_data['phoneNumber']
        contact_name = self.json_data['postalAddress.contactName']
        organization_name = self.json_data['postalAddress.organizationName']
        locality = self.json_data['postalAddress.locality']
        country_code = self.json_data['postalAddress.countryCode']
        region = self.json_data['postalAddress.region']
        postal_code = self.json_data['postalAddress.postalCode']
        address_line_1 = self.json_data['postalAddress.addressLine1']

        service = build(serviceName="reseller",
                        version=settings.RESELLER_API_VERSION,
                        http=get_authorized_http())

        try:
            method = service.customers().get(customerId=domain).execute()
            raise Exception("That customer already exists")
        except HttpError, e:
            if int(e.resp['status']) != 404:
                raise
コード例 #16
0
  def post(self):
    domain = self.json_data['domain']
    alternate_email = self.json_data['alternateEmail']
    phone_number = self.json_data['phoneNumber']
    contact_name = self.json_data['postalAddress.contactName']
    organization_name = self.json_data['postalAddress.organizationName']
    locality = self.json_data['postalAddress.locality']
    country_code = self.json_data['postalAddress.countryCode']
    region = self.json_data['postalAddress.region']
    postal_code = self.json_data['postalAddress.postalCode']
    address_line_1 = self.json_data['postalAddress.addressLine1']

    service = build(serviceName="reseller",
                    version=settings.RESELLER_API_VERSION,
                    http=get_authorized_http())

    try:
      method = service.customers().get(customerId=domain).execute()
      raise Exception("That customer already exists")
    except HttpError, e:
      if int(e.resp['status']) != 404:
        raise
コード例 #17
0
  def post(self):
    domain = self.json_data['domain']

    service = build(serviceName="reseller",
                    version=settings.RESELLER_API_VERSION,
                    http=get_authorized_http())

    response = service.subscriptions().insert(
      customerId=domain,
      body={
        'customerId': domain,
        'skuId': ResellerSKU.GoogleDriveStorage20GB,
        'plan': {
          'planName': ResellerPlanName.Flexible
        },
        'seats': {
          'numberOfSeats': 5,
          'maximumNumberOfSeats': 5,
        },
        'purchaseOrderId': 'G00gl39001-d20'
      }).execute(num_retries=5)

    return response
コード例 #18
0
    def post(self):
        domain = self.json_data['domain']

        service = build(serviceName="reseller",
                        version=settings.RESELLER_API_VERSION,
                        http=get_authorized_http())

        response = service.subscriptions().insert(
            customerId=domain,
            body={
                'customerId': domain,
                'skuId': ResellerSKU.GoogleDriveStorage20GB,
                'plan': {
                    'planName': ResellerPlanName.Flexible
                },
                'seats': {
                    'numberOfSeats': 5,
                    'maximumNumberOfSeats': 5,
                },
                'purchaseOrderId': 'G00gl39001-d20'
            }).execute(num_retries=5)

        return response