def deleteTopic(self):
        topic_path = publisher.topic_path(PROJECT_ID, self.getTopicID())

        try:
            publisher.delete_topic(request={"topic": topic_path})
            print(f"deleted topic {self.getTopicID()}")
        except Exception as err:
            print(err)
    def createTopic(self):
        TOPIC_ID = self.getTopicID()
        topic_path = publisher.topic_path(PROJECT_ID, TOPIC_ID)

        try:
            topic = publisher.create_topic(request={"name": topic_path})
            print(f"created topic {TOPIC_ID}")
        except Exception as err:
            print(err)
    def switch_to_normal_ride(self):
        topic_path = publisher.topic_path(PROJECT_ID, self.signal.getTopicID())

        bundle = {
            ACTION_TYPE: NORMAL_RIDE,
            RECIPIENT: self.getSubscriptionID(),
            PAYLOAD: {}
        }

        bundle_json = json.dumps(bundle).encode("utf-8")
        publisher.publish(topic_path, bundle_json)
    def over_ride_to(self, over_ride_color):
        topic_path = publisher.topic_path(PROJECT_ID, self.signal.getTopicID())

        bundle = {
            ACTION_TYPE: OVER_RIDE,
            RECIPIENT: self.getSubscriptionID(),
            PAYLOAD: {
                OPERATION_COLOR: over_ride_color
            }
        }

        bundle_json = json.dumps(bundle).encode("utf-8")
        publisher.publish(topic_path, bundle_json)
    def createSubscription(self):
        SUBSCRIPTION_ID = self.getSubscriptionID()
        TOPIC_ID = self.getTopicID()

        subscription_path = subscriber.subscription_path(
            PROJECT_ID, SUBSCRIPTION_ID)
        topic_path = publisher.topic_path(PROJECT_ID, TOPIC_ID)

        try:
            subscription = subscriber.create_subscription(request={
                "name": subscription_path,
                "topic": topic_path
            })
            print(f"created subscription {SUBSCRIPTION_ID}")
        except Exception as err:
            print(err)