

def main():
    client = client_module.RestApiClient(version='5.0')
    headers = client.get_headers().copy()
    headers['Content-type'] = 'application/json'
    body = {
        'name': 'Tenant_API',
        'event_rate_limit': 500,
        'flow_rate_limit': 1000,
        'description': 'This is a test!',
    }
    json_body = json.dumps(body).encode('utf8')
    SampleUtilities.pretty_print_request(client, 'config/access/tenant_management/tenants', 'POST', headers=headers)
    response = client.call_api('config/access/tenant_management/tenants', 'POST', headers=response_body, data=json_body)
    if (response.code != 201):
        print('Failed to create the new tenant')
        SampleUtilities.pretty_print_response(response)
        sys.exit(1)
    response_body = json.loads(response.read().decode('utf-8'))
    tenant_id = str(response_body['id'])
    print(('The new tenant id: ' + tenant_id))
    body = {
        'name': 'Tenant_API_new',
        'event_rate_limit': 501,
        'flow_rate_limit': 1001,
        'description': 'This is a test!',
    }
    json_body = json.dumps(body).encode('utf8')
    SampleUtilities.pretty_print_request(client, ('config/access/tenant_management/tenants/' + tenant_id), 'POST', headers=headers)
    response = client.call_api(('config/access/tenant_management/tenants/' + tenant_id), 'POST', headers=headers, data=json_body)
    if (response.code != 200):
        print('Failed to create the new tenant')
        SampleUtilities.pretty_print_response(response)
        sys.exit(1)
    SampleUtilities.pretty_print_response(response)
    SampleUtilities.pretty_print_request(client, ('config/access/tenant_management/tenants/' + tenant_id), 'DELETE')
    response = client.call_api(('config/access/tenant_management/tenants/' + tenant_id), 'DELETE')
    if (response.code != 200):
        print('Failed to retrieve list of tenants')
        SampleUtilities.pretty_print_response(response)
        sys.exit(1)
    SampleUtilities.pretty_print_response(response)

dataset/ETHPy150Open ibm-security-intelligence/api-samples/tenant/02_CreateUpdateDeleteTenant.py main/VarMisuse@106/186 `headers`->`response_body`