diff --git a/ruby/example_code/cloudwatch/alarm_actions.rb b/ruby/example_code/cloudwatch/alarm_actions.rb index 6b4f3faeb3e..ab0cda59e54 100644 --- a/ruby/example_code/cloudwatch/alarm_actions.rb +++ b/ruby/example_code/cloudwatch/alarm_actions.rb @@ -114,7 +114,7 @@ def alarm_actions_disabled?(cloudwatch_client, alarm_name) return false end -# Full example call: +# Example usage: def run_me alarm_name = "ObjectsInBucket" alarm_description = "Objects exist in this bucket for more than 1 day." diff --git a/ruby/example_code/cloudwatch/alarm_basics.rb b/ruby/example_code/cloudwatch/alarm_basics.rb index d296ebd44ac..5b233f17f42 100644 --- a/ruby/example_code/cloudwatch/alarm_basics.rb +++ b/ruby/example_code/cloudwatch/alarm_basics.rb @@ -134,7 +134,7 @@ def alarm_deleted?(cloudwatch_client, alarm_name) return false end -# Full example call: +# Example usage: def run_me alarm_name = "ObjectsInBucket" alarm_description = "Objects exist in this bucket for more than 1 day." diff --git a/ruby/example_code/cloudwatch/create_alarm.rb b/ruby/example_code/cloudwatch/create_alarm.rb index 4ec96f5f352..6d366170c86 100644 --- a/ruby/example_code/cloudwatch/create_alarm.rb +++ b/ruby/example_code/cloudwatch/create_alarm.rb @@ -87,7 +87,7 @@ def alarm_created_or_updated?( return false end -# Full example call: +# Example usage: def run_me alarm_name = "ObjectsInBucket" alarm_description = "Objects exist in this bucket for more than 1 day." diff --git a/ruby/example_code/cloudwatch/metrics_basics.rb b/ruby/example_code/cloudwatch/metrics_basics.rb index a294e9bfc43..a255abccc69 100644 --- a/ruby/example_code/cloudwatch/metrics_basics.rb +++ b/ruby/example_code/cloudwatch/metrics_basics.rb @@ -99,7 +99,7 @@ def list_metrics_for_namespace(cloudwatch_client, metric_namespace) end end -# Full example call: +# Example usage: def run_me metric_namespace = "SITE/TRAFFIC" # Replace us-west-2 with the AWS Region you're using for Amazon CloudWatch. diff --git a/ruby/example_code/cloudwatch/show_alarms.rb b/ruby/example_code/cloudwatch/show_alarms.rb index e9bc32a8539..e7f4fa7bf87 100644 --- a/ruby/example_code/cloudwatch/show_alarms.rb +++ b/ruby/example_code/cloudwatch/show_alarms.rb @@ -68,7 +68,7 @@ def describe_metric_alarms(cloudwatch_client) puts "Error getting information about alarms: #{e.message}" end -# Full example call: +# Example usage: def run_me region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-attach-igw-vpc.rb b/ruby/example_code/ec2/ec2-ruby-example-attach-igw-vpc.rb index c5fd021f6cc..bc2fdf3cd2a 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-attach-igw-vpc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-attach-igw-vpc.rb @@ -53,7 +53,7 @@ def internet_gateway_created_and_attached?( return false end -# Full example call: +# Example usage: def run_me vpc_id = "" tag_key = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-create-instance.rb b/ruby/example_code/ec2/ec2-ruby-example-create-instance.rb index 6d323bf7d6e..f613b3face3 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-create-instance.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-create-instance.rb @@ -98,7 +98,7 @@ def instance_created?( return false end -# Full example call: +# Example usage: def run_me image_id = "" key_pair_name = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-create-key-pair.rb b/ruby/example_code/ec2/ec2-ruby-example-create-key-pair.rb index 268024cbe52..b3a7406d783 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-create-key-pair.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-create-key-pair.rb @@ -34,7 +34,7 @@ def key_pair_created?(ec2_client, key_pair_name) return false end -# Full example call: +# Example usage: def run_me key_pair_name = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-create-route-table.rb b/ruby/example_code/ec2/ec2-ruby-example-create-route-table.rb index 7045f9d7a91..0e8baafcd0a 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-create-route-table.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-create-route-table.rb @@ -73,7 +73,7 @@ def route_table_created_and_associated?( return false end -# Full example call: +# Example usage: def run_me vpc_id = "" subnet_id = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-create-security-group.rb b/ruby/example_code/ec2/ec2-ruby-example-create-security-group.rb index 52b8ce251d1..1b1956f8643 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-create-security-group.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-create-security-group.rb @@ -76,7 +76,7 @@ def security_group_created_with_egress?( return false end -# Full example call: +# Example usage: def run_me group_name = "" description = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-create-subnet.rb b/ruby/example_code/ec2/ec2-ruby-example-create-subnet.rb index 79211e570ba..71970640781 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-create-subnet.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-create-subnet.rb @@ -69,7 +69,7 @@ def subnet_created_and_tagged?( return false end -# Full example call: +# Example usage: def run_me vpc_id = "" cidr_block = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-create-vpc.rb b/ruby/example_code/ec2/ec2-ruby-example-create-vpc.rb index 09aa9eb91ac..da79fe5b0c9 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-create-vpc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-create-vpc.rb @@ -49,7 +49,7 @@ def vpc_created_and_tagged?( return false end -# Full example call: +# Example usage: def run_me cidr_block = "" tag_key = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-elastic-ips.rb b/ruby/example_code/ec2/ec2-ruby-example-elastic-ips.rb index de48fa0b42b..20384f0903d 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-elastic-ips.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-elastic-ips.rb @@ -160,7 +160,7 @@ def elastic_ip_address_released?(ec2_client, allocation_id) end # snippet-end:[ec2.Ruby.releaseElasticIPs] -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-get-all-instance-info.rb b/ruby/example_code/ec2/ec2-ruby-example-get-all-instance-info.rb index 03d97492e1a..5bf07efa142 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-get-all-instance-info.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-get-all-instance-info.rb @@ -27,7 +27,7 @@ def list_instance_ids_states(ec2_resource) puts "Error getting information about instances: #{e.message}" end -#Full example call: +# Example usage: def run_me region = "" # Print usage information and then stop. diff --git a/ruby/example_code/ec2/ec2-ruby-example-get-instance-info-by-tag.rb b/ruby/example_code/ec2/ec2-ruby-example-get-instance-info-by-tag.rb index fe06618119a..6025c3666d9 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-get-instance-info-by-tag.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-get-instance-info-by-tag.rb @@ -45,7 +45,7 @@ def list_instance_ids_states_by_tag(ec2_resource, tag_key, tag_value) puts "Error getting information about instances: #{e.message}" end -#Full example call: +# Example usage: def run_me tag_key = "" tag_value = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-key-pairs.rb b/ruby/example_code/ec2/ec2-ruby-example-key-pairs.rb index 62aa1de5bee..ea57e7d91a5 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-key-pairs.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-key-pairs.rb @@ -85,7 +85,7 @@ def key_pair_deleted?(ec2_client, key_pair_name) return false end -# Full example call: +# Example usage: def run_me key_pair_name = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-list-state-instance-i-123abc.rb b/ruby/example_code/ec2/ec2-ruby-example-list-state-instance-i-123abc.rb index 7e95360c1b0..8690e5dcde5 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-list-state-instance-i-123abc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-list-state-instance-i-123abc.rb @@ -34,7 +34,7 @@ def list_instance_state(ec2_client, instance_id) puts "Error getting information about instance: #{e.message}" end -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-manage-instances.rb b/ruby/example_code/ec2/ec2-ruby-example-manage-instances.rb index 0d8eac4db37..51e65bb7b3f 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-manage-instances.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-manage-instances.rb @@ -174,7 +174,7 @@ def list_instances_information(ec2_client) end end -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-reboot-instance-i-123abc.rb b/ruby/example_code/ec2/ec2-ruby-example-reboot-instance-i-123abc.rb index b44f1aaeb86..3484fa5e750 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-reboot-instance-i-123abc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-reboot-instance-i-123abc.rb @@ -37,7 +37,7 @@ def request_instance_reboot(ec2_client, instance_id) puts "Error requesting reboot: #{e.message}" end -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-regions-availability-zones.rb b/ruby/example_code/ec2/ec2-ruby-example-regions-availability-zones.rb index 5ccecf415db..5700db883ee 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-regions-availability-zones.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-regions-availability-zones.rb @@ -82,7 +82,7 @@ def list_availability_zones(ec2_client) end end -# Full example call: +# Example usage: def run_me region = "" # Print usage information and then stop. diff --git a/ruby/example_code/ec2/ec2-ruby-example-security-group.rb b/ruby/example_code/ec2/ec2-ruby-example-security-group.rb index 5bf6a980533..abeea02da4d 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-security-group.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-security-group.rb @@ -227,7 +227,7 @@ def security_group_deleted?(ec2_client, security_group_id) return false end -# Full example call: +# Example usage: def run_me group_name = "" description = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-start-instance-i-123abc.rb b/ruby/example_code/ec2/ec2-ruby-example-start-instance-i-123abc.rb index cddb68cf62a..84f378b56a3 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-start-instance-i-123abc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-start-instance-i-123abc.rb @@ -52,7 +52,7 @@ def instance_started?(ec2_client, instance_id) return false end -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-stop-instance-i-123abc.rb b/ruby/example_code/ec2/ec2-ruby-example-stop-instance-i-123abc.rb index f09ff243e6e..ced2887f58e 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-stop-instance-i-123abc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-stop-instance-i-123abc.rb @@ -49,7 +49,7 @@ def instance_stopped?(ec2_client, instance_id) return false end -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/ec2/ec2-ruby-example-terminate-instance-i-123abc.rb b/ruby/example_code/ec2/ec2-ruby-example-terminate-instance-i-123abc.rb index b39387e0416..a104d1c3f56 100644 --- a/ruby/example_code/ec2/ec2-ruby-example-terminate-instance-i-123abc.rb +++ b/ruby/example_code/ec2/ec2-ruby-example-terminate-instance-i-123abc.rb @@ -44,7 +44,7 @@ def instance_terminated?(ec2_client, instance_id) return false end -# Full example call: +# Example usage: def run_me instance_id = "" region = "" diff --git a/ruby/example_code/eventbridge/cw-ruby-example-send-events-ec2.rb b/ruby/example_code/eventbridge/cw-ruby-example-send-events-ec2.rb index ada7b5d02b7..e98977ea193 100644 --- a/ruby/example_code/eventbridge/cw-ruby-example-send-events-ec2.rb +++ b/ruby/example_code/eventbridge/cw-ruby-example-send-events-ec2.rb @@ -742,7 +742,7 @@ def manual_cleanup_notice( puts "- The Amazon EC2 instance with the ID '#{instance_id}'." end -# Full example call: +# Example usage: def run_me # Properties for the Amazon SNS topic. topic_name = "aws-doc-sdk-examples-topic" diff --git a/ruby/example_code/iam/list_groups.rb b/ruby/example_code/iam/list_groups.rb index 9d7d6850b45..3cd324fe398 100644 --- a/ruby/example_code/iam/list_groups.rb +++ b/ruby/example_code/iam/list_groups.rb @@ -26,8 +26,9 @@ def list_groups(count) raise end end +# snippet-end:[ruby.iam.ListGroups] -# Execute the code if the file is the main program +# Example usage: if $PROGRAM_NAME == __FILE__ iam_client = Aws::IAM::Client.new iam_group_manager = IamGroupManager.new(iam_client) diff --git a/ruby/example_code/iam/manage_account_aliases.rb b/ruby/example_code/iam/manage_account_aliases.rb index 37a2b94b213..01f4d41fd42 100644 --- a/ruby/example_code/iam/manage_account_aliases.rb +++ b/ruby/example_code/iam/manage_account_aliases.rb @@ -52,7 +52,7 @@ def delete_account_alias(account_alias) end # snippet-end:[iam.ruby.ManageAccountAliases] -# Full example usage +# Example usage: if $PROGRAM_NAME == __FILE__ iam_client = Aws::IAM::Client.new manager = IAMAliasManager.new(iam_client) diff --git a/ruby/example_code/iam/manage_roles.rb b/ruby/example_code/iam/manage_roles.rb index d6620be0b8c..d41d6a78c56 100644 --- a/ruby/example_code/iam/manage_roles.rb +++ b/ruby/example_code/iam/manage_roles.rb @@ -3,7 +3,7 @@ require "aws-sdk-iam" require "logger" -# snippet-start:[ruby.iam.CreateRole] +# snippet-start:[ruby.iam.ManageRoles] # Manages IAM roles class RoleManager # Initialize with an AWS IAM client @@ -163,8 +163,8 @@ def delete_service_linked_role(role) end end # snippet-end:[ruby.iam.DeleteServiceLinkedRole] - end +# snippet-end:[ruby.iam.ManageRoles] # Example usage: if __FILE__ == $PROGRAM_NAME diff --git a/ruby/example_code/iam/scenario_users.rb b/ruby/example_code/iam/scenario_users.rb index f3708b7bd3a..983ddd0242a 100644 --- a/ruby/example_code/iam/scenario_users.rb +++ b/ruby/example_code/iam/scenario_users.rb @@ -118,7 +118,7 @@ def delete_role(role_name) end end -# Execute only if the script is the main program +# Example usage: if $PROGRAM_NAME == __FILE__ iam_client = Aws::IAM::Client.new user_and_role_manager = IAMUserAndRoleManager.new(iam_client) diff --git a/ruby/example_code/s3/auth_federation_token_request_test.rb b/ruby/example_code/s3/auth_federation_token_request_test.rb index c987ed51b95..ccd01b47bce 100644 --- a/ruby/example_code/s3/auth_federation_token_request_test.rb +++ b/ruby/example_code/s3/auth_federation_token_request_test.rb @@ -102,8 +102,7 @@ def list_objects_in_bucket?(s3_client, bucket_name) puts "Error while accessing the bucket named '#{bucket_name}': #{e.message}" end -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me region = "us-west-2" user_name = "my-user" diff --git a/ruby/example_code/s3/auth_request_object_keys.rb b/ruby/example_code/s3/auth_request_object_keys.rb index be63072547c..ebb95c9c21c 100644 --- a/ruby/example_code/s3/auth_request_object_keys.rb +++ b/ruby/example_code/s3/auth_request_object_keys.rb @@ -40,8 +40,7 @@ def list_bucket_objects?(s3_client, bucket_name) return false end -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me region = "us-west-2" bucket_name = "BUCKET_NAME" diff --git a/ruby/example_code/s3/auth_session_token_request_test.rb b/ruby/example_code/s3/auth_session_token_request_test.rb index 27dca48e937..69ed20182a8 100644 --- a/ruby/example_code/s3/auth_session_token_request_test.rb +++ b/ruby/example_code/s3/auth_session_token_request_test.rb @@ -166,8 +166,7 @@ def list_objects_in_bucket?(s3_client, bucket_name) end # snippet-end:[s3.ruby.auth_session_token_request_test.rb] -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me user_name = "my-user" region = "us-west-2" diff --git a/ruby/example_code/s3/bucket_cors.rb b/ruby/example_code/s3/bucket_cors.rb index a3863b776f6..1ae92977402 100644 --- a/ruby/example_code/s3/bucket_cors.rb +++ b/ruby/example_code/s3/bucket_cors.rb @@ -73,6 +73,7 @@ def delete_cors end # snippet-end:[ruby.example_code.s3.helper.end.BucketCorsWrapper] +# Example usage: def run_demo bucket_name = "doc-example-bucket" allowed_methods = %w[GET PUT] diff --git a/ruby/example_code/s3/bucket_create.rb b/ruby/example_code/s3/bucket_create.rb index 4f2210b7c69..e8bc41cc7e1 100644 --- a/ruby/example_code/s3/bucket_create.rb +++ b/ruby/example_code/s3/bucket_create.rb @@ -44,6 +44,7 @@ def location end end +# Example usage: def run_demo region = "us-west-2" wrapper = BucketCreateWrapper.new(Aws::S3::Bucket.new("doc-example-bucket-#{Random.uuid}")) diff --git a/ruby/example_code/s3/bucket_list.rb b/ruby/example_code/s3/bucket_list.rb index 86fe882ee9a..d3c38122973 100644 --- a/ruby/example_code/s3/bucket_list.rb +++ b/ruby/example_code/s3/bucket_list.rb @@ -34,6 +34,7 @@ def list_buckets(count) end end +# Example usage: def run_demo wrapper = BucketListWrapper.new(Aws::S3::Resource.new) wrapper.list_buckets(25) diff --git a/ruby/example_code/s3/bucket_list_objects.rb b/ruby/example_code/s3/bucket_list_objects.rb index 0b95cc0ac3c..20861b41910 100644 --- a/ruby/example_code/s3/bucket_list_objects.rb +++ b/ruby/example_code/s3/bucket_list_objects.rb @@ -36,6 +36,7 @@ def list_objects(max_objects) end end +# Example usage: def run_demo bucket_name = "doc-example-bucket" diff --git a/ruby/example_code/s3/bucket_policy.rb b/ruby/example_code/s3/bucket_policy.rb index fa09ae2fa4e..801a84c70f9 100644 --- a/ruby/example_code/s3/bucket_policy.rb +++ b/ruby/example_code/s3/bucket_policy.rb @@ -58,6 +58,7 @@ def delete_policy end # snippet-end:[ruby.example_code.s3.helper.end.BucketPolicyWrapper] +# Example usage: def run_demo bucket_name = "doc-example-bucket" policy_user = "arn:aws:iam::111122223333:user/Martha" diff --git a/ruby/example_code/s3/bucket_put_encryption.rb b/ruby/example_code/s3/bucket_put_encryption.rb index c49782fefee..4d9a821b7ed 100644 --- a/ruby/example_code/s3/bucket_put_encryption.rb +++ b/ruby/example_code/s3/bucket_put_encryption.rb @@ -39,6 +39,7 @@ def set_encryption(bucket_name) end end +# Example usage: def run_demo bucket_name = "doc-example-bucket" wrapper = BucketEncryptionWrapper.new(Aws::S3::Client.new) diff --git a/ruby/example_code/s3/bucket_put_website.rb b/ruby/example_code/s3/bucket_put_website.rb index 56f0bb4c68b..ba9127cc429 100644 --- a/ruby/example_code/s3/bucket_put_website.rb +++ b/ruby/example_code/s3/bucket_put_website.rb @@ -36,6 +36,7 @@ def set_website(index_document, error_document) end end +# Example usage: def run_demo bucket_name = "doc-example-bucket" index_document = "index.html" diff --git a/ruby/example_code/s3/encryption_v2/s3_add_csaes_encrypt_item.rb b/ruby/example_code/s3/encryption_v2/s3_add_csaes_encrypt_item.rb index 5b2cec0976f..8fd60bd70c0 100644 --- a/ruby/example_code/s3/encryption_v2/s3_add_csaes_encrypt_item.rb +++ b/ruby/example_code/s3/encryption_v2/s3_add_csaes_encrypt_item.rb @@ -82,8 +82,7 @@ def get_random_aes_256_gcm_key return random_key_64 end -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/encryption_v2/s3_add_cskms_encrypt_item.rb b/ruby/example_code/s3/encryption_v2/s3_add_cskms_encrypt_item.rb index 2d2dec52d7b..b985b2db92f 100644 --- a/ruby/example_code/s3/encryption_v2/s3_add_cskms_encrypt_item.rb +++ b/ruby/example_code/s3/encryption_v2/s3_add_cskms_encrypt_item.rb @@ -55,8 +55,7 @@ def encrypted_object_uploaded?( return false end -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/encryption_v2/s3_get_csaes_decrypt_item.rb b/ruby/example_code/s3/encryption_v2/s3_get_csaes_decrypt_item.rb index f2a0cc7a282..a0e896764f7 100644 --- a/ruby/example_code/s3/encryption_v2/s3_get_csaes_decrypt_item.rb +++ b/ruby/example_code/s3/encryption_v2/s3_get_csaes_decrypt_item.rb @@ -52,8 +52,7 @@ def get_decrypted_object_content( return "Error getting object content: #{e.message}" end -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/encryption_v2/s3_get_cskms_decrypt_item.rb b/ruby/example_code/s3/encryption_v2/s3_get_cskms_decrypt_item.rb index dffbf2c1148..338a7f72d7f 100644 --- a/ruby/example_code/s3/encryption_v2/s3_get_cskms_decrypt_item.rb +++ b/ruby/example_code/s3/encryption_v2/s3_get_cskms_decrypt_item.rb @@ -52,8 +52,7 @@ def get_decrypted_object_content( return "Error getting object content: #{e.message}" end -# Full example call: -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/encryption_v2/s3_ruby_example_add_cspk_item.rb b/ruby/example_code/s3/encryption_v2/s3_ruby_example_add_cspk_item.rb index ff866aaca3a..b20d794b3fc 100644 --- a/ruby/example_code/s3/encryption_v2/s3_ruby_example_add_cspk_item.rb +++ b/ruby/example_code/s3/encryption_v2/s3_ruby_example_add_cspk_item.rb @@ -53,7 +53,7 @@ def object_uploaded_with_public_key_encryption?( # Full example call: # Prerequisites: an RSA key pair. -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/encryption_v2/s3_ruby_example_get_cspk_item.rb b/ruby/example_code/s3/encryption_v2/s3_ruby_example_get_cspk_item.rb index c1cf6b552d5..2100db7b445 100644 --- a/ruby/example_code/s3/encryption_v2/s3_ruby_example_get_cspk_item.rb +++ b/ruby/example_code/s3/encryption_v2/s3_ruby_example_get_cspk_item.rb @@ -49,9 +49,7 @@ def download_object_with_private_key_encryption( puts "Error downloading object: #{e.message}" end -# Full example call: -# Prerequisites: the same RSA key pair you originally used to encrypt the object. -# Replace us-west-2 with the AWS Region you're using for Amazon S3. +# Example usage: def run_me bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/object_copy.rb b/ruby/example_code/s3/object_copy.rb index 9172a55fc3d..d55e48c57e5 100644 --- a/ruby/example_code/s3/object_copy.rb +++ b/ruby/example_code/s3/object_copy.rb @@ -31,8 +31,7 @@ def copy_object(target_bucket, target_object_key) end end -# Replace the source and target bucket names with existing buckets you own and replace the source object key -# with an existing object in the source bucket. +# Example usage: def run_demo source_bucket_name = "doc-example-bucket1" source_key = "my-source-file.txt" diff --git a/ruby/example_code/s3/object_copy_encrypt.rb b/ruby/example_code/s3/object_copy_encrypt.rb index eb871e61225..a5c21927ac5 100644 --- a/ruby/example_code/s3/object_copy_encrypt.rb +++ b/ruby/example_code/s3/object_copy_encrypt.rb @@ -32,8 +32,7 @@ def copy_object(target_bucket, target_object_key, encryption) end end -# Replace the source and target bucket names with existing buckets you own and replace the source object key -# with an existing object in the source bucket. +# Example usage: def run_demo source_bucket_name = "doc-example-bucket1" source_key = "my-source-file.txt" diff --git a/ruby/example_code/s3/object_exists.rb b/ruby/example_code/s3/object_exists.rb index 1602a5aa90e..01d896379f5 100644 --- a/ruby/example_code/s3/object_exists.rb +++ b/ruby/example_code/s3/object_exists.rb @@ -28,7 +28,7 @@ def exists? end end -# Replace bucket name and object key with an existing bucket and object that you own. +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-object.txt" diff --git a/ruby/example_code/s3/object_get.rb b/ruby/example_code/s3/object_get.rb index 6b8604d369b..7fec0e54c68 100644 --- a/ruby/example_code/s3/object_get.rb +++ b/ruby/example_code/s3/object_get.rb @@ -28,7 +28,7 @@ def get_object(target_path) end end -# Replace bucket name and object key with an existing bucket and object that you own. +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-object.txt" diff --git a/ruby/example_code/s3/object_get_encryption.rb b/ruby/example_code/s3/object_get_encryption.rb index 7c19ac03e7b..b100527ac68 100644 --- a/ruby/example_code/s3/object_get_encryption.rb +++ b/ruby/example_code/s3/object_get_encryption.rb @@ -28,7 +28,7 @@ def get_object end end -# Replace bucket name and object key with an existing bucket and object that you own. +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-object.txt" diff --git a/ruby/example_code/s3/object_presigned_url_upload.rb b/ruby/example_code/s3/object_presigned_url_upload.rb index dadd1eebfb3..16fe6b886b7 100644 --- a/ruby/example_code/s3/object_presigned_url_upload.rb +++ b/ruby/example_code/s3/object_presigned_url_upload.rb @@ -22,6 +22,7 @@ def get_presigned_url(bucket, object_key) puts "Couldn't create presigned URL for #{bucket.name}:#{object_key}. Here's why: #{e.message}" end +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-file.txt" diff --git a/ruby/example_code/s3/object_put.rb b/ruby/example_code/s3/object_put.rb index bd90aefeeb7..6d396df3839 100644 --- a/ruby/example_code/s3/object_put.rb +++ b/ruby/example_code/s3/object_put.rb @@ -28,6 +28,7 @@ def put_object(source_file_path) end end +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-object-key" diff --git a/ruby/example_code/s3/object_put_sse.rb b/ruby/example_code/s3/object_put_sse.rb index 4a14835d94b..e3164d5061b 100644 --- a/ruby/example_code/s3/object_put_sse.rb +++ b/ruby/example_code/s3/object_put_sse.rb @@ -28,6 +28,7 @@ def put_object_encrypted(object_content, encryption) end end +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-encrypted-content" diff --git a/ruby/example_code/s3/object_upload_file.rb b/ruby/example_code/s3/object_upload_file.rb index 72f8a65a911..7069e5f66a9 100644 --- a/ruby/example_code/s3/object_upload_file.rb +++ b/ruby/example_code/s3/object_upload_file.rb @@ -30,6 +30,7 @@ def upload_file(file_path) end end +# Example usage: def run_demo bucket_name = "doc-example-bucket" object_key = "my-uploaded-file" diff --git a/ruby/example_code/sns/create_topic.rb b/ruby/example_code/sns/create_topic.rb index 5d5848389ed..93254b11553 100644 --- a/ruby/example_code/sns/create_topic.rb +++ b/ruby/example_code/sns/create_topic.rb @@ -25,7 +25,7 @@ def create_topic(topic_name) end end -# Example usage +# Example usage: if $PROGRAM_NAME == __FILE__ topic_name = "YourTopicName" # Replace with your topic name sns_topic_creator = SNSTopicCreator.new diff --git a/ruby/example_code/sns/enable_resource.rb b/ruby/example_code/sns/enable_resource.rb index d69dcc8ab47..ad18720a90e 100644 --- a/ruby/example_code/sns/enable_resource.rb +++ b/ruby/example_code/sns/enable_resource.rb @@ -57,7 +57,7 @@ def generate_policy(topic_arn, resource_arn) end end -# Main execution if the script is run directly +# Example usage: if $PROGRAM_NAME == __FILE__ topic_arn = "MY_TOPIC_ARN" # Should be replaced with a real topic ARN resource_arn = "MY_RESOURCE_ARN" # Should be replaced with a real resource ARN diff --git a/ruby/example_code/sns/send_message.rb b/ruby/example_code/sns/send_message.rb index 58137a3dfd3..945a6f7e531 100644 --- a/ruby/example_code/sns/send_message.rb +++ b/ruby/example_code/sns/send_message.rb @@ -27,7 +27,7 @@ def send_message(topic_arn, message) end end -# Main execution if the script is run directly +# Example usage: if $PROGRAM_NAME == __FILE__ topic_arn = "SNS_TOPIC_ARN" # Should be replaced with a real topic ARN message = "MESSAGE" # Should be replaced with the actual message content diff --git a/ruby/example_code/sns/show_subscriptions.rb b/ruby/example_code/sns/show_subscriptions.rb index ea215d069fb..1050f022822 100644 --- a/ruby/example_code/sns/show_subscriptions.rb +++ b/ruby/example_code/sns/show_subscriptions.rb @@ -24,6 +24,7 @@ def list_subscriptions(topic_arn) end end +# Example usage: if $PROGRAM_NAME == __FILE__ sns_client = Aws::SNS::Client.new topic_arn = "SNS_TOPIC_ARN" # Replace with your SNS topic ARN diff --git a/ruby/example_code/sns/show_topics.rb b/ruby/example_code/sns/show_topics.rb index 0289bcdfaba..64c15a4ec08 100644 --- a/ruby/example_code/sns/show_topics.rb +++ b/ruby/example_code/sns/show_topics.rb @@ -33,6 +33,8 @@ def run_me exit 1 end end + +# Example usage: run_me if $PROGRAM_NAME == __FILE__ # snippet-end:[sns.Ruby.showTopics] diff --git a/ruby/example_code/sqs/create_queue.rb b/ruby/example_code/sqs/create_queue.rb index 086b84c4c84..4c3b0c7ec62 100644 --- a/ruby/example_code/sqs/create_queue.rb +++ b/ruby/example_code/sqs/create_queue.rb @@ -40,5 +40,6 @@ def run_me end end +# Example usage: run_me if $PROGRAM_NAME == __FILE__ # snippet-end:[ruby.example_code.sqs.CreateQueue] diff --git a/ruby/example_code/sqs/receive_messages.rb b/ruby/example_code/sqs/receive_messages.rb index 1f0fdb8198c..86f36637063 100644 --- a/ruby/example_code/sqs/receive_messages.rb +++ b/ruby/example_code/sqs/receive_messages.rb @@ -71,5 +71,6 @@ def run_me receive_messages(sqs_client, queue_url, max_number_of_messages) end +# Example usage: run_me if $PROGRAM_NAME == __FILE__ # snippet-end:[ruby.example_code.sqs.ReceiveMessages] diff --git a/ruby/example_code/sqs/send_message.rb b/ruby/example_code/sqs/send_message.rb index 860bb65b076..174d69f3583 100644 --- a/ruby/example_code/sqs/send_message.rb +++ b/ruby/example_code/sqs/send_message.rb @@ -55,5 +55,6 @@ def run_me end end +# Example usage: run_me if $PROGRAM_NAME == __FILE__ # snippet-end:[ruby.example_code.sqs.SendMessage]