Example #1
0
async def _post(params, session):
    accepted_fields = [
        "description",
        "extendable",
        "holderTenantId",
        "isDefault",
        "name",
        "ownerTenantId",
        "parentId",
        "requiredAppSlicesIds",
        "sliceRole",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/application-slices".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #2
0
async def _post(params, session):
    accepted_fields = [
        "active",
        "constraints",
        "description",
        "domainId",
        "id",
        "providerData",
        "providerProductId",
        "resourceTypeId",
        "title",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/products".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #3
0
async def _post(params, session):
    accepted_fields = ["applicationSliceId", "subDomains"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/application-slices/{applicationSliceId}/remove-sub-domains".format(
        **params
    ) + gen_args(
        params, IN_QUERY_PARAMETER
    )
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #4
0
async def _post(params, session):
    accepted_fields = [
        "accessUrl",
        "address",
        "description",
        "full",
        "onlyEnableTypes",
        "operationMode",
        "properties",
        "rpId",
        "tenantId",
        "title",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/domains/validate".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #5
0
async def _post(params, session):
    accepted_fields = [
        "deletableBySubTenants",
        "description",
        "id",
        "label",
        "updatableBySubTenants",
        "visibleToSubTenants",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/sharing-permissions".format(
        **params
    ) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #6
0
async def _post(params, session):
    accepted_fields = [
        "capabilityName",
        "id",
        "orchState",
        "properties",
        "providerData",
        "reason",
        "relationshipTypeId",
        "requirementName",
        "sourceId",
        "targetId",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/relationships".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _post(params, session):
    accepted_fields = [
        "autoClean",
        "createdAt",
        "custom",
        "description",
        "desiredOrchState",
        "differences",
        "discovered",
        "id",
        "label",
        "method",
        "nativeState",
        "orchState",
        "orderId",
        "productId",
        "properties",
        "providerData",
        "providerResourceId",
        "reason",
        "resourceId",
        "resourceTypeId",
        "revision",
        "shared",
        "sharingPermissionId",
        "subDomainId",
        "tags",
        "tenantId",
        "updateCount",
        "updateReason",
        "updateState",
        "updatedAt",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/resources/{resourceId}/validate".format(
        **params
    ) + gen_args(
        params, IN_QUERY_PARAMETER
    )
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #8
0
async def _head(params, session):
    _url = "{mdso_hostname}/bpocore/market/api/v1/application-slices".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.head(_url) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "head")
Example #9
0
async def _post(params, session):
    accepted_fields = [
        "createdAt",
        "description",
        "executionGroup",
        "id",
        "inputs",
        "interface",
        "method",
        "operationId",
        "outputs",
        "progress",
        "providerData",
        "reason",
        "resourceId",
        "resourceStateConstraints",
        "revision",
        "title",
        "updatedAt",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/resources/{resourceId}/operations/{operationId}/validate".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
Example #10
0
async def _put(params, session):
    accepted_fields = ["autoIndexed", "description", "key", "tagKey"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "{mdso_hostname}/bpocore/market/api/v1/tag-keys/{tagKey}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")