示例#1
0
def delete_tenant(tenant_id):
    if is_minicloud():
        tenant_url = sc_nd_tenant_base + tenant_id
        response = delete(tenant_url, data=None)
        # allow 404 -- not found -- in this path
        if (response.status_code != codes.ok and
                response.status_code != codes.not_found):
            raise IllegalStateException('Delete tenant failed.')
示例#2
0
def delete_tier():
    if is_minicloud():
        tier_url = sc_tier_base + tier_name
        response = delete(tier_url, data=None)
        # allow 404 -- not found -- in this path
        if (response.status_code != codes.ok and
                response.status_code != codes.not_found):
            raise IllegalStateException('Delete tier failed.')
示例#3
0
 def get_service_access_token(self):
     try:
         at = self._build_andc_access_token(
             self._ks_tenant_id, self._ks_user_id, self._ks_client_id,
             self._ks_entitlement_id, self._ks_expires_in)
         return at
     except Exception as e:
         raise IllegalStateException(
             'Error getting ANDC access token: ', str(e))
示例#4
0
 def get_account_access_token(self):
     try:
         at = self._build_psm_access_token(
             self._ks_tenant_id, self._ks_user_id, self._ks_client_id,
             self._ks_expires_in)
         return at
     except Exception as e:
         raise IllegalStateException(
             'Error getting PSM access token: ', str(e))
示例#5
0
def add_tier():
    if is_minicloud():
        tier_url = sc_tier_base + tier_name
        limits = {"version": 1, "numTables": 10, "tenantSize": 5000,
                  "tenantReadUnits": 100000, "tenantWriteUnits": 40000,
                  "tableSize": 5000, "tableReadUnits": 40000,
                  "tableWriteUnits": 20000, "indexesPerTable": 5,
                  "columnsPerTable": 20, "ddlRequestsRate": 400,
                  "tableLimitReductionsRate": 4, "schemaEvolutions": 6}
        response = post(tier_url, json=limits)
        if response.status_code != codes.ok:
            raise IllegalStateException('Add tier failed.')
示例#6
0
def add_tenant(tenant_id):
    if is_minicloud():
        tenant_url = sc_nd_tenant_base + tenant_id + '/' + tier_name
        response = post(tenant_url)
        if response.status_code != codes.ok:
            raise IllegalStateException('Add tenant failed.')