From 802c88734273e1dfa1ee6b5bfec89ca0c22b5f44 Mon Sep 17 00:00:00 2001 From: Lakshman Sundaralingam Date: Wed, 12 May 2021 15:44:26 -0700 Subject: [PATCH] [Communication]: Cleaned up ACS samples (#18656) * Cleaned up ACS samples * Updated ACS account to ACS resource --- .../samples/identity_samples.py | 8 ++++---- .../samples/identity_samples_async.py | 2 +- .../samples/purchase_phone_number_sample.py | 4 +++- .../samples/send_sms_to_multiple_recipients_sample.py | 3 ++- .../send_sms_to_multiple_recipients_sample_async.py | 5 +++-- .../samples/send_sms_to_single_recipient_sample.py | 3 ++- .../samples/send_sms_to_single_recipient_sample_async.py | 3 ++- .../samples/sms_token_credential_auth_sample.py | 5 +++-- .../samples/sms_token_credential_auth_sample_async.py | 3 ++- 9 files changed, 22 insertions(+), 14 deletions(-) diff --git a/sdk/communication/azure-communication-identity/samples/identity_samples.py b/sdk/communication/azure-communication-identity/samples/identity_samples.py index 991535a0d8bc..3d32d2a5a7c4 100644 --- a/sdk/communication/azure-communication-identity/samples/identity_samples.py +++ b/sdk/communication/azure-communication-identity/samples/identity_samples.py @@ -14,10 +14,10 @@ USAGE: python identity_samples.py Set the environment variables with your own values before running the sample: - 2) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account - 3) AZURE_CLIENT_ID - the client ID of your active directory application - 4) AZURE_CLIENT_SECRET - the secret of your active directory application - 5) AZURE_TENANT_ID - the tenant ID of your active directory application + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_CLIENT_ID - the client ID of your active directory application + 3) AZURE_CLIENT_SECRET - the secret of your active directory application + 4) AZURE_TENANT_ID - the tenant ID of your active directory application """ import os from azure.communication.identity._shared.utils import parse_connection_str diff --git a/sdk/communication/azure-communication-identity/samples/identity_samples_async.py b/sdk/communication/azure-communication-identity/samples/identity_samples_async.py index 03cb88768f0e..0c704fdb53ce 100644 --- a/sdk/communication/azure-communication-identity/samples/identity_samples_async.py +++ b/sdk/communication/azure-communication-identity/samples/identity_samples_async.py @@ -15,7 +15,7 @@ python identity_samples_async.py Set the environment variables with your own values before running the sample: 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url - 2) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource 3) AZURE_CLIENT_ID - the client ID of your active directory application 4) AZURE_CLIENT_SECRET - the secret of your active directory application 5) AZURE_TENANT_ID - the tenant ID of your active directory application diff --git a/sdk/communication/azure-communication-phonenumbers/samples/purchase_phone_number_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/purchase_phone_number_sample.py index 96a06f9b4089..ba28a82a4f04 100644 --- a/sdk/communication/azure-communication-phonenumbers/samples/purchase_phone_number_sample.py +++ b/sdk/communication/azure-communication-phonenumbers/samples/purchase_phone_number_sample.py @@ -14,7 +14,9 @@ python purchase_phone_number_sample.py Set the environment variables with your own values before running the sample: 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - The connection string including your endpoint and - access key of your Azure Communication Service 2) AZURE_COMMUNICATION_SERVICE_SEARCH_ID_TO_PURCHASE - The search id for the phone number you reserved and want to purchase + access key of your Azure Communication Service + 2) AZURE_COMMUNICATION_SERVICE_SEARCH_ID_TO_PURCHASE - The search id for the phone number you + reserved and want to purchase """ import os diff --git a/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample.py b/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample.py index 8f9a3fd64ff2..e3463fa89419 100644 --- a/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample.py +++ b/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample.py @@ -14,7 +14,8 @@ USAGE: python send_sms_to_multiple_recipients_sample.py Set the environment variable with your own value before running the sample: - 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER - a phone number with SMS capabilities in your ACS resource """ import os diff --git a/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample_async.py b/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample_async.py index 0b511493664c..2fce707bb260 100644 --- a/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample_async.py +++ b/sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample_async.py @@ -14,7 +14,8 @@ USAGE: python send_sms_to_multiple_recipients_sample_async.py Set the environment variable with your own value before running the sample: - 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER - a phone number with SMS capabilities in your ACS resource """ import os @@ -37,7 +38,7 @@ async def send_sms_to_multiple_recipients_async(self): # calling send() with sms values sms_responses = await sms_client.send( from_=self.phone_number, - to=[self.phone_number,self.phone_number], + to=[self.phone_number, self.phone_number], message="Hello World via SMS", enable_delivery_report=True, # optional property tag="custom-tag") # optional property diff --git a/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample.py b/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample.py index f7b6520ac86b..ea21daadfe12 100644 --- a/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample.py +++ b/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample.py @@ -14,7 +14,8 @@ USAGE: python send_sms_to_single_recipient_sample.py Set the environment variable with your own value before running the sample: - 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER - a phone number with SMS capabilities in your ACS resource """ import os diff --git a/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample_async.py b/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample_async.py index 353ffe80a211..5df09f9ffaba 100644 --- a/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample_async.py +++ b/sdk/communication/azure-communication-sms/samples/send_sms_to_single_recipient_sample_async.py @@ -14,7 +14,8 @@ USAGE: python send_sms_to_single_recipient_sample_async.py Set the environment variable with your own value before running the sample: - 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER - a phone number with SMS capabilities in your ACS resource """ import os diff --git a/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample.py b/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample.py index b777d8ce8263..0611146e438b 100644 --- a/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample.py +++ b/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample.py @@ -14,7 +14,8 @@ USAGE: python sms_token_credential_auth_sample.py Set the environment variable with your own value before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - the connection string in your ACS account + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER - a phone number with SMS capabilities in your ACS resource """ import os @@ -27,7 +28,7 @@ class SmsTokenCredentialAuthSample(object): - connection_str = os.getenv('AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING') + connection_str = os.getenv('COMMUNICATION_SAMPLES_CONNECTION_STRING') phone_number = os.getenv("AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER") def sms_token_credential_auth(self): diff --git a/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample_async.py b/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample_async.py index aa60d746bcb9..77156e1aac46 100644 --- a/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample_async.py +++ b/sdk/communication/azure-communication-sms/samples/sms_token_credential_auth_sample_async.py @@ -14,7 +14,8 @@ USAGE: python sms_token_credential_auth_sample_async.py Set the environment variable with your own value before running the sample: - 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS resource + 2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER - a phone number with SMS capabilities in your ACS resource """ import os