@@ -140,7 +140,7 @@ echo "Using AWS Region: $AWS_REGION"
140140
141141# Get available availability zones in the current region
142142echo " Getting available availability zones in region $AWS_REGION ..."
143- local az_output
143+ az_output= " "
144144if az_output=$( aws ec2 describe-availability-zones --region " $AWS_REGION " --query " AvailabilityZones[0].ZoneName" --output text 2>&1 ) ; then
145145 AVAILABILITY_ZONE=" $az_output "
146146 if [ -z " $AVAILABILITY_ZONE " ]; then
@@ -172,7 +172,7 @@ echo "Entitlement name: $ENTITLEMENT_NAME"
172172
173173# Step 1: Verify access to MediaConnect
174174echo " Step 1: Verifying access to AWS Elemental MediaConnect..."
175- local list_flows_output
175+ list_flows_output= " "
176176if list_flows_output=$( aws mediaconnect list-flows 2>&1 ) ; then
177177 echo " $list_flows_output "
178178else
181181
182182# Step 2: Create a flow
183183echo " Step 2: Creating a flow..."
184- local create_flow_output
184+ create_flow_output= " "
185185if create_flow_output=$( aws mediaconnect create-flow \
186186 --availability-zone " $AVAILABILITY_ZONE " \
187187 --name " $FLOW_NAME " \
205205
206206# Step 3: Add an output
207207echo " Step 3: Adding an output to the flow..."
208- local add_output_output
208+ add_output_output= " "
209209if add_output_output=$( aws mediaconnect add-flow-outputs \
210210 --flow-arn " $FLOW_ARN " \
211211 --outputs " Name=$OUTPUT_NAME ,Protocol=zixi-push,Destination=198.51.100.11,Port=1024,StreamId=ZixiAwardsOutput" 2>&1 ) ; then
215215fi
216216
217217# Extract the output ARN
218- local output_arn
218+ output_arn= " "
219219output_arn=$( extract_json_value " $add_output_output " " OutputArn" )
220220if [ -z " $output_arn " ]; then
221221 echo " WARNING: Failed to extract output ARN from output"
226226
227227# Step 4: Grant an entitlement
228228echo " Step 4: Granting an entitlement..."
229- local grant_entitlement_output
229+ grant_entitlement_output= " "
230230if grant_entitlement_output=$( aws mediaconnect grant-flow-entitlements \
231231 --flow-arn " $FLOW_ARN " \
232232 --entitlements " Name=$ENTITLEMENT_NAME ,Subscribers=222233334444" 2>&1 ) ; then
236236fi
237237
238238# Extract the entitlement ARN
239- local entitlement_arn
239+ entitlement_arn= " "
240240entitlement_arn=$( extract_json_value " $grant_entitlement_output " " EntitlementArn" )
241241if [ -z " $entitlement_arn " ]; then
242242 echo " WARNING: Failed to extract entitlement ARN from output"
247247
248248# Step 5: List entitlements to share with affiliates
249249echo " Step 5: Listing entitlements for the flow..."
250- local describe_flow_output
250+ describe_flow_output= " "
251251if describe_flow_output=$( aws mediaconnect describe-flow --flow-arn " $FLOW_ARN " --query " Flow.Entitlements" 2>&1 ) ; then
252252 echo " Entitlements for the flow:"
253253 echo " $describe_flow_output "
0 commit comments