How to use the gql.gql.reporter.FailedOperationException function in gql

To help you get started, we’ve selected a few gql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github magma / magma / symphony / cli / pyinventory / graphql / mutation / add_customer.py View on Github external
def execute(cls, client: GraphqlClient, input: AddCustomerInput) -> AddCustomerMutationData.Customer:
        # fmt: off
        variables: Dict[str, Any] = {"input": input}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("AddCustomerMutation", variables, network_time, decode_time)
            return res.addCustomer
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "AddCustomerMutation",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / mutation / add_equipment_port_type.py View on Github external
def execute(cls, client: GraphqlClient, input: AddEquipmentPortTypeInput) -> AddEquipmentPortTypeMutationData.EquipmentPortType:
        # fmt: off
        variables: Dict[str, Any] = {"input": input}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("AddEquipmentPortTypeMutation", variables, network_time, decode_time)
            return res.addEquipmentPortType
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "AddEquipmentPortTypeMutation",
                variables,
            )
github magma / magma / symphony / cli / pysymphony / graphql / mutation / delete_image.py View on Github external
def execute(cls, client: GraphqlClient, entityType: ImageEntity, entityId: str, id: str) -> DeleteImageMutationData.File:
        # fmt: off
        variables: Dict[str, Any] = {"entityType": entityType, "entityId": entityId, "id": id}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("DeleteImageMutation", variables, network_time, decode_time)
            return res.deleteImage
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "DeleteImageMutation",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / mutation / edit_service_type.py View on Github external
def execute(cls, client: GraphqlClient, input: ServiceTypeEditData) -> EditServiceTypeMutationData.ServiceType:
        # fmt: off
        variables: Dict[str, Any] = {"input": input}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("EditServiceTypeMutation", variables, network_time, decode_time)
            return res.editServiceType
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "EditServiceTypeMutation",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / mutation / add_location_type.py View on Github external
def execute(cls, client: GraphqlClient, input: AddLocationTypeInput) -> AddLocationTypeMutationData.LocationType:
        # fmt: off
        variables: Dict[str, Any] = {"input": input}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("AddLocationTypeMutation", variables, network_time, decode_time)
            return res.addLocationType
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "AddLocationTypeMutation",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / query / location_types.py View on Github external
def execute(cls, client: GraphqlClient) -> Optional[LocationTypesQueryData.LocationTypeConnection]:
        # fmt: off
        variables: Dict[str, Any] = {}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("LocationTypesQuery", variables, network_time, decode_time)
            return res.locationTypes
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "LocationTypesQuery",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / mutation / add_service.py View on Github external
def execute(cls, client: GraphqlClient, data: ServiceCreateData) -> AddServiceMutationData.Service:
        # fmt: off
        variables: Dict[str, Any] = {"data": data}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("AddServiceMutation", variables, network_time, decode_time)
            return res.addService
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "AddServiceMutation",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / mutation / add_service_endpoint.py View on Github external
def execute(cls, client: GraphqlClient, input: AddServiceEndpointInput) -> AddServiceEndpointMutationData.Service:
        # fmt: off
        variables: Dict[str, Any] = {"input": input}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("AddServiceEndpointMutation", variables, network_time, decode_time)
            return res.addServiceEndpoint
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "AddServiceEndpointMutation",
                variables,
            )
github magma / magma / symphony / cli / pyinventory / graphql / query / get_locations.py View on Github external
def execute(cls, client: GraphqlClient, after: Optional[str] = None, first: Optional[int] = None) -> Optional[GetLocationsQueryData.LocationConnection]:
        # fmt: off
        variables: Dict[str, Any] = {"after": after, "first": first}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("GetLocationsQuery", variables, network_time, decode_time)
            return res.locations
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "GetLocationsQuery",
                variables,
            )
github magma / magma / symphony / cli / pyworkforce / graphql / mutation / add_workorder.py View on Github external
def execute(cls, client: GraphqlClient, input: AddWorkOrderInput) -> AddWorkOrderMutationData.WorkOrder:
        # fmt: off
        variables: Dict[str, Any] = {"input": input}
        try:
            network_start = perf_counter()
            response_text = client.call(''.join(set(QUERY)), variables=variables)
            decode_start = perf_counter()
            res = cls.from_json(response_text).data
            decode_time = perf_counter() - decode_start
            network_time = decode_start - network_start
            client.reporter.log_successful_operation("AddWorkOrderMutation", variables, network_time, decode_time)
            return res.addWorkOrder
        except OperationException as e:
            raise FailedOperationException(
                client.reporter,
                e.err_msg,
                e.err_id,
                "AddWorkOrderMutation",
                variables,
            )