Complete the code to create a Pub/Sub topic named 'my-topic'.
gcloud pubsub topics create [1]The command gcloud pubsub topics create my-topic creates a Pub/Sub topic named 'my-topic'.
Complete the code to deploy a Cloud Function named 'processMessage' triggered by the Pub/Sub topic 'my-topic'.
gcloud functions deploy processMessage --trigger-topic=[1] --runtime python312 --entry-point mainThe Cloud Function must be triggered by the Pub/Sub topic 'my-topic', so the trigger-topic flag should be set to 'my-topic'.
Fix the error in the Cloud Function code to correctly decode the Pub/Sub message data.
def main(event, context): import base64 message = base64.b64decode(event['data']).decode('utf-8') print('Received message:', [1])
The decoded message is stored in the variable message, so printing message shows the decoded content.
Fill both blanks to create a subscription named 'my-subscription' for the topic 'my-topic'.
gcloud pubsub subscriptions create [1] --topic=[2]
The subscription name is 'my-subscription' and it must be created for the topic 'my-topic'.
Fill all three blanks to publish a message 'Hello, Cloud!' to the Pub/Sub topic 'my-topic' using gcloud.
gcloud pubsub topics publish [1] --message '[2]' --attribute [3]=greeting
The message is published to 'my-topic' with the message text 'Hello, Cloud!' and an attribute key 'type' set to 'greeting'.