diff --git a/CHANGELOG.md b/CHANGELOG.md index f997ff47..65d7a9f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.3.7](https://github.com/googleapis/java-tasks/compare/v2.3.6...v2.3.7) (2022-09-09) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#746](https://github.com/googleapis/java-tasks/issues/746)) ([b39b0b3](https://github.com/googleapis/java-tasks/commit/b39b0b374bc158401d33287f7e88cd2622e342ff)) + ## [2.3.6](https://github.com/googleapis/java-tasks/compare/v2.3.5...v2.3.6) (2022-08-05) diff --git a/README.md b/README.md index 6d41e5c2..d35094a3 100644 --- a/README.md +++ b/README.md @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-tasks - 2.3.5 + 2.3.6 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-tasks:2.3.5' +implementation 'com.google.cloud:google-cloud-tasks:2.3.6' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-tasks" % "2.3.5" +libraryDependencies += "com.google.cloud" % "google-cloud-tasks" % "2.3.6" ``` ## Authentication diff --git a/google-cloud-tasks-bom/pom.xml b/google-cloud-tasks-bom/pom.xml index 53913e9e..04ebf785 100644 --- a/google-cloud-tasks-bom/pom.xml +++ b/google-cloud-tasks-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-tasks-bom - 2.3.6 + 2.3.7 pom com.google.cloud @@ -52,37 +52,37 @@ com.google.cloud google-cloud-tasks - 2.3.6 + 2.3.7 com.google.api.grpc grpc-google-cloud-tasks-v2beta3 - 0.93.6 + 0.93.7 com.google.api.grpc grpc-google-cloud-tasks-v2beta2 - 0.93.6 + 0.93.7 com.google.api.grpc grpc-google-cloud-tasks-v2 - 2.3.6 + 2.3.7 com.google.api.grpc proto-google-cloud-tasks-v2beta3 - 0.93.6 + 0.93.7 com.google.api.grpc proto-google-cloud-tasks-v2beta2 - 0.93.6 + 0.93.7 com.google.api.grpc proto-google-cloud-tasks-v2 - 2.3.6 + 2.3.7 diff --git a/google-cloud-tasks/pom.xml b/google-cloud-tasks/pom.xml index 41452c0c..18089ab5 100644 --- a/google-cloud-tasks/pom.xml +++ b/google-cloud-tasks/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-tasks - 2.3.6 + 2.3.7 jar Google Cloud Tasks https://github.com/googleapis/java-tasks @@ -11,7 +11,7 @@ com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 google-cloud-tasks diff --git a/grpc-google-cloud-tasks-v2/pom.xml b/grpc-google-cloud-tasks-v2/pom.xml index a96d3333..841046df 100644 --- a/grpc-google-cloud-tasks-v2/pom.xml +++ b/grpc-google-cloud-tasks-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-tasks-v2 - 2.3.6 + 2.3.7 grpc-google-cloud-tasks-v2 GRPC library for grpc-google-cloud-tasks-v2 com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 diff --git a/grpc-google-cloud-tasks-v2beta2/pom.xml b/grpc-google-cloud-tasks-v2beta2/pom.xml index 2f07675d..55a9f3f5 100644 --- a/grpc-google-cloud-tasks-v2beta2/pom.xml +++ b/grpc-google-cloud-tasks-v2beta2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-tasks-v2beta2 - 0.93.6 + 0.93.7 grpc-google-cloud-tasks-v2beta2 GRPC library for grpc-google-cloud-tasks-v2beta2 com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 diff --git a/grpc-google-cloud-tasks-v2beta3/pom.xml b/grpc-google-cloud-tasks-v2beta3/pom.xml index 7bc8d12a..185da7b8 100644 --- a/grpc-google-cloud-tasks-v2beta3/pom.xml +++ b/grpc-google-cloud-tasks-v2beta3/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-tasks-v2beta3 - 0.93.6 + 0.93.7 grpc-google-cloud-tasks-v2beta3 GRPC library for grpc-google-cloud-tasks-v2beta3 com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 diff --git a/pom.xml b/pom.xml index 384719d5..843d6fc7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-tasks-parent pom - 2.3.6 + 2.3.7 Google Cloud Tasks Parent https://github.com/googleapis/java-tasks @@ -61,43 +61,43 @@ com.google.api.grpc proto-google-cloud-tasks-v2beta3 - 0.93.6 + 0.93.7 com.google.api.grpc proto-google-cloud-tasks-v2beta2 - 0.93.6 + 0.93.7 com.google.api.grpc proto-google-cloud-tasks-v2 - 2.3.6 + 2.3.7 com.google.api.grpc grpc-google-cloud-tasks-v2beta3 - 0.93.6 + 0.93.7 com.google.api.grpc grpc-google-cloud-tasks-v2beta2 - 0.93.6 + 0.93.7 com.google.api.grpc grpc-google-cloud-tasks-v2 - 2.3.6 + 2.3.7 com.google.cloud google-cloud-tasks - 2.3.6 + 2.3.7 com.google.cloud google-cloud-shared-dependencies - 3.0.1 + 3.0.2 pom import @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.4.0 + 3.4.1 @@ -171,7 +171,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.0 + 3.4.1 html diff --git a/proto-google-cloud-tasks-v2/pom.xml b/proto-google-cloud-tasks-v2/pom.xml index c8e57400..4c38c556 100644 --- a/proto-google-cloud-tasks-v2/pom.xml +++ b/proto-google-cloud-tasks-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-tasks-v2 - 2.3.6 + 2.3.7 proto-google-cloud-tasks-v2 PROTO library for proto-google-cloud-tasks-v2 com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 diff --git a/proto-google-cloud-tasks-v2beta2/pom.xml b/proto-google-cloud-tasks-v2beta2/pom.xml index dc911bf9..8afae7e7 100644 --- a/proto-google-cloud-tasks-v2beta2/pom.xml +++ b/proto-google-cloud-tasks-v2beta2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-tasks-v2beta2 - 0.93.6 + 0.93.7 proto-google-cloud-tasks-v2beta2 PROTO library for proto-google-cloud-tasks-v2beta2 com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 diff --git a/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/QueueProto.java b/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/QueueProto.java index 39c576fa..8d5cd837 100644 --- a/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/QueueProto.java +++ b/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/QueueProto.java @@ -57,45 +57,44 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "/field_behavior.proto\032\031google/api/resour" + "ce.proto\032\'google/cloud/tasks/v2beta2/tar" + "get.proto\032\036google/protobuf/duration.prot" - + "o\032\037google/protobuf/timestamp.proto\032\034goog" - + "le/api/annotations.proto\"\332\005\n\005Queue\022\014\n\004na" - + "me\030\001 \001(\t\022Q\n\026app_engine_http_target\030\003 \001(\013" - + "2/.google.cloud.tasks.v2beta2.AppEngineH" - + "ttpTargetH\000\022=\n\013pull_target\030\004 \001(\0132&.googl" - + "e.cloud.tasks.v2beta2.PullTargetH\000\022;\n\013ra" - + "te_limits\030\005 \001(\0132&.google.cloud.tasks.v2b" - + "eta2.RateLimits\022=\n\014retry_config\030\006 \001(\0132\'." - + "google.cloud.tasks.v2beta2.RetryConfig\0226" - + "\n\005state\030\007 \001(\0162\'.google.cloud.tasks.v2bet" - + "a2.Queue.State\022.\n\npurge_time\030\010 \001(\0132\032.goo" - + "gle.protobuf.Timestamp\022+\n\010task_ttl\030\t \001(\013" - + "2\031.google.protobuf.Duration\0220\n\rtombstone" - + "_ttl\030\n \001(\0132\031.google.protobuf.Duration\022:\n" - + "\005stats\030\020 \001(\0132&.google.cloud.tasks.v2beta" - + "2.QueueStatsB\003\340A\003\"E\n\005State\022\025\n\021STATE_UNSP" - + "ECIFIED\020\000\022\013\n\007RUNNING\020\001\022\n\n\006PAUSED\020\002\022\014\n\010DI" - + "SABLED\020\003:\\\352AY\n\037cloudtasks.googleapis.com" - + "/Queue\0226projects/{project}/locations/{lo" - + "cation}/queues/{queue}B\r\n\013target_type\"k\n" - + "\nRateLimits\022\'\n\037max_tasks_dispatched_per_" - + "second\030\001 \001(\001\022\026\n\016max_burst_size\030\002 \001(\005\022\034\n\024" - + "max_concurrent_tasks\030\003 \001(\005\"\201\002\n\013RetryConf" - + "ig\022\026\n\014max_attempts\030\001 \001(\005H\000\022\034\n\022unlimited_" - + "attempts\030\002 \001(\010H\000\0225\n\022max_retry_duration\030\003" - + " \001(\0132\031.google.protobuf.Duration\022.\n\013min_b" - + "ackoff\030\004 \001(\0132\031.google.protobuf.Duration\022" - + ".\n\013max_backoff\030\005 \001(\0132\031.google.protobuf.D" - + "uration\022\025\n\rmax_doublings\030\006 \001(\005B\016\n\014num_at" - + "tempts\"\350\001\n\nQueueStats\022\030\n\013tasks_count\030\001 \001" - + "(\003B\003\340A\003\022F\n\035oldest_estimated_arrival_time" - + "\030\002 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022" - + "\'\n\032executed_last_minute_count\030\003 \001(\003B\003\340A\003" - + "\022(\n\033concurrent_dispatches_count\030\004 \001(\003B\003\340" - + "A\003\022%\n\030effective_execution_rate\030\005 \001(\001B\003\340A" - + "\003Bo\n\036com.google.cloud.tasks.v2beta2B\nQue" - + "ueProtoP\001Z?google.golang.org/genproto/go" - + "ogleapis/cloud/tasks/v2beta2;tasksb\006prot" - + "o3" + + "o\032\037google/protobuf/timestamp.proto\"\332\005\n\005Q" + + "ueue\022\014\n\004name\030\001 \001(\t\022Q\n\026app_engine_http_ta" + + "rget\030\003 \001(\0132/.google.cloud.tasks.v2beta2." + + "AppEngineHttpTargetH\000\022=\n\013pull_target\030\004 \001" + + "(\0132&.google.cloud.tasks.v2beta2.PullTarg" + + "etH\000\022;\n\013rate_limits\030\005 \001(\0132&.google.cloud" + + ".tasks.v2beta2.RateLimits\022=\n\014retry_confi" + + "g\030\006 \001(\0132\'.google.cloud.tasks.v2beta2.Ret" + + "ryConfig\0226\n\005state\030\007 \001(\0162\'.google.cloud.t" + + "asks.v2beta2.Queue.State\022.\n\npurge_time\030\010" + + " \001(\0132\032.google.protobuf.Timestamp\022+\n\010task" + + "_ttl\030\t \001(\0132\031.google.protobuf.Duration\0220\n" + + "\rtombstone_ttl\030\n \001(\0132\031.google.protobuf.D" + + "uration\022:\n\005stats\030\020 \001(\0132&.google.cloud.ta" + + "sks.v2beta2.QueueStatsB\003\340A\003\"E\n\005State\022\025\n\021" + + "STATE_UNSPECIFIED\020\000\022\013\n\007RUNNING\020\001\022\n\n\006PAUS" + + "ED\020\002\022\014\n\010DISABLED\020\003:\\\352AY\n\037cloudtasks.goog" + + "leapis.com/Queue\0226projects/{project}/loc" + + "ations/{location}/queues/{queue}B\r\n\013targ" + + "et_type\"k\n\nRateLimits\022\'\n\037max_tasks_dispa" + + "tched_per_second\030\001 \001(\001\022\026\n\016max_burst_size" + + "\030\002 \001(\005\022\034\n\024max_concurrent_tasks\030\003 \001(\005\"\201\002\n" + + "\013RetryConfig\022\026\n\014max_attempts\030\001 \001(\005H\000\022\034\n\022" + + "unlimited_attempts\030\002 \001(\010H\000\0225\n\022max_retry_" + + "duration\030\003 \001(\0132\031.google.protobuf.Duratio" + + "n\022.\n\013min_backoff\030\004 \001(\0132\031.google.protobuf" + + ".Duration\022.\n\013max_backoff\030\005 \001(\0132\031.google." + + "protobuf.Duration\022\025\n\rmax_doublings\030\006 \001(\005" + + "B\016\n\014num_attempts\"\350\001\n\nQueueStats\022\030\n\013tasks" + + "_count\030\001 \001(\003B\003\340A\003\022F\n\035oldest_estimated_ar" + + "rival_time\030\002 \001(\0132\032.google.protobuf.Times" + + "tampB\003\340A\003\022\'\n\032executed_last_minute_count\030" + + "\003 \001(\003B\003\340A\003\022(\n\033concurrent_dispatches_coun" + + "t\030\004 \001(\003B\003\340A\003\022%\n\030effective_execution_rate" + + "\030\005 \001(\001B\003\340A\003Bo\n\036com.google.cloud.tasks.v2" + + "beta2B\nQueueProtoP\001Z?google.golang.org/g" + + "enproto/googleapis/cloud/tasks/v2beta2;t" + + "asksb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -106,7 +105,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.tasks.v2beta2.TargetProto.getDescriptor(), com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_cloud_tasks_v2beta2_Queue_descriptor = getDescriptor().getMessageTypes().get(0); @@ -171,7 +169,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.tasks.v2beta2.TargetProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TargetProto.java b/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TargetProto.java index 2ec60f36..7f55c35d 100644 --- a/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TargetProto.java +++ b/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TargetProto.java @@ -61,35 +61,31 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\'google/cloud/tasks/v2beta2/target.prot" - + "o\022\032google.cloud.tasks.v2beta2\032\034google/ap" - + "i/annotations.proto\"\014\n\nPullTarget\"+\n\013Pul" - + "lMessage\022\017\n\007payload\030\001 \001(\014\022\013\n\003tag\030\002 \001(\t\"h" - + "\n\023AppEngineHttpTarget\022Q\n\033app_engine_rout" - + "ing_override\030\001 \001(\0132,.google.cloud.tasks." - + "v2beta2.AppEngineRouting\"\304\002\n\024AppEngineHt" - + "tpRequest\022;\n\013http_method\030\001 \001(\0162&.google." - + "cloud.tasks.v2beta2.HttpMethod\022H\n\022app_en" - + "gine_routing\030\002 \001(\0132,.google.cloud.tasks." - + "v2beta2.AppEngineRouting\022\024\n\014relative_url" - + "\030\003 \001(\t\022N\n\007headers\030\004 \003(\0132=.google.cloud.t" - + "asks.v2beta2.AppEngineHttpRequest.Header" - + "sEntry\022\017\n\007payload\030\005 \001(\014\032.\n\014HeadersEntry\022" - + "\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"T\n\020AppEn" - + "gineRouting\022\017\n\007service\030\001 \001(\t\022\017\n\007version\030" - + "\002 \001(\t\022\020\n\010instance\030\003 \001(\t\022\014\n\004host\030\004 \001(\t*[\n" - + "\nHttpMethod\022\033\n\027HTTP_METHOD_UNSPECIFIED\020\000" - + "\022\010\n\004POST\020\001\022\007\n\003GET\020\002\022\010\n\004HEAD\020\003\022\007\n\003PUT\020\004\022\n" - + "\n\006DELETE\020\005Bp\n\036com.google.cloud.tasks.v2b" - + "eta2B\013TargetProtoP\001Z?google.golang.org/g" - + "enproto/googleapis/cloud/tasks/v2beta2;t" - + "asksb\006proto3" + + "o\022\032google.cloud.tasks.v2beta2\"\014\n\nPullTar" + + "get\"+\n\013PullMessage\022\017\n\007payload\030\001 \001(\014\022\013\n\003t" + + "ag\030\002 \001(\t\"h\n\023AppEngineHttpTarget\022Q\n\033app_e" + + "ngine_routing_override\030\001 \001(\0132,.google.cl" + + "oud.tasks.v2beta2.AppEngineRouting\"\304\002\n\024A" + + "ppEngineHttpRequest\022;\n\013http_method\030\001 \001(\016" + + "2&.google.cloud.tasks.v2beta2.HttpMethod" + + "\022H\n\022app_engine_routing\030\002 \001(\0132,.google.cl" + + "oud.tasks.v2beta2.AppEngineRouting\022\024\n\014re" + + "lative_url\030\003 \001(\t\022N\n\007headers\030\004 \003(\0132=.goog" + + "le.cloud.tasks.v2beta2.AppEngineHttpRequ" + + "est.HeadersEntry\022\017\n\007payload\030\005 \001(\014\032.\n\014Hea" + + "dersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028" + + "\001\"T\n\020AppEngineRouting\022\017\n\007service\030\001 \001(\t\022\017" + + "\n\007version\030\002 \001(\t\022\020\n\010instance\030\003 \001(\t\022\014\n\004hos" + + "t\030\004 \001(\t*[\n\nHttpMethod\022\033\n\027HTTP_METHOD_UNS" + + "PECIFIED\020\000\022\010\n\004POST\020\001\022\007\n\003GET\020\002\022\010\n\004HEAD\020\003\022" + + "\007\n\003PUT\020\004\022\n\n\006DELETE\020\005Bp\n\036com.google.cloud" + + ".tasks.v2beta2B\013TargetProtoP\001Z?google.go" + + "lang.org/genproto/googleapis/cloud/tasks" + + "/v2beta2;tasksb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.AnnotationsProto.getDescriptor(), - }); + descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); internal_static_google_cloud_tasks_v2beta2_PullTarget_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_cloud_tasks_v2beta2_PullTarget_fieldAccessorTable = @@ -138,7 +134,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Service", "Version", "Instance", "Host", }); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TaskProto.java b/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TaskProto.java index a0c50640..64bafdcd 100644 --- a/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TaskProto.java +++ b/proto-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/TaskProto.java @@ -52,36 +52,35 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\032google.cloud.tasks.v2beta2\032\031google/api/" + "resource.proto\032\'google/cloud/tasks/v2bet" + "a2/target.proto\032\037google/protobuf/timesta" - + "mp.proto\032\027google/rpc/status.proto\032\034googl" - + "e/api/annotations.proto\"\250\004\n\004Task\022\014\n\004name" - + "\030\001 \001(\t\022S\n\027app_engine_http_request\030\003 \001(\0132" - + "0.google.cloud.tasks.v2beta2.AppEngineHt" - + "tpRequestH\000\022?\n\014pull_message\030\004 \001(\0132\'.goog" - + "le.cloud.tasks.v2beta2.PullMessageH\000\0221\n\r" - + "schedule_time\030\005 \001(\0132\032.google.protobuf.Ti" - + "mestamp\022/\n\013create_time\030\006 \001(\0132\032.google.pr" - + "otobuf.Timestamp\0226\n\006status\030\007 \001(\0132&.googl" - + "e.cloud.tasks.v2beta2.TaskStatus\0223\n\004view" - + "\030\010 \001(\0162%.google.cloud.tasks.v2beta2.Task" - + ".View\"1\n\004View\022\024\n\020VIEW_UNSPECIFIED\020\000\022\t\n\005B" - + "ASIC\020\001\022\010\n\004FULL\020\002:h\352Ae\n\036cloudtasks.google" - + "apis.com/Task\022Cprojects/{project}/locati" - + "ons/{location}/queues/{queue}/tasks/{tas" - + "k}B\016\n\014payload_type\"\335\001\n\nTaskStatus\022\036\n\026att" - + "empt_dispatch_count\030\001 \001(\005\022\036\n\026attempt_res" - + "ponse_count\030\002 \001(\005\022G\n\024first_attempt_statu" - + "s\030\003 \001(\0132).google.cloud.tasks.v2beta2.Att" - + "emptStatus\022F\n\023last_attempt_status\030\004 \001(\0132" - + ").google.cloud.tasks.v2beta2.AttemptStat" - + "us\"\325\001\n\rAttemptStatus\0221\n\rschedule_time\030\001 " - + "\001(\0132\032.google.protobuf.Timestamp\0221\n\rdispa" - + "tch_time\030\002 \001(\0132\032.google.protobuf.Timesta" - + "mp\0221\n\rresponse_time\030\003 \001(\0132\032.google.proto" - + "buf.Timestamp\022+\n\017response_status\030\004 \001(\0132\022" - + ".google.rpc.StatusBn\n\036com.google.cloud.t" - + "asks.v2beta2B\tTaskProtoP\001Z?google.golang" - + ".org/genproto/googleapis/cloud/tasks/v2b" - + "eta2;tasksb\006proto3" + + "mp.proto\032\027google/rpc/status.proto\"\250\004\n\004Ta" + + "sk\022\014\n\004name\030\001 \001(\t\022S\n\027app_engine_http_requ" + + "est\030\003 \001(\01320.google.cloud.tasks.v2beta2.A" + + "ppEngineHttpRequestH\000\022?\n\014pull_message\030\004 " + + "\001(\0132\'.google.cloud.tasks.v2beta2.PullMes" + + "sageH\000\0221\n\rschedule_time\030\005 \001(\0132\032.google.p" + + "rotobuf.Timestamp\022/\n\013create_time\030\006 \001(\0132\032" + + ".google.protobuf.Timestamp\0226\n\006status\030\007 \001" + + "(\0132&.google.cloud.tasks.v2beta2.TaskStat" + + "us\0223\n\004view\030\010 \001(\0162%.google.cloud.tasks.v2" + + "beta2.Task.View\"1\n\004View\022\024\n\020VIEW_UNSPECIF" + + "IED\020\000\022\t\n\005BASIC\020\001\022\010\n\004FULL\020\002:h\352Ae\n\036cloudta" + + "sks.googleapis.com/Task\022Cprojects/{proje" + + "ct}/locations/{location}/queues/{queue}/" + + "tasks/{task}B\016\n\014payload_type\"\335\001\n\nTaskSta" + + "tus\022\036\n\026attempt_dispatch_count\030\001 \001(\005\022\036\n\026a" + + "ttempt_response_count\030\002 \001(\005\022G\n\024first_att" + + "empt_status\030\003 \001(\0132).google.cloud.tasks.v" + + "2beta2.AttemptStatus\022F\n\023last_attempt_sta" + + "tus\030\004 \001(\0132).google.cloud.tasks.v2beta2.A" + + "ttemptStatus\"\325\001\n\rAttemptStatus\0221\n\rschedu" + + "le_time\030\001 \001(\0132\032.google.protobuf.Timestam" + + "p\0221\n\rdispatch_time\030\002 \001(\0132\032.google.protob" + + "uf.Timestamp\0221\n\rresponse_time\030\003 \001(\0132\032.go" + + "ogle.protobuf.Timestamp\022+\n\017response_stat" + + "us\030\004 \001(\0132\022.google.rpc.StatusBn\n\036com.goog" + + "le.cloud.tasks.v2beta2B\tTaskProtoP\001Z?goo" + + "gle.golang.org/genproto/googleapis/cloud" + + "/tasks/v2beta2;tasksb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -91,7 +90,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.tasks.v2beta2.TargetProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.rpc.StatusProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_cloud_tasks_v2beta2_Task_descriptor = getDescriptor().getMessageTypes().get(0); @@ -136,7 +134,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.tasks.v2beta2.TargetProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.rpc.StatusProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/queue.proto b/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/queue.proto index f988d80c..2d6ba2e1 100644 --- a/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/queue.proto +++ b/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/queue.proto @@ -21,7 +21,6 @@ import "google/api/resource.proto"; import "google/cloud/tasks/v2beta2/target.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2;tasks"; option java_multiple_files = true; diff --git a/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/target.proto b/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/target.proto index 09c8fd78..7ee837db 100644 --- a/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/target.proto +++ b/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/target.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.tasks.v2beta2; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2;tasks"; option java_multiple_files = true; diff --git a/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/task.proto b/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/task.proto index 873a6f93..5e5c3575 100644 --- a/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/task.proto +++ b/proto-google-cloud-tasks-v2beta2/src/main/proto/google/cloud/tasks/v2beta2/task.proto @@ -20,7 +20,6 @@ import "google/api/resource.proto"; import "google/cloud/tasks/v2beta2/target.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2;tasks"; option java_multiple_files = true; diff --git a/proto-google-cloud-tasks-v2beta3/pom.xml b/proto-google-cloud-tasks-v2beta3/pom.xml index d521680e..bd63a630 100644 --- a/proto-google-cloud-tasks-v2beta3/pom.xml +++ b/proto-google-cloud-tasks-v2beta3/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-tasks-v2beta3 - 0.93.6 + 0.93.7 proto-google-cloud-tasks-v2beta3 PROTO library for proto-google-cloud-tasks-v2beta3 com.google.cloud google-cloud-tasks-parent - 2.3.6 + 2.3.7 diff --git a/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/QueueProto.java b/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/QueueProto.java index 6e32a784..6bee2e5e 100644 --- a/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/QueueProto.java +++ b/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/QueueProto.java @@ -61,48 +61,47 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "/field_behavior.proto\032\031google/api/resour" + "ce.proto\032\'google/cloud/tasks/v2beta3/tar" + "get.proto\032\036google/protobuf/duration.prot" - + "o\032\037google/protobuf/timestamp.proto\032\034goog" - + "le/api/annotations.proto\"\337\006\n\005Queue\022\014\n\004na" - + "me\030\001 \001(\t\022O\n\025app_engine_http_queue\030\003 \001(\0132" - + "..google.cloud.tasks.v2beta3.AppEngineHt" - + "tpQueueH\000\022;\n\013rate_limits\030\004 \001(\0132&.google." - + "cloud.tasks.v2beta3.RateLimits\022=\n\014retry_" - + "config\030\005 \001(\0132\'.google.cloud.tasks.v2beta" - + "3.RetryConfig\0226\n\005state\030\006 \001(\0162\'.google.cl" - + "oud.tasks.v2beta3.Queue.State\022.\n\npurge_t" - + "ime\030\007 \001(\0132\032.google.protobuf.Timestamp\022+\n" - + "\010task_ttl\030\010 \001(\0132\031.google.protobuf.Durati" - + "on\0220\n\rtombstone_ttl\030\t \001(\0132\031.google.proto" - + "buf.Duration\022X\n\032stackdriver_logging_conf" - + "ig\030\n \001(\01324.google.cloud.tasks.v2beta3.St" - + "ackdriverLoggingConfig\0229\n\004type\030\013 \001(\0162&.g" - + "oogle.cloud.tasks.v2beta3.Queue.TypeB\003\340A" - + "\005\022:\n\005stats\030\014 \001(\0132&.google.cloud.tasks.v2" - + "beta3.QueueStatsB\003\340A\003\"E\n\005State\022\025\n\021STATE_" - + "UNSPECIFIED\020\000\022\013\n\007RUNNING\020\001\022\n\n\006PAUSED\020\002\022\014" - + "\n\010DISABLED\020\003\"0\n\004Type\022\024\n\020TYPE_UNSPECIFIED" - + "\020\000\022\010\n\004PULL\020\001\022\010\n\004PUSH\020\002:\\\352AY\n\037cloudtasks." - + "googleapis.com/Queue\0226projects/{project}" - + "/locations/{location}/queues/{queue}B\014\n\n" - + "queue_type\"j\n\nRateLimits\022!\n\031max_dispatch" - + "es_per_second\030\001 \001(\001\022\026\n\016max_burst_size\030\002 " - + "\001(\005\022!\n\031max_concurrent_dispatches\030\003 \001(\005\"\321" - + "\001\n\013RetryConfig\022\024\n\014max_attempts\030\001 \001(\005\0225\n\022" - + "max_retry_duration\030\002 \001(\0132\031.google.protob" - + "uf.Duration\022.\n\013min_backoff\030\003 \001(\0132\031.googl" - + "e.protobuf.Duration\022.\n\013max_backoff\030\004 \001(\013" - + "2\031.google.protobuf.Duration\022\025\n\rmax_doubl" - + "ings\030\005 \001(\005\"2\n\030StackdriverLoggingConfig\022\026" - + "\n\016sampling_ratio\030\001 \001(\001\"\350\001\n\nQueueStats\022\030\n" - + "\013tasks_count\030\001 \001(\003B\003\340A\003\022F\n\035oldest_estima" - + "ted_arrival_time\030\002 \001(\0132\032.google.protobuf" - + ".TimestampB\003\340A\003\022\'\n\032executed_last_minute_" - + "count\030\003 \001(\003B\003\340A\003\022(\n\033concurrent_dispatche" - + "s_count\030\004 \001(\003B\003\340A\003\022%\n\030effective_executio" - + "n_rate\030\005 \001(\001B\003\340A\003Bo\n\036com.google.cloud.ta" - + "sks.v2beta3B\nQueueProtoP\001Z?google.golang" - + ".org/genproto/googleapis/cloud/tasks/v2b" - + "eta3;tasksb\006proto3" + + "o\032\037google/protobuf/timestamp.proto\"\337\006\n\005Q" + + "ueue\022\014\n\004name\030\001 \001(\t\022O\n\025app_engine_http_qu" + + "eue\030\003 \001(\0132..google.cloud.tasks.v2beta3.A" + + "ppEngineHttpQueueH\000\022;\n\013rate_limits\030\004 \001(\013" + + "2&.google.cloud.tasks.v2beta3.RateLimits" + + "\022=\n\014retry_config\030\005 \001(\0132\'.google.cloud.ta" + + "sks.v2beta3.RetryConfig\0226\n\005state\030\006 \001(\0162\'" + + ".google.cloud.tasks.v2beta3.Queue.State\022" + + ".\n\npurge_time\030\007 \001(\0132\032.google.protobuf.Ti" + + "mestamp\022+\n\010task_ttl\030\010 \001(\0132\031.google.proto" + + "buf.Duration\0220\n\rtombstone_ttl\030\t \001(\0132\031.go" + + "ogle.protobuf.Duration\022X\n\032stackdriver_lo" + + "gging_config\030\n \001(\01324.google.cloud.tasks." + + "v2beta3.StackdriverLoggingConfig\0229\n\004type" + + "\030\013 \001(\0162&.google.cloud.tasks.v2beta3.Queu" + + "e.TypeB\003\340A\005\022:\n\005stats\030\014 \001(\0132&.google.clou" + + "d.tasks.v2beta3.QueueStatsB\003\340A\003\"E\n\005State" + + "\022\025\n\021STATE_UNSPECIFIED\020\000\022\013\n\007RUNNING\020\001\022\n\n\006" + + "PAUSED\020\002\022\014\n\010DISABLED\020\003\"0\n\004Type\022\024\n\020TYPE_U" + + "NSPECIFIED\020\000\022\010\n\004PULL\020\001\022\010\n\004PUSH\020\002:\\\352AY\n\037c" + + "loudtasks.googleapis.com/Queue\0226projects" + + "/{project}/locations/{location}/queues/{" + + "queue}B\014\n\nqueue_type\"j\n\nRateLimits\022!\n\031ma" + + "x_dispatches_per_second\030\001 \001(\001\022\026\n\016max_bur" + + "st_size\030\002 \001(\005\022!\n\031max_concurrent_dispatch" + + "es\030\003 \001(\005\"\321\001\n\013RetryConfig\022\024\n\014max_attempts" + + "\030\001 \001(\005\0225\n\022max_retry_duration\030\002 \001(\0132\031.goo" + + "gle.protobuf.Duration\022.\n\013min_backoff\030\003 \001" + + "(\0132\031.google.protobuf.Duration\022.\n\013max_bac" + + "koff\030\004 \001(\0132\031.google.protobuf.Duration\022\025\n" + + "\rmax_doublings\030\005 \001(\005\"2\n\030StackdriverLoggi" + + "ngConfig\022\026\n\016sampling_ratio\030\001 \001(\001\"\350\001\n\nQue" + + "ueStats\022\030\n\013tasks_count\030\001 \001(\003B\003\340A\003\022F\n\035old" + + "est_estimated_arrival_time\030\002 \001(\0132\032.googl" + + "e.protobuf.TimestampB\003\340A\003\022\'\n\032executed_la" + + "st_minute_count\030\003 \001(\003B\003\340A\003\022(\n\033concurrent" + + "_dispatches_count\030\004 \001(\003B\003\340A\003\022%\n\030effectiv" + + "e_execution_rate\030\005 \001(\001B\003\340A\003Bo\n\036com.googl" + + "e.cloud.tasks.v2beta3B\nQueueProtoP\001Z?goo" + + "gle.golang.org/genproto/googleapis/cloud" + + "/tasks/v2beta3;tasksb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -113,7 +112,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.tasks.v2beta3.TargetProto.getDescriptor(), com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_cloud_tasks_v2beta3_Queue_descriptor = getDescriptor().getMessageTypes().get(0); @@ -181,7 +179,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.tasks.v2beta3.TargetProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TargetProto.java b/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TargetProto.java index b76a8c8c..279f80b8 100644 --- a/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TargetProto.java +++ b/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TargetProto.java @@ -73,47 +73,44 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\'google/cloud/tasks/v2beta3/target.prot" - + "o\022\032google.cloud.tasks.v2beta3\032\034google/ap" - + "i/annotations.proto\"+\n\013PullMessage\022\017\n\007pa" - + "yload\030\001 \001(\014\022\013\n\003tag\030\002 \001(\t\"\360\002\n\013HttpRequest" - + "\022\013\n\003url\030\001 \001(\t\022;\n\013http_method\030\002 \001(\0162&.goo" - + "gle.cloud.tasks.v2beta3.HttpMethod\022E\n\007he" - + "aders\030\003 \003(\01324.google.cloud.tasks.v2beta3" - + ".HttpRequest.HeadersEntry\022\014\n\004body\030\004 \001(\014\022" - + "=\n\013oauth_token\030\005 \001(\0132&.google.cloud.task" - + "s.v2beta3.OAuthTokenH\000\022;\n\noidc_token\030\006 \001" - + "(\0132%.google.cloud.tasks.v2beta3.OidcToke" - + "nH\000\032.\n\014HeadersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" - + "e\030\002 \001(\t:\0028\001B\026\n\024authorization_header\"g\n\022A" - + "ppEngineHttpQueue\022Q\n\033app_engine_routing_" - + "override\030\001 \001(\0132,.google.cloud.tasks.v2be" - + "ta3.AppEngineRouting\"\301\002\n\024AppEngineHttpRe" - + "quest\022;\n\013http_method\030\001 \001(\0162&.google.clou" - + "d.tasks.v2beta3.HttpMethod\022H\n\022app_engine" - + "_routing\030\002 \001(\0132,.google.cloud.tasks.v2be" - + "ta3.AppEngineRouting\022\024\n\014relative_uri\030\003 \001" - + "(\t\022N\n\007headers\030\004 \003(\0132=.google.cloud.tasks" - + ".v2beta3.AppEngineHttpRequest.HeadersEnt" - + "ry\022\014\n\004body\030\005 \001(\014\032.\n\014HeadersEntry\022\013\n\003key\030" - + "\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"T\n\020AppEngineRou" - + "ting\022\017\n\007service\030\001 \001(\t\022\017\n\007version\030\002 \001(\t\022\020" - + "\n\010instance\030\003 \001(\t\022\014\n\004host\030\004 \001(\t\":\n\nOAuthT" - + "oken\022\035\n\025service_account_email\030\001 \001(\t\022\r\n\005s" - + "cope\030\002 \001(\t\"<\n\tOidcToken\022\035\n\025service_accou" - + "nt_email\030\001 \001(\t\022\020\n\010audience\030\002 \001(\t*s\n\nHttp" - + "Method\022\033\n\027HTTP_METHOD_UNSPECIFIED\020\000\022\010\n\004P" - + "OST\020\001\022\007\n\003GET\020\002\022\010\n\004HEAD\020\003\022\007\n\003PUT\020\004\022\n\n\006DEL" - + "ETE\020\005\022\t\n\005PATCH\020\006\022\013\n\007OPTIONS\020\007Bp\n\036com.goo" - + "gle.cloud.tasks.v2beta3B\013TargetProtoP\001Z?" - + "google.golang.org/genproto/googleapis/cl" - + "oud/tasks/v2beta3;tasksb\006proto3" + + "o\022\032google.cloud.tasks.v2beta3\"+\n\013PullMes" + + "sage\022\017\n\007payload\030\001 \001(\014\022\013\n\003tag\030\002 \001(\t\"\360\002\n\013H" + + "ttpRequest\022\013\n\003url\030\001 \001(\t\022;\n\013http_method\030\002" + + " \001(\0162&.google.cloud.tasks.v2beta3.HttpMe" + + "thod\022E\n\007headers\030\003 \003(\01324.google.cloud.tas" + + "ks.v2beta3.HttpRequest.HeadersEntry\022\014\n\004b" + + "ody\030\004 \001(\014\022=\n\013oauth_token\030\005 \001(\0132&.google." + + "cloud.tasks.v2beta3.OAuthTokenH\000\022;\n\noidc" + + "_token\030\006 \001(\0132%.google.cloud.tasks.v2beta" + + "3.OidcTokenH\000\032.\n\014HeadersEntry\022\013\n\003key\030\001 \001" + + "(\t\022\r\n\005value\030\002 \001(\t:\0028\001B\026\n\024authorization_h" + + "eader\"g\n\022AppEngineHttpQueue\022Q\n\033app_engin" + + "e_routing_override\030\001 \001(\0132,.google.cloud." + + "tasks.v2beta3.AppEngineRouting\"\301\002\n\024AppEn" + + "gineHttpRequest\022;\n\013http_method\030\001 \001(\0162&.g" + + "oogle.cloud.tasks.v2beta3.HttpMethod\022H\n\022" + + "app_engine_routing\030\002 \001(\0132,.google.cloud." + + "tasks.v2beta3.AppEngineRouting\022\024\n\014relati" + + "ve_uri\030\003 \001(\t\022N\n\007headers\030\004 \003(\0132=.google.c" + + "loud.tasks.v2beta3.AppEngineHttpRequest." + + "HeadersEntry\022\014\n\004body\030\005 \001(\014\032.\n\014HeadersEnt" + + "ry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"T\n\020Ap" + + "pEngineRouting\022\017\n\007service\030\001 \001(\t\022\017\n\007versi" + + "on\030\002 \001(\t\022\020\n\010instance\030\003 \001(\t\022\014\n\004host\030\004 \001(\t" + + "\":\n\nOAuthToken\022\035\n\025service_account_email\030" + + "\001 \001(\t\022\r\n\005scope\030\002 \001(\t\"<\n\tOidcToken\022\035\n\025ser" + + "vice_account_email\030\001 \001(\t\022\020\n\010audience\030\002 \001" + + "(\t*s\n\nHttpMethod\022\033\n\027HTTP_METHOD_UNSPECIF" + + "IED\020\000\022\010\n\004POST\020\001\022\007\n\003GET\020\002\022\010\n\004HEAD\020\003\022\007\n\003PU" + + "T\020\004\022\n\n\006DELETE\020\005\022\t\n\005PATCH\020\006\022\013\n\007OPTIONS\020\007B" + + "p\n\036com.google.cloud.tasks.v2beta3B\013Targe" + + "tProtoP\001Z?google.golang.org/genproto/goo" + + "gleapis/cloud/tasks/v2beta3;tasksb\006proto" + + "3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.AnnotationsProto.getDescriptor(), - }); + descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); internal_static_google_cloud_tasks_v2beta3_PullMessage_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_cloud_tasks_v2beta3_PullMessage_fieldAccessorTable = @@ -194,7 +191,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "ServiceAccountEmail", "Audience", }); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TaskProto.java b/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TaskProto.java index e57410e2..35a52e32 100644 --- a/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TaskProto.java +++ b/proto-google-cloud-tasks-v2beta3/src/main/java/com/google/cloud/tasks/v2beta3/TaskProto.java @@ -49,36 +49,35 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "resource.proto\032\'google/cloud/tasks/v2bet" + "a3/target.proto\032\036google/protobuf/duratio" + "n.proto\032\037google/protobuf/timestamp.proto" - + "\032\027google/rpc/status.proto\032\034google/api/an" - + "notations.proto\"\216\006\n\004Task\022\014\n\004name\030\001 \001(\t\022S" - + "\n\027app_engine_http_request\030\003 \001(\01320.google" - + ".cloud.tasks.v2beta3.AppEngineHttpReques" - + "tH\000\022?\n\014http_request\030\013 \001(\0132\'.google.cloud" - + ".tasks.v2beta3.HttpRequestH\000\022?\n\014pull_mes" - + "sage\030\r \001(\0132\'.google.cloud.tasks.v2beta3." - + "PullMessageH\000\0221\n\rschedule_time\030\004 \001(\0132\032.g" - + "oogle.protobuf.Timestamp\022/\n\013create_time\030" - + "\005 \001(\0132\032.google.protobuf.Timestamp\0224\n\021dis" - + "patch_deadline\030\014 \001(\0132\031.google.protobuf.D" - + "uration\022\026\n\016dispatch_count\030\006 \001(\005\022\026\n\016respo" - + "nse_count\030\007 \001(\005\022:\n\rfirst_attempt\030\010 \001(\0132#" - + ".google.cloud.tasks.v2beta3.Attempt\0229\n\014l" - + "ast_attempt\030\t \001(\0132#.google.cloud.tasks.v" - + "2beta3.Attempt\0223\n\004view\030\n \001(\0162%.google.cl" - + "oud.tasks.v2beta3.Task.View\"1\n\004View\022\024\n\020V" - + "IEW_UNSPECIFIED\020\000\022\t\n\005BASIC\020\001\022\010\n\004FULL\020\002:h" - + "\352Ae\n\036cloudtasks.googleapis.com/Task\022Cpro" - + "jects/{project}/locations/{location}/que" - + "ues/{queue}/tasks/{task}B\016\n\014payload_type" - + "\"\317\001\n\007Attempt\0221\n\rschedule_time\030\001 \001(\0132\032.go" - + "ogle.protobuf.Timestamp\0221\n\rdispatch_time" - + "\030\002 \001(\0132\032.google.protobuf.Timestamp\0221\n\rre" - + "sponse_time\030\003 \001(\0132\032.google.protobuf.Time" - + "stamp\022+\n\017response_status\030\004 \001(\0132\022.google." - + "rpc.StatusBn\n\036com.google.cloud.tasks.v2b" - + "eta3B\tTaskProtoP\001Z?google.golang.org/gen" - + "proto/googleapis/cloud/tasks/v2beta3;tas" - + "ksb\006proto3" + + "\032\027google/rpc/status.proto\"\216\006\n\004Task\022\014\n\004na" + + "me\030\001 \001(\t\022S\n\027app_engine_http_request\030\003 \001(" + + "\01320.google.cloud.tasks.v2beta3.AppEngine" + + "HttpRequestH\000\022?\n\014http_request\030\013 \001(\0132\'.go" + + "ogle.cloud.tasks.v2beta3.HttpRequestH\000\022?" + + "\n\014pull_message\030\r \001(\0132\'.google.cloud.task" + + "s.v2beta3.PullMessageH\000\0221\n\rschedule_time" + + "\030\004 \001(\0132\032.google.protobuf.Timestamp\022/\n\013cr" + + "eate_time\030\005 \001(\0132\032.google.protobuf.Timest" + + "amp\0224\n\021dispatch_deadline\030\014 \001(\0132\031.google." + + "protobuf.Duration\022\026\n\016dispatch_count\030\006 \001(" + + "\005\022\026\n\016response_count\030\007 \001(\005\022:\n\rfirst_attem" + + "pt\030\010 \001(\0132#.google.cloud.tasks.v2beta3.At" + + "tempt\0229\n\014last_attempt\030\t \001(\0132#.google.clo" + + "ud.tasks.v2beta3.Attempt\0223\n\004view\030\n \001(\0162%" + + ".google.cloud.tasks.v2beta3.Task.View\"1\n" + + "\004View\022\024\n\020VIEW_UNSPECIFIED\020\000\022\t\n\005BASIC\020\001\022\010" + + "\n\004FULL\020\002:h\352Ae\n\036cloudtasks.googleapis.com" + + "/Task\022Cprojects/{project}/locations/{loc" + + "ation}/queues/{queue}/tasks/{task}B\016\n\014pa" + + "yload_type\"\317\001\n\007Attempt\0221\n\rschedule_time\030" + + "\001 \001(\0132\032.google.protobuf.Timestamp\0221\n\rdis" + + "patch_time\030\002 \001(\0132\032.google.protobuf.Times" + + "tamp\0221\n\rresponse_time\030\003 \001(\0132\032.google.pro" + + "tobuf.Timestamp\022+\n\017response_status\030\004 \001(\013" + + "2\022.google.rpc.StatusBn\n\036com.google.cloud" + + ".tasks.v2beta3B\tTaskProtoP\001Z?google.gola" + + "ng.org/genproto/googleapis/cloud/tasks/v" + + "2beta3;tasksb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -89,7 +88,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.rpc.StatusProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_cloud_tasks_v2beta3_Task_descriptor = getDescriptor().getMessageTypes().get(0); @@ -129,7 +127,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.rpc.StatusProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/queue.proto b/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/queue.proto index acf5a7f4..f892852b 100644 --- a/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/queue.proto +++ b/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/queue.proto @@ -21,7 +21,6 @@ import "google/api/resource.proto"; import "google/cloud/tasks/v2beta3/target.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks"; option java_multiple_files = true; diff --git a/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/target.proto b/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/target.proto index 691cf97f..efebfedf 100644 --- a/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/target.proto +++ b/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/target.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.tasks.v2beta3; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks"; option java_multiple_files = true; diff --git a/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/task.proto b/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/task.proto index 8a652566..b491b5aa 100644 --- a/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/task.proto +++ b/proto-google-cloud-tasks-v2beta3/src/main/proto/google/cloud/tasks/v2beta3/task.proto @@ -21,7 +21,6 @@ import "google/cloud/tasks/v2beta3/target.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks"; option java_multiple_files = true; diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 82a16c9f..d593b9ff 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-tasks - 2.3.5 + 2.3.6 diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 375f1b0e..ea0b8f55 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -29,7 +29,7 @@ com.google.cloud libraries-bom - 26.0.0 + 26.1.1 pom import diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 54eb4395..5b1ef082 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-tasks - 2.3.5 + 2.3.6 diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..4e05d8c0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CloudTasksSettings; +import com.google.cloud.tasks.v2.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2_generated_cloudtasksclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..38514912 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_create_setcredentialsprovider1_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CloudTasksSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setTransportChannelProvider( + CloudTasksSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2_generated_cloudtasksclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..9da8f9ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_create_setendpoint_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CloudTasksSettings; +import com.google.cloud.tasks.v2.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder().setEndpoint(myEndpoint).build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2_generated_cloudtasksclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/AsyncCreateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/AsyncCreateQueue.java new file mode 100644 index 00000000..1b2db3dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/AsyncCreateQueue.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createqueue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CreateQueueRequest; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class AsyncCreateQueue { + + public static void main(String[] args) throws Exception { + asyncCreateQueue(); + } + + public static void asyncCreateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateQueueRequest request = + CreateQueueRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQueue(Queue.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.createQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createqueue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueue.java new file mode 100644 index 00000000..11135004 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueue.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createqueue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CreateQueueRequest; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class SyncCreateQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueue(); + } + + public static void syncCreateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateQueueRequest request = + CreateQueueRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQueue(Queue.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.createQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java new file mode 100644 index 00000000..9c9fcc92 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createqueue_locationnamequeue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class SyncCreateQueueLocationnameQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueueLocationnameQueue(); + } + + public static void syncCreateQueueLocationnameQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Queue queue = Queue.newBuilder().build(); + Queue response = cloudTasksClient.createQueue(parent, queue); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createqueue_locationnamequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java new file mode 100644 index 00000000..721ffc9b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createqueue_stringqueue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class SyncCreateQueueStringQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueueStringQueue(); + } + + public static void syncCreateQueueStringQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Queue queue = Queue.newBuilder().build(); + Queue response = cloudTasksClient.createQueue(parent, queue); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createqueue_stringqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/AsyncCreateTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/AsyncCreateTask.java new file mode 100644 index 00000000..ccf2a479 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/AsyncCreateTask.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createtask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CreateTaskRequest; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class AsyncCreateTask { + + public static void main(String[] args) throws Exception { + asyncCreateTask(); + } + + public static void asyncCreateTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateTaskRequest request = + CreateTaskRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setTask(Task.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.createTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createtask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTask.java new file mode 100644 index 00000000..df58baee --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createtask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CreateTaskRequest; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class SyncCreateTask { + + public static void main(String[] args) throws Exception { + syncCreateTask(); + } + + public static void syncCreateTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateTaskRequest request = + CreateTaskRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setTask(Task.newBuilder().build()) + .build(); + Task response = cloudTasksClient.createTask(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java new file mode 100644 index 00000000..a84eb460 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createtask_queuenametask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class SyncCreateTaskQueuenameTask { + + public static void main(String[] args) throws Exception { + syncCreateTaskQueuenameTask(); + } + + public static void syncCreateTaskQueuenameTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Task task = Task.newBuilder().build(); + Task response = cloudTasksClient.createTask(parent, task); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createtask_queuenametask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTaskStringTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTaskStringTask.java new file mode 100644 index 00000000..0860e295 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/createtask/SyncCreateTaskStringTask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_createtask_stringtask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class SyncCreateTaskStringTask { + + public static void main(String[] args) throws Exception { + syncCreateTaskStringTask(); + } + + public static void syncCreateTaskStringTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Task task = Task.newBuilder().build(); + Task response = cloudTasksClient.createTask(parent, task); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_createtask_stringtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/AsyncDeleteQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/AsyncDeleteQueue.java new file mode 100644 index 00000000..9762594b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/AsyncDeleteQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.DeleteQueueRequest; +import com.google.cloud.tasks.v2.QueueName; +import com.google.protobuf.Empty; + +public class AsyncDeleteQueue { + + public static void main(String[] args) throws Exception { + asyncDeleteQueue(); + } + + public static void asyncDeleteQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteQueueRequest request = + DeleteQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.deleteQueueCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueue.java new file mode 100644 index 00000000..da63071b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletequeue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.DeleteQueueRequest; +import com.google.cloud.tasks.v2.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueue { + + public static void main(String[] args) throws Exception { + syncDeleteQueue(); + } + + public static void syncDeleteQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteQueueRequest request = + DeleteQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + cloudTasksClient.deleteQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java new file mode 100644 index 00000000..694e60aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletequeue_queuename_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueueQueuename { + + public static void main(String[] args) throws Exception { + syncDeleteQueueQueuename(); + } + + public static void syncDeleteQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + cloudTasksClient.deleteQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueueString.java new file mode 100644 index 00000000..8c7e82cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletequeue/SyncDeleteQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletequeue_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueueString { + + public static void main(String[] args) throws Exception { + syncDeleteQueueString(); + } + + public static void syncDeleteQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + cloudTasksClient.deleteQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/AsyncDeleteTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/AsyncDeleteTask.java new file mode 100644 index 00000000..632b3fab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/AsyncDeleteTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletetask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.DeleteTaskRequest; +import com.google.cloud.tasks.v2.TaskName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTask { + + public static void main(String[] args) throws Exception { + asyncDeleteTask(); + } + + public static void asyncDeleteTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteTaskRequest request = + DeleteTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.deleteTaskCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletetask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTask.java new file mode 100644 index 00000000..fd2d3a75 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletetask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.DeleteTaskRequest; +import com.google.cloud.tasks.v2.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTask { + + public static void main(String[] args) throws Exception { + syncDeleteTask(); + } + + public static void syncDeleteTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteTaskRequest request = + DeleteTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + cloudTasksClient.deleteTask(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletetask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTaskString.java new file mode 100644 index 00000000..5871611c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletetask_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTaskString { + + public static void main(String[] args) throws Exception { + syncDeleteTaskString(); + } + + public static void syncDeleteTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + cloudTasksClient.deleteTask(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletetask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java new file mode 100644 index 00000000..189c71cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_deletetask_taskname_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTaskTaskname { + + public static void main(String[] args) throws Exception { + syncDeleteTaskTaskname(); + } + + public static void syncDeleteTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + cloudTasksClient.deleteTask(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_deletetask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 00000000..60880005 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 00000000..493482e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getiampolicy_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = cloudTasksClient.getIamPolicy(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java new file mode 100644 index 00000000..d463ab2e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getiampolicy_resourcename_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicyResourcename { + + public static void main(String[] args) throws Exception { + syncGetIamPolicyResourcename(); + } + + public static void syncGetIamPolicyResourcename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Policy response = cloudTasksClient.getIamPolicy(resource); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getiampolicy_resourcename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java new file mode 100644 index 00000000..979f61bc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getiampolicy_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicyString { + + public static void main(String[] args) throws Exception { + syncGetIamPolicyString(); + } + + public static void syncGetIamPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Policy response = cloudTasksClient.getIamPolicy(resource); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getiampolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/AsyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/AsyncGetQueue.java new file mode 100644 index 00000000..0f432e89 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/AsyncGetQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getqueue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.GetQueueRequest; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class AsyncGetQueue { + + public static void main(String[] args) throws Exception { + asyncGetQueue(); + } + + public static void asyncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetQueueRequest request = + GetQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.getQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getqueue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..0fc5586a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getqueue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.GetQueueRequest; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetQueueRequest request = + GetQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.getQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueueQueuename.java new file mode 100644 index 00000000..d080d45b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getqueue_queuename_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncGetQueueQueuename { + + public static void main(String[] args) throws Exception { + syncGetQueueQueuename(); + } + + public static void syncGetQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.getQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getqueue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueueString.java new file mode 100644 index 00000000..9ae88742 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/getqueue/SyncGetQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_getqueue_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncGetQueueString { + + public static void main(String[] args) throws Exception { + syncGetQueueString(); + } + + public static void syncGetQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.getQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_getqueue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/AsyncGetTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/AsyncGetTask.java new file mode 100644 index 00000000..ffc0e660 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/AsyncGetTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_gettask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.GetTaskRequest; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class AsyncGetTask { + + public static void main(String[] args) throws Exception { + asyncGetTask(); + } + + public static void asyncGetTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.getTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_gettask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTask.java new file mode 100644 index 00000000..1d470d42 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_gettask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.GetTaskRequest; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class SyncGetTask { + + public static void main(String[] args) throws Exception { + syncGetTask(); + } + + public static void syncGetTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + Task response = cloudTasksClient.getTask(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_gettask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTaskString.java new file mode 100644 index 00000000..d571b3ec --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_gettask_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class SyncGetTaskString { + + public static void main(String[] args) throws Exception { + syncGetTaskString(); + } + + public static void syncGetTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Task response = cloudTasksClient.getTask(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_gettask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTaskTaskname.java new file mode 100644 index 00000000..7047deb0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/gettask/SyncGetTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_gettask_taskname_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class SyncGetTaskTaskname { + + public static void main(String[] args) throws Exception { + syncGetTaskTaskname(); + } + + public static void syncGetTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Task response = cloudTasksClient.getTask(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_gettask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/AsyncListQueues.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/AsyncListQueues.java new file mode 100644 index 00000000..e35753f3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/AsyncListQueues.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listqueues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.ListQueuesRequest; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class AsyncListQueues { + + public static void main(String[] args) throws Exception { + asyncListQueues(); + } + + public static void asyncListQueues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = cloudTasksClient.listQueuesPagedCallable().futureCall(request); + // Do something. + for (Queue element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listqueues_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/AsyncListQueuesPaged.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/AsyncListQueuesPaged.java new file mode 100644 index 00000000..be973228 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/AsyncListQueuesPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listqueues_paged_async] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.ListQueuesRequest; +import com.google.cloud.tasks.v2.ListQueuesResponse; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; +import com.google.common.base.Strings; + +public class AsyncListQueuesPaged { + + public static void main(String[] args) throws Exception { + asyncListQueuesPaged(); + } + + public static void asyncListQueuesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListQueuesResponse response = cloudTasksClient.listQueuesCallable().call(request); + for (Queue element : response.getQueuesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listqueues_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueues.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueues.java new file mode 100644 index 00000000..2b403ced --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueues.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listqueues_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.ListQueuesRequest; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class SyncListQueues { + + public static void main(String[] args) throws Exception { + syncListQueues(); + } + + public static void syncListQueues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Queue element : cloudTasksClient.listQueues(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listqueues_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueuesLocationname.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueuesLocationname.java new file mode 100644 index 00000000..306a8355 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueuesLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listqueues_locationname_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class SyncListQueuesLocationname { + + public static void main(String[] args) throws Exception { + syncListQueuesLocationname(); + } + + public static void syncListQueuesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listqueues_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueuesString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueuesString.java new file mode 100644 index 00000000..1ce53a05 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listqueues/SyncListQueuesString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listqueues_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.LocationName; +import com.google.cloud.tasks.v2.Queue; + +public class SyncListQueuesString { + + public static void main(String[] args) throws Exception { + syncListQueuesString(); + } + + public static void syncListQueuesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listqueues_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/AsyncListTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/AsyncListTasks.java new file mode 100644 index 00000000..f2b39a83 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/AsyncListTasks.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listtasks_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.ListTasksRequest; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class AsyncListTasks { + + public static void main(String[] args) throws Exception { + asyncListTasks(); + } + + public static void asyncListTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = cloudTasksClient.listTasksPagedCallable().futureCall(request); + // Do something. + for (Task element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listtasks_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/AsyncListTasksPaged.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/AsyncListTasksPaged.java new file mode 100644 index 00000000..95d3b4cb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/AsyncListTasksPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listtasks_paged_async] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.ListTasksRequest; +import com.google.cloud.tasks.v2.ListTasksResponse; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; +import com.google.common.base.Strings; + +public class AsyncListTasksPaged { + + public static void main(String[] args) throws Exception { + asyncListTasksPaged(); + } + + public static void asyncListTasksPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListTasksResponse response = cloudTasksClient.listTasksCallable().call(request); + for (Task element : response.getTasksList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listtasks_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasks.java new file mode 100644 index 00000000..359dd06a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasks.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listtasks_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.ListTasksRequest; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class SyncListTasks { + + public static void main(String[] args) throws Exception { + syncListTasks(); + } + + public static void syncListTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Task element : cloudTasksClient.listTasks(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listtasks_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasksQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasksQueuename.java new file mode 100644 index 00000000..1c6ef375 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasksQueuename.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listtasks_queuename_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class SyncListTasksQueuename { + + public static void main(String[] args) throws Exception { + syncListTasksQueuename(); + } + + public static void syncListTasksQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listtasks_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasksString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasksString.java new file mode 100644 index 00000000..ce21b319 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/listtasks/SyncListTasksString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_listtasks_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.Task; + +public class SyncListTasksString { + + public static void main(String[] args) throws Exception { + syncListTasksString(); + } + + public static void syncListTasksString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2_generated_cloudtasksclient_listtasks_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/AsyncPauseQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/AsyncPauseQueue.java new file mode 100644 index 00000000..ef03e3f9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/AsyncPauseQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_pausequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.PauseQueueRequest; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class AsyncPauseQueue { + + public static void main(String[] args) throws Exception { + asyncPauseQueue(); + } + + public static void asyncPauseQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PauseQueueRequest request = + PauseQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.pauseQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_pausequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueue.java new file mode 100644 index 00000000..a3186b77 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_pausequeue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.PauseQueueRequest; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncPauseQueue { + + public static void main(String[] args) throws Exception { + syncPauseQueue(); + } + + public static void syncPauseQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PauseQueueRequest request = + PauseQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.pauseQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_pausequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java new file mode 100644 index 00000000..218a3d59 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_pausequeue_queuename_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncPauseQueueQueuename { + + public static void main(String[] args) throws Exception { + syncPauseQueueQueuename(); + } + + public static void syncPauseQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.pauseQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_pausequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueueString.java new file mode 100644 index 00000000..0bfa1089 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/pausequeue/SyncPauseQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_pausequeue_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncPauseQueueString { + + public static void main(String[] args) throws Exception { + syncPauseQueueString(); + } + + public static void syncPauseQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.pauseQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_pausequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/AsyncPurgeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/AsyncPurgeQueue.java new file mode 100644 index 00000000..0f9e2f86 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/AsyncPurgeQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_purgequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.PurgeQueueRequest; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class AsyncPurgeQueue { + + public static void main(String[] args) throws Exception { + asyncPurgeQueue(); + } + + public static void asyncPurgeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PurgeQueueRequest request = + PurgeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.purgeQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_purgequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueue.java new file mode 100644 index 00000000..a16236a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_purgequeue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.PurgeQueueRequest; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncPurgeQueue { + + public static void main(String[] args) throws Exception { + syncPurgeQueue(); + } + + public static void syncPurgeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PurgeQueueRequest request = + PurgeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.purgeQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_purgequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java new file mode 100644 index 00000000..3c864eaa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_purgequeue_queuename_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncPurgeQueueQueuename { + + public static void main(String[] args) throws Exception { + syncPurgeQueueQueuename(); + } + + public static void syncPurgeQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.purgeQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_purgequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueueString.java new file mode 100644 index 00000000..84007dc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/purgequeue/SyncPurgeQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_purgequeue_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncPurgeQueueString { + + public static void main(String[] args) throws Exception { + syncPurgeQueueString(); + } + + public static void syncPurgeQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.purgeQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_purgequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/AsyncResumeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/AsyncResumeQueue.java new file mode 100644 index 00000000..97db36cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/AsyncResumeQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_resumequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.ResumeQueueRequest; + +public class AsyncResumeQueue { + + public static void main(String[] args) throws Exception { + asyncResumeQueue(); + } + + public static void asyncResumeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResumeQueueRequest request = + ResumeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.resumeQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_resumequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueue.java new file mode 100644 index 00000000..acdb269d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_resumequeue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; +import com.google.cloud.tasks.v2.ResumeQueueRequest; + +public class SyncResumeQueue { + + public static void main(String[] args) throws Exception { + syncResumeQueue(); + } + + public static void syncResumeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResumeQueueRequest request = + ResumeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.resumeQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_resumequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java new file mode 100644 index 00000000..5526a4e8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_resumequeue_queuename_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncResumeQueueQueuename { + + public static void main(String[] args) throws Exception { + syncResumeQueueQueuename(); + } + + public static void syncResumeQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.resumeQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_resumequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueueString.java new file mode 100644 index 00000000..0c29041f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/resumequeue/SyncResumeQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_resumequeue_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.QueueName; + +public class SyncResumeQueueString { + + public static void main(String[] args) throws Exception { + syncResumeQueueString(); + } + + public static void syncResumeQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.resumeQueue(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_resumequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/AsyncRunTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/AsyncRunTask.java new file mode 100644 index 00000000..cde80c1c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/AsyncRunTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_runtask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.RunTaskRequest; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class AsyncRunTask { + + public static void main(String[] args) throws Exception { + asyncRunTask(); + } + + public static void asyncRunTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RunTaskRequest request = + RunTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.runTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_runtask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTask.java new file mode 100644 index 00000000..ea176710 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_runtask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.RunTaskRequest; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class SyncRunTask { + + public static void main(String[] args) throws Exception { + syncRunTask(); + } + + public static void syncRunTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RunTaskRequest request = + RunTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + Task response = cloudTasksClient.runTask(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_runtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTaskString.java new file mode 100644 index 00000000..11b7fef8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_runtask_string_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class SyncRunTaskString { + + public static void main(String[] args) throws Exception { + syncRunTaskString(); + } + + public static void syncRunTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Task response = cloudTasksClient.runTask(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_runtask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTaskTaskname.java new file mode 100644 index 00000000..6e70b7b7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/runtask/SyncRunTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_runtask_taskname_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Task; +import com.google.cloud.tasks.v2.TaskName; + +public class SyncRunTaskTaskname { + + public static void main(String[] args) throws Exception { + syncRunTaskTaskname(); + } + + public static void syncRunTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Task response = cloudTasksClient.runTask(name); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_runtask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 00000000..5a0e28fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_setiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_setiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 00000000..24d29467 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_setiampolicy_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = cloudTasksClient.setIamPolicy(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_setiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java new file mode 100644 index 00000000..33cf4945 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_setiampolicy_resourcenamepolicy_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncSetIamPolicyResourcenamePolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicyResourcenamePolicy(); + } + + public static void syncSetIamPolicyResourcenamePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Policy policy = Policy.newBuilder().build(); + Policy response = cloudTasksClient.setIamPolicy(resource, policy); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_setiampolicy_resourcenamepolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java new file mode 100644 index 00000000..b12bbe3f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_setiampolicy_stringpolicy_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncSetIamPolicyStringPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicyStringPolicy(); + } + + public static void syncSetIamPolicyStringPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Policy policy = Policy.newBuilder().build(); + Policy response = cloudTasksClient.setIamPolicy(resource, policy); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_setiampolicy_stringpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 00000000..0568b639 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_testiampermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + cloudTasksClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_testiampermissions_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 00000000..f2f41700 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_testiampermissions_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = cloudTasksClient.testIamPermissions(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_testiampermissions_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java new file mode 100644 index 00000000..38b1f4d1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncTestIamPermissionsResourcenameListstring { + + public static void main(String[] args) throws Exception { + syncTestIamPermissionsResourcenameListstring(); + } + + public static void syncTestIamPermissionsResourcenameListstring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + List permissions = new ArrayList<>(); + TestIamPermissionsResponse response = + cloudTasksClient.testIamPermissions(resource, permissions); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java new file mode 100644 index 00000000..381af0ce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_testiampermissions_stringliststring_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.QueueName; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncTestIamPermissionsStringListstring { + + public static void main(String[] args) throws Exception { + syncTestIamPermissionsStringListstring(); + } + + public static void syncTestIamPermissionsStringListstring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + List permissions = new ArrayList<>(); + TestIamPermissionsResponse response = + cloudTasksClient.testIamPermissions(resource, permissions); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_testiampermissions_stringliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/AsyncUpdateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/AsyncUpdateQueue.java new file mode 100644 index 00000000..22494974 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/AsyncUpdateQueue.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_updatequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.UpdateQueueRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateQueue { + + public static void main(String[] args) throws Exception { + asyncUpdateQueue(); + } + + public static void asyncUpdateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + UpdateQueueRequest request = + UpdateQueueRequest.newBuilder() + .setQueue(Queue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.updateQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_updatequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/SyncUpdateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/SyncUpdateQueue.java new file mode 100644 index 00000000..2038283e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/SyncUpdateQueue.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_updatequeue_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.cloud.tasks.v2.UpdateQueueRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateQueue { + + public static void main(String[] args) throws Exception { + syncUpdateQueue(); + } + + public static void syncUpdateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + UpdateQueueRequest request = + UpdateQueueRequest.newBuilder() + .setQueue(Queue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.updateQueue(request); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_updatequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java new file mode 100644 index 00000000..4788dbb3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtasksclient_updatequeue_queuefieldmask_sync] +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.Queue; +import com.google.protobuf.FieldMask; + +public class SyncUpdateQueueQueueFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateQueueQueueFieldmask(); + } + + public static void syncUpdateQueueQueueFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + Queue queue = Queue.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Queue response = cloudTasksClient.updateQueue(queue, updateMask); + } + } +} +// [END tasks_v2_generated_cloudtasksclient_updatequeue_queuefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtaskssettings/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtaskssettings/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..0ffb477c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/cloudtaskssettings/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.samples; + +// [START tasks_v2_generated_cloudtaskssettings_getqueue_sync] +import com.google.cloud.tasks.v2.CloudTasksSettings; +import java.time.Duration; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings.Builder cloudTasksSettingsBuilder = CloudTasksSettings.newBuilder(); + cloudTasksSettingsBuilder + .getQueueSettings() + .setRetrySettings( + cloudTasksSettingsBuilder + .getQueueSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudTasksSettings cloudTasksSettings = cloudTasksSettingsBuilder.build(); + } +} +// [END tasks_v2_generated_cloudtaskssettings_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..7f7bda8f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2.stub.samples; + +// [START tasks_v2_generated_cloudtasksstubsettings_getqueue_sync] +import com.google.cloud.tasks.v2.stub.CloudTasksStubSettings; +import java.time.Duration; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksStubSettings.Builder cloudTasksSettingsBuilder = CloudTasksStubSettings.newBuilder(); + cloudTasksSettingsBuilder + .getQueueSettings() + .setRetrySettings( + cloudTasksSettingsBuilder + .getQueueSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudTasksStubSettings cloudTasksSettings = cloudTasksSettingsBuilder.build(); + } +} +// [END tasks_v2_generated_cloudtasksstubsettings_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/AsyncAcknowledgeTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/AsyncAcknowledgeTask.java new file mode 100644 index 00000000..ab1afa05 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/AsyncAcknowledgeTask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.AcknowledgeTaskRequest; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; + +public class AsyncAcknowledgeTask { + + public static void main(String[] args) throws Exception { + asyncAcknowledgeTask(); + } + + public static void asyncAcknowledgeTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + AcknowledgeTaskRequest request = + AcknowledgeTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .setScheduleTime(Timestamp.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.acknowledgeTaskCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTask.java new file mode 100644 index 00000000..3baa6f7e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_sync] +import com.google.cloud.tasks.v2beta2.AcknowledgeTaskRequest; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; + +public class SyncAcknowledgeTask { + + public static void main(String[] args) throws Exception { + syncAcknowledgeTask(); + } + + public static void syncAcknowledgeTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + AcknowledgeTaskRequest request = + AcknowledgeTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .setScheduleTime(Timestamp.newBuilder().build()) + .build(); + cloudTasksClient.acknowledgeTask(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTaskStringTimestamp.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTaskStringTimestamp.java new file mode 100644 index 00000000..92f2d61f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTaskStringTimestamp.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_stringtimestamp_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; + +public class SyncAcknowledgeTaskStringTimestamp { + + public static void main(String[] args) throws Exception { + syncAcknowledgeTaskStringTimestamp(); + } + + public static void syncAcknowledgeTaskStringTimestamp() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Timestamp scheduleTime = Timestamp.newBuilder().build(); + cloudTasksClient.acknowledgeTask(name, scheduleTime); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_stringtimestamp_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTaskTasknameTimestamp.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTaskTasknameTimestamp.java new file mode 100644 index 00000000..762125bd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/acknowledgetask/SyncAcknowledgeTaskTasknameTimestamp.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_tasknametimestamp_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; + +public class SyncAcknowledgeTaskTasknameTimestamp { + + public static void main(String[] args) throws Exception { + syncAcknowledgeTaskTasknameTimestamp(); + } + + public static void syncAcknowledgeTaskTasknameTimestamp() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Timestamp scheduleTime = Timestamp.newBuilder().build(); + cloudTasksClient.acknowledgeTask(name, scheduleTime); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_acknowledgetask_tasknametimestamp_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/AsyncCancelLease.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/AsyncCancelLease.java new file mode 100644 index 00000000..da94e453 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/AsyncCancelLease.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_cancellease_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CancelLeaseRequest; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Timestamp; + +public class AsyncCancelLease { + + public static void main(String[] args) throws Exception { + asyncCancelLease(); + } + + public static void asyncCancelLease() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CancelLeaseRequest request = + CancelLeaseRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .setScheduleTime(Timestamp.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.cancelLeaseCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_cancellease_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLease.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLease.java new file mode 100644 index 00000000..5ed165c2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLease.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_cancellease_sync] +import com.google.cloud.tasks.v2beta2.CancelLeaseRequest; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Timestamp; + +public class SyncCancelLease { + + public static void main(String[] args) throws Exception { + syncCancelLease(); + } + + public static void syncCancelLease() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CancelLeaseRequest request = + CancelLeaseRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .setScheduleTime(Timestamp.newBuilder().build()) + .build(); + Task response = cloudTasksClient.cancelLease(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_cancellease_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLeaseStringTimestamp.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLeaseStringTimestamp.java new file mode 100644 index 00000000..d4f1f1c4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLeaseStringTimestamp.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_cancellease_stringtimestamp_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Timestamp; + +public class SyncCancelLeaseStringTimestamp { + + public static void main(String[] args) throws Exception { + syncCancelLeaseStringTimestamp(); + } + + public static void syncCancelLeaseStringTimestamp() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Timestamp scheduleTime = Timestamp.newBuilder().build(); + Task response = cloudTasksClient.cancelLease(name, scheduleTime); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_cancellease_stringtimestamp_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLeaseTasknameTimestamp.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLeaseTasknameTimestamp.java new file mode 100644 index 00000000..059088a1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/cancellease/SyncCancelLeaseTasknameTimestamp.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_cancellease_tasknametimestamp_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Timestamp; + +public class SyncCancelLeaseTasknameTimestamp { + + public static void main(String[] args) throws Exception { + syncCancelLeaseTasknameTimestamp(); + } + + public static void syncCancelLeaseTasknameTimestamp() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Timestamp scheduleTime = Timestamp.newBuilder().build(); + Task response = cloudTasksClient.cancelLease(name, scheduleTime); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_cancellease_tasknametimestamp_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..dbe6a904 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CloudTasksSettings; +import com.google.cloud.tasks.v2beta2.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..abb4e687 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_create_setcredentialsprovider1_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CloudTasksSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setTransportChannelProvider( + CloudTasksSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..4e47cdf5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_create_setendpoint_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CloudTasksSettings; +import com.google.cloud.tasks.v2beta2.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder().setEndpoint(myEndpoint).build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/AsyncCreateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/AsyncCreateQueue.java new file mode 100644 index 00000000..e9bfc5f9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/AsyncCreateQueue.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createqueue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CreateQueueRequest; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; + +public class AsyncCreateQueue { + + public static void main(String[] args) throws Exception { + asyncCreateQueue(); + } + + public static void asyncCreateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateQueueRequest request = + CreateQueueRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQueue(Queue.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.createQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createqueue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueue.java new file mode 100644 index 00000000..e34e8208 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueue.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createqueue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CreateQueueRequest; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; + +public class SyncCreateQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueue(); + } + + public static void syncCreateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateQueueRequest request = + CreateQueueRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQueue(Queue.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.createQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java new file mode 100644 index 00000000..b2327f59 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createqueue_locationnamequeue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; + +public class SyncCreateQueueLocationnameQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueueLocationnameQueue(); + } + + public static void syncCreateQueueLocationnameQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Queue queue = Queue.newBuilder().build(); + Queue response = cloudTasksClient.createQueue(parent, queue); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createqueue_locationnamequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java new file mode 100644 index 00000000..2616093d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createqueue_stringqueue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; + +public class SyncCreateQueueStringQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueueStringQueue(); + } + + public static void syncCreateQueueStringQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Queue queue = Queue.newBuilder().build(); + Queue response = cloudTasksClient.createQueue(parent, queue); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createqueue_stringqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/AsyncCreateTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/AsyncCreateTask.java new file mode 100644 index 00000000..e1b299a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/AsyncCreateTask.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createtask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CreateTaskRequest; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class AsyncCreateTask { + + public static void main(String[] args) throws Exception { + asyncCreateTask(); + } + + public static void asyncCreateTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateTaskRequest request = + CreateTaskRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setTask(Task.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.createTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createtask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTask.java new file mode 100644 index 00000000..390a437a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createtask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.CreateTaskRequest; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class SyncCreateTask { + + public static void main(String[] args) throws Exception { + syncCreateTask(); + } + + public static void syncCreateTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateTaskRequest request = + CreateTaskRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setTask(Task.newBuilder().build()) + .build(); + Task response = cloudTasksClient.createTask(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java new file mode 100644 index 00000000..62a070ae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createtask_queuenametask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class SyncCreateTaskQueuenameTask { + + public static void main(String[] args) throws Exception { + syncCreateTaskQueuenameTask(); + } + + public static void syncCreateTaskQueuenameTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Task task = Task.newBuilder().build(); + Task response = cloudTasksClient.createTask(parent, task); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createtask_queuenametask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTaskStringTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTaskStringTask.java new file mode 100644 index 00000000..73d350ce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/createtask/SyncCreateTaskStringTask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_createtask_stringtask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class SyncCreateTaskStringTask { + + public static void main(String[] args) throws Exception { + syncCreateTaskStringTask(); + } + + public static void syncCreateTaskStringTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Task task = Task.newBuilder().build(); + Task response = cloudTasksClient.createTask(parent, task); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_createtask_stringtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/AsyncDeleteQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/AsyncDeleteQueue.java new file mode 100644 index 00000000..af835c27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/AsyncDeleteQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.DeleteQueueRequest; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Empty; + +public class AsyncDeleteQueue { + + public static void main(String[] args) throws Exception { + asyncDeleteQueue(); + } + + public static void asyncDeleteQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteQueueRequest request = + DeleteQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.deleteQueueCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueue.java new file mode 100644 index 00000000..32678f61 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletequeue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.DeleteQueueRequest; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueue { + + public static void main(String[] args) throws Exception { + syncDeleteQueue(); + } + + public static void syncDeleteQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteQueueRequest request = + DeleteQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + cloudTasksClient.deleteQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java new file mode 100644 index 00000000..951b6511 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletequeue_queuename_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueueQueuename { + + public static void main(String[] args) throws Exception { + syncDeleteQueueQueuename(); + } + + public static void syncDeleteQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + cloudTasksClient.deleteQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueueString.java new file mode 100644 index 00000000..43f176ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletequeue/SyncDeleteQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletequeue_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueueString { + + public static void main(String[] args) throws Exception { + syncDeleteQueueString(); + } + + public static void syncDeleteQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + cloudTasksClient.deleteQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/AsyncDeleteTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/AsyncDeleteTask.java new file mode 100644 index 00000000..f9274df2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/AsyncDeleteTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletetask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.DeleteTaskRequest; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTask { + + public static void main(String[] args) throws Exception { + asyncDeleteTask(); + } + + public static void asyncDeleteTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteTaskRequest request = + DeleteTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.deleteTaskCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletetask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTask.java new file mode 100644 index 00000000..36fe4ad3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletetask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.DeleteTaskRequest; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTask { + + public static void main(String[] args) throws Exception { + syncDeleteTask(); + } + + public static void syncDeleteTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteTaskRequest request = + DeleteTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + cloudTasksClient.deleteTask(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletetask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTaskString.java new file mode 100644 index 00000000..0294a9a6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletetask_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTaskString { + + public static void main(String[] args) throws Exception { + syncDeleteTaskString(); + } + + public static void syncDeleteTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + cloudTasksClient.deleteTask(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletetask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java new file mode 100644 index 00000000..1f6b15ae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_deletetask_taskname_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTaskTaskname { + + public static void main(String[] args) throws Exception { + syncDeleteTaskTaskname(); + } + + public static void syncDeleteTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + cloudTasksClient.deleteTask(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_deletetask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 00000000..d0f68b55 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 00000000..ee3f1c67 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getiampolicy_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = cloudTasksClient.getIamPolicy(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java new file mode 100644 index 00000000..a8002081 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getiampolicy_resourcename_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicyResourcename { + + public static void main(String[] args) throws Exception { + syncGetIamPolicyResourcename(); + } + + public static void syncGetIamPolicyResourcename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Policy response = cloudTasksClient.getIamPolicy(resource); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getiampolicy_resourcename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java new file mode 100644 index 00000000..6edf8501 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getiampolicy_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicyString { + + public static void main(String[] args) throws Exception { + syncGetIamPolicyString(); + } + + public static void syncGetIamPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Policy response = cloudTasksClient.getIamPolicy(resource); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getiampolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/AsyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/AsyncGetQueue.java new file mode 100644 index 00000000..ae934132 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/AsyncGetQueue.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getqueue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.GetQueueRequest; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.FieldMask; + +public class AsyncGetQueue { + + public static void main(String[] args) throws Exception { + asyncGetQueue(); + } + + public static void asyncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetQueueRequest request = + GetQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.getQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getqueue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..58d8f86e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getqueue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.GetQueueRequest; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.FieldMask; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetQueueRequest request = + GetQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.getQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueueQueuename.java new file mode 100644 index 00000000..06e7c5b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getqueue_queuename_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncGetQueueQueuename { + + public static void main(String[] args) throws Exception { + syncGetQueueQueuename(); + } + + public static void syncGetQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.getQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getqueue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueueString.java new file mode 100644 index 00000000..8c83dbd4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/getqueue/SyncGetQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_getqueue_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncGetQueueString { + + public static void main(String[] args) throws Exception { + syncGetQueueString(); + } + + public static void syncGetQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.getQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_getqueue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/AsyncGetTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/AsyncGetTask.java new file mode 100644 index 00000000..64cb85ce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/AsyncGetTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_gettask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.GetTaskRequest; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class AsyncGetTask { + + public static void main(String[] args) throws Exception { + asyncGetTask(); + } + + public static void asyncGetTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.getTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_gettask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTask.java new file mode 100644 index 00000000..f7ae4a58 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_gettask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.GetTaskRequest; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class SyncGetTask { + + public static void main(String[] args) throws Exception { + syncGetTask(); + } + + public static void syncGetTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + Task response = cloudTasksClient.getTask(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_gettask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTaskString.java new file mode 100644 index 00000000..36fb1cf3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_gettask_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class SyncGetTaskString { + + public static void main(String[] args) throws Exception { + syncGetTaskString(); + } + + public static void syncGetTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Task response = cloudTasksClient.getTask(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_gettask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTaskTaskname.java new file mode 100644 index 00000000..517259c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/gettask/SyncGetTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_gettask_taskname_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class SyncGetTaskTaskname { + + public static void main(String[] args) throws Exception { + syncGetTaskTaskname(); + } + + public static void syncGetTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Task response = cloudTasksClient.getTask(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_gettask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/AsyncLeaseTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/AsyncLeaseTasks.java new file mode 100644 index 00000000..a712847f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/AsyncLeaseTasks.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_leasetasks_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LeaseTasksRequest; +import com.google.cloud.tasks.v2beta2.LeaseTasksResponse; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Duration; + +public class AsyncLeaseTasks { + + public static void main(String[] args) throws Exception { + asyncLeaseTasks(); + } + + public static void asyncLeaseTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LeaseTasksRequest request = + LeaseTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setMaxTasks(-233969421) + .setLeaseDuration(Duration.newBuilder().build()) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + cloudTasksClient.leaseTasksCallable().futureCall(request); + // Do something. + LeaseTasksResponse response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_leasetasks_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasks.java new file mode 100644 index 00000000..6f6a1b5e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasks.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_leasetasks_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LeaseTasksRequest; +import com.google.cloud.tasks.v2beta2.LeaseTasksResponse; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Duration; + +public class SyncLeaseTasks { + + public static void main(String[] args) throws Exception { + syncLeaseTasks(); + } + + public static void syncLeaseTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LeaseTasksRequest request = + LeaseTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setMaxTasks(-233969421) + .setLeaseDuration(Duration.newBuilder().build()) + .setFilter("filter-1274492040") + .build(); + LeaseTasksResponse response = cloudTasksClient.leaseTasks(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_leasetasks_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasksQueuenameDuration.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasksQueuenameDuration.java new file mode 100644 index 00000000..2a935d86 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasksQueuenameDuration.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_leasetasks_queuenameduration_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LeaseTasksResponse; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Duration; + +public class SyncLeaseTasksQueuenameDuration { + + public static void main(String[] args) throws Exception { + syncLeaseTasksQueuenameDuration(); + } + + public static void syncLeaseTasksQueuenameDuration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Duration leaseDuration = Duration.newBuilder().build(); + LeaseTasksResponse response = cloudTasksClient.leaseTasks(parent, leaseDuration); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_leasetasks_queuenameduration_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasksStringDuration.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasksStringDuration.java new file mode 100644 index 00000000..a14af642 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/leasetasks/SyncLeaseTasksStringDuration.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_leasetasks_stringduration_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LeaseTasksResponse; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.protobuf.Duration; + +public class SyncLeaseTasksStringDuration { + + public static void main(String[] args) throws Exception { + syncLeaseTasksStringDuration(); + } + + public static void syncLeaseTasksStringDuration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Duration leaseDuration = Duration.newBuilder().build(); + LeaseTasksResponse response = cloudTasksClient.leaseTasks(parent, leaseDuration); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_leasetasks_stringduration_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/AsyncListQueues.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/AsyncListQueues.java new file mode 100644 index 00000000..0bd56057 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/AsyncListQueues.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listqueues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.ListQueuesRequest; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.protobuf.FieldMask; + +public class AsyncListQueues { + + public static void main(String[] args) throws Exception { + asyncListQueues(); + } + + public static void asyncListQueues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.listQueuesPagedCallable().futureCall(request); + // Do something. + for (Queue element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listqueues_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/AsyncListQueuesPaged.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/AsyncListQueuesPaged.java new file mode 100644 index 00000000..a7ab7e1a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/AsyncListQueuesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listqueues_paged_async] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.ListQueuesRequest; +import com.google.cloud.tasks.v2beta2.ListQueuesResponse; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListQueuesPaged { + + public static void main(String[] args) throws Exception { + asyncListQueuesPaged(); + } + + public static void asyncListQueuesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListQueuesResponse response = cloudTasksClient.listQueuesCallable().call(request); + for (Queue element : response.getQueuesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listqueues_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueues.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueues.java new file mode 100644 index 00000000..1572c738 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueues.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listqueues_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.ListQueuesRequest; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.protobuf.FieldMask; + +public class SyncListQueues { + + public static void main(String[] args) throws Exception { + syncListQueues(); + } + + public static void syncListQueues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Queue element : cloudTasksClient.listQueues(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listqueues_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueuesLocationname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueuesLocationname.java new file mode 100644 index 00000000..b997ba49 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueuesLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listqueues_locationname_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; + +public class SyncListQueuesLocationname { + + public static void main(String[] args) throws Exception { + syncListQueuesLocationname(); + } + + public static void syncListQueuesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listqueues_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueuesString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueuesString.java new file mode 100644 index 00000000..ad6691a3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listqueues/SyncListQueuesString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listqueues_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.LocationName; +import com.google.cloud.tasks.v2beta2.Queue; + +public class SyncListQueuesString { + + public static void main(String[] args) throws Exception { + syncListQueuesString(); + } + + public static void syncListQueuesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listqueues_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/AsyncListTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/AsyncListTasks.java new file mode 100644 index 00000000..894fc4df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/AsyncListTasks.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listtasks_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.ListTasksRequest; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class AsyncListTasks { + + public static void main(String[] args) throws Exception { + asyncListTasks(); + } + + public static void asyncListTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = cloudTasksClient.listTasksPagedCallable().futureCall(request); + // Do something. + for (Task element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listtasks_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/AsyncListTasksPaged.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/AsyncListTasksPaged.java new file mode 100644 index 00000000..b8612e2b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/AsyncListTasksPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listtasks_paged_async] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.ListTasksRequest; +import com.google.cloud.tasks.v2beta2.ListTasksResponse; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.common.base.Strings; + +public class AsyncListTasksPaged { + + public static void main(String[] args) throws Exception { + asyncListTasksPaged(); + } + + public static void asyncListTasksPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListTasksResponse response = cloudTasksClient.listTasksCallable().call(request); + for (Task element : response.getTasksList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listtasks_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasks.java new file mode 100644 index 00000000..558e80a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasks.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listtasks_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.ListTasksRequest; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class SyncListTasks { + + public static void main(String[] args) throws Exception { + syncListTasks(); + } + + public static void syncListTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Task element : cloudTasksClient.listTasks(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listtasks_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasksQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasksQueuename.java new file mode 100644 index 00000000..6877cc75 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasksQueuename.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listtasks_queuename_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class SyncListTasksQueuename { + + public static void main(String[] args) throws Exception { + syncListTasksQueuename(); + } + + public static void syncListTasksQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listtasks_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasksString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasksString.java new file mode 100644 index 00000000..48d68f82 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/listtasks/SyncListTasksString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_listtasks_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.Task; + +public class SyncListTasksString { + + public static void main(String[] args) throws Exception { + syncListTasksString(); + } + + public static void syncListTasksString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_listtasks_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/AsyncPauseQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/AsyncPauseQueue.java new file mode 100644 index 00000000..8d0f9560 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/AsyncPauseQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_pausequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.PauseQueueRequest; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class AsyncPauseQueue { + + public static void main(String[] args) throws Exception { + asyncPauseQueue(); + } + + public static void asyncPauseQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PauseQueueRequest request = + PauseQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.pauseQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_pausequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueue.java new file mode 100644 index 00000000..7fa8ca8f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_pausequeue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.PauseQueueRequest; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncPauseQueue { + + public static void main(String[] args) throws Exception { + syncPauseQueue(); + } + + public static void syncPauseQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PauseQueueRequest request = + PauseQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.pauseQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_pausequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java new file mode 100644 index 00000000..86f55e8d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_pausequeue_queuename_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncPauseQueueQueuename { + + public static void main(String[] args) throws Exception { + syncPauseQueueQueuename(); + } + + public static void syncPauseQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.pauseQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_pausequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueueString.java new file mode 100644 index 00000000..b821a4d6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/pausequeue/SyncPauseQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_pausequeue_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncPauseQueueString { + + public static void main(String[] args) throws Exception { + syncPauseQueueString(); + } + + public static void syncPauseQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.pauseQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_pausequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/AsyncPurgeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/AsyncPurgeQueue.java new file mode 100644 index 00000000..515451a9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/AsyncPurgeQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_purgequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.PurgeQueueRequest; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class AsyncPurgeQueue { + + public static void main(String[] args) throws Exception { + asyncPurgeQueue(); + } + + public static void asyncPurgeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PurgeQueueRequest request = + PurgeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.purgeQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_purgequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueue.java new file mode 100644 index 00000000..2a7019c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_purgequeue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.PurgeQueueRequest; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncPurgeQueue { + + public static void main(String[] args) throws Exception { + syncPurgeQueue(); + } + + public static void syncPurgeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PurgeQueueRequest request = + PurgeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.purgeQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_purgequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java new file mode 100644 index 00000000..66b1e90a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_purgequeue_queuename_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncPurgeQueueQueuename { + + public static void main(String[] args) throws Exception { + syncPurgeQueueQueuename(); + } + + public static void syncPurgeQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.purgeQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_purgequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueueString.java new file mode 100644 index 00000000..9f932af0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/purgequeue/SyncPurgeQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_purgequeue_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncPurgeQueueString { + + public static void main(String[] args) throws Exception { + syncPurgeQueueString(); + } + + public static void syncPurgeQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.purgeQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_purgequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/AsyncRenewLease.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/AsyncRenewLease.java new file mode 100644 index 00000000..78690e08 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/AsyncRenewLease.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_renewlease_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.RenewLeaseRequest; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Duration; +import com.google.protobuf.Timestamp; + +public class AsyncRenewLease { + + public static void main(String[] args) throws Exception { + asyncRenewLease(); + } + + public static void asyncRenewLease() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RenewLeaseRequest request = + RenewLeaseRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .setScheduleTime(Timestamp.newBuilder().build()) + .setLeaseDuration(Duration.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.renewLeaseCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_renewlease_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLease.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLease.java new file mode 100644 index 00000000..3645572a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLease.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_renewlease_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.RenewLeaseRequest; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Duration; +import com.google.protobuf.Timestamp; + +public class SyncRenewLease { + + public static void main(String[] args) throws Exception { + syncRenewLease(); + } + + public static void syncRenewLease() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RenewLeaseRequest request = + RenewLeaseRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .setScheduleTime(Timestamp.newBuilder().build()) + .setLeaseDuration(Duration.newBuilder().build()) + .build(); + Task response = cloudTasksClient.renewLease(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_renewlease_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLeaseStringTimestampDuration.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLeaseStringTimestampDuration.java new file mode 100644 index 00000000..fcbc0c02 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLeaseStringTimestampDuration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_renewlease_stringtimestampduration_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Duration; +import com.google.protobuf.Timestamp; + +public class SyncRenewLeaseStringTimestampDuration { + + public static void main(String[] args) throws Exception { + syncRenewLeaseStringTimestampDuration(); + } + + public static void syncRenewLeaseStringTimestampDuration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Timestamp scheduleTime = Timestamp.newBuilder().build(); + Duration leaseDuration = Duration.newBuilder().build(); + Task response = cloudTasksClient.renewLease(name, scheduleTime, leaseDuration); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_renewlease_stringtimestampduration_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLeaseTasknameTimestampDuration.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLeaseTasknameTimestampDuration.java new file mode 100644 index 00000000..9811a9ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/renewlease/SyncRenewLeaseTasknameTimestampDuration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_renewlease_tasknametimestampduration_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; +import com.google.protobuf.Duration; +import com.google.protobuf.Timestamp; + +public class SyncRenewLeaseTasknameTimestampDuration { + + public static void main(String[] args) throws Exception { + syncRenewLeaseTasknameTimestampDuration(); + } + + public static void syncRenewLeaseTasknameTimestampDuration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Timestamp scheduleTime = Timestamp.newBuilder().build(); + Duration leaseDuration = Duration.newBuilder().build(); + Task response = cloudTasksClient.renewLease(name, scheduleTime, leaseDuration); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_renewlease_tasknametimestampduration_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/AsyncResumeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/AsyncResumeQueue.java new file mode 100644 index 00000000..14c6db59 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/AsyncResumeQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_resumequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.ResumeQueueRequest; + +public class AsyncResumeQueue { + + public static void main(String[] args) throws Exception { + asyncResumeQueue(); + } + + public static void asyncResumeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResumeQueueRequest request = + ResumeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.resumeQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_resumequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueue.java new file mode 100644 index 00000000..998644e5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_resumequeue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.cloud.tasks.v2beta2.ResumeQueueRequest; + +public class SyncResumeQueue { + + public static void main(String[] args) throws Exception { + syncResumeQueue(); + } + + public static void syncResumeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResumeQueueRequest request = + ResumeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.resumeQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_resumequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java new file mode 100644 index 00000000..165e4017 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_resumequeue_queuename_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncResumeQueueQueuename { + + public static void main(String[] args) throws Exception { + syncResumeQueueQueuename(); + } + + public static void syncResumeQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.resumeQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_resumequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueueString.java new file mode 100644 index 00000000..7e00ccec --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/resumequeue/SyncResumeQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_resumequeue_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.QueueName; + +public class SyncResumeQueueString { + + public static void main(String[] args) throws Exception { + syncResumeQueueString(); + } + + public static void syncResumeQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.resumeQueue(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_resumequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/AsyncRunTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/AsyncRunTask.java new file mode 100644 index 00000000..7f31a5b6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/AsyncRunTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_runtask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.RunTaskRequest; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class AsyncRunTask { + + public static void main(String[] args) throws Exception { + asyncRunTask(); + } + + public static void asyncRunTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RunTaskRequest request = + RunTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.runTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_runtask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTask.java new file mode 100644 index 00000000..df779a69 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_runtask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.RunTaskRequest; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class SyncRunTask { + + public static void main(String[] args) throws Exception { + syncRunTask(); + } + + public static void syncRunTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RunTaskRequest request = + RunTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + Task response = cloudTasksClient.runTask(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_runtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTaskString.java new file mode 100644 index 00000000..64f30152 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_runtask_string_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class SyncRunTaskString { + + public static void main(String[] args) throws Exception { + syncRunTaskString(); + } + + public static void syncRunTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Task response = cloudTasksClient.runTask(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_runtask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTaskTaskname.java new file mode 100644 index 00000000..68129a6b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/runtask/SyncRunTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_runtask_taskname_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Task; +import com.google.cloud.tasks.v2beta2.TaskName; + +public class SyncRunTaskTaskname { + + public static void main(String[] args) throws Exception { + syncRunTaskTaskname(); + } + + public static void syncRunTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Task response = cloudTasksClient.runTask(name); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_runtask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 00000000..fd9321df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_setiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_setiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 00000000..9a844bdd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_setiampolicy_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = cloudTasksClient.setIamPolicy(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_setiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java new file mode 100644 index 00000000..0fb2c9c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_setiampolicy_resourcenamepolicy_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncSetIamPolicyResourcenamePolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicyResourcenamePolicy(); + } + + public static void syncSetIamPolicyResourcenamePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Policy policy = Policy.newBuilder().build(); + Policy response = cloudTasksClient.setIamPolicy(resource, policy); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_setiampolicy_resourcenamepolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java new file mode 100644 index 00000000..76d66482 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_setiampolicy_stringpolicy_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.Policy; + +public class SyncSetIamPolicyStringPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicyStringPolicy(); + } + + public static void syncSetIamPolicyStringPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Policy policy = Policy.newBuilder().build(); + Policy response = cloudTasksClient.setIamPolicy(resource, policy); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_setiampolicy_stringpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 00000000..fb85bdfc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_testiampermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + cloudTasksClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_testiampermissions_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 00000000..23e0592e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_testiampermissions_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = cloudTasksClient.testIamPermissions(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_testiampermissions_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java new file mode 100644 index 00000000..a36a8bc6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncTestIamPermissionsResourcenameListstring { + + public static void main(String[] args) throws Exception { + syncTestIamPermissionsResourcenameListstring(); + } + + public static void syncTestIamPermissionsResourcenameListstring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + List permissions = new ArrayList<>(); + TestIamPermissionsResponse response = + cloudTasksClient.testIamPermissions(resource, permissions); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java new file mode 100644 index 00000000..ca23ca6f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_testiampermissions_stringliststring_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.QueueName; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncTestIamPermissionsStringListstring { + + public static void main(String[] args) throws Exception { + syncTestIamPermissionsStringListstring(); + } + + public static void syncTestIamPermissionsStringListstring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + List permissions = new ArrayList<>(); + TestIamPermissionsResponse response = + cloudTasksClient.testIamPermissions(resource, permissions); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_testiampermissions_stringliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/AsyncUpdateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/AsyncUpdateQueue.java new file mode 100644 index 00000000..55067342 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/AsyncUpdateQueue.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_updatequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.UpdateQueueRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateQueue { + + public static void main(String[] args) throws Exception { + asyncUpdateQueue(); + } + + public static void asyncUpdateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + UpdateQueueRequest request = + UpdateQueueRequest.newBuilder() + .setQueue(Queue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.updateQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_updatequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/SyncUpdateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/SyncUpdateQueue.java new file mode 100644 index 00000000..efa507ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/SyncUpdateQueue.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_updatequeue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.cloud.tasks.v2beta2.UpdateQueueRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateQueue { + + public static void main(String[] args) throws Exception { + syncUpdateQueue(); + } + + public static void syncUpdateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + UpdateQueueRequest request = + UpdateQueueRequest.newBuilder() + .setQueue(Queue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.updateQueue(request); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_updatequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java new file mode 100644 index 00000000..e4c8bd50 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtasksclient_updatequeue_queuefieldmask_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksClient; +import com.google.cloud.tasks.v2beta2.Queue; +import com.google.protobuf.FieldMask; + +public class SyncUpdateQueueQueueFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateQueueQueueFieldmask(); + } + + public static void syncUpdateQueueQueueFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + Queue queue = Queue.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Queue response = cloudTasksClient.updateQueue(queue, updateMask); + } + } +} +// [END tasks_v2beta2_generated_cloudtasksclient_updatequeue_queuefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtaskssettings/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtaskssettings/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..1a243ce7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/cloudtaskssettings/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.samples; + +// [START tasks_v2beta2_generated_cloudtaskssettings_getqueue_sync] +import com.google.cloud.tasks.v2beta2.CloudTasksSettings; +import java.time.Duration; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings.Builder cloudTasksSettingsBuilder = CloudTasksSettings.newBuilder(); + cloudTasksSettingsBuilder + .getQueueSettings() + .setRetrySettings( + cloudTasksSettingsBuilder + .getQueueSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudTasksSettings cloudTasksSettings = cloudTasksSettingsBuilder.build(); + } +} +// [END tasks_v2beta2_generated_cloudtaskssettings_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta2/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..4b3c654b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta2/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta2.stub.samples; + +// [START tasks_v2beta2_generated_cloudtasksstubsettings_getqueue_sync] +import com.google.cloud.tasks.v2beta2.stub.CloudTasksStubSettings; +import java.time.Duration; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksStubSettings.Builder cloudTasksSettingsBuilder = CloudTasksStubSettings.newBuilder(); + cloudTasksSettingsBuilder + .getQueueSettings() + .setRetrySettings( + cloudTasksSettingsBuilder + .getQueueSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudTasksStubSettings cloudTasksSettings = cloudTasksSettingsBuilder.build(); + } +} +// [END tasks_v2beta2_generated_cloudtasksstubsettings_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..312b4383 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CloudTasksSettings; +import com.google.cloud.tasks.v2beta3.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..85431e3e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_create_setcredentialsprovider1_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CloudTasksSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setTransportChannelProvider( + CloudTasksSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..d434e08d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_create_setendpoint_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CloudTasksSettings; +import com.google.cloud.tasks.v2beta3.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder().setEndpoint(myEndpoint).build(); + CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/AsyncCreateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/AsyncCreateQueue.java new file mode 100644 index 00000000..ca315705 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/AsyncCreateQueue.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createqueue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CreateQueueRequest; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; + +public class AsyncCreateQueue { + + public static void main(String[] args) throws Exception { + asyncCreateQueue(); + } + + public static void asyncCreateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateQueueRequest request = + CreateQueueRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQueue(Queue.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.createQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createqueue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueue.java new file mode 100644 index 00000000..4d711ceb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueue.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createqueue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CreateQueueRequest; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; + +public class SyncCreateQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueue(); + } + + public static void syncCreateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateQueueRequest request = + CreateQueueRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setQueue(Queue.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.createQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java new file mode 100644 index 00000000..47be9793 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueueLocationnameQueue.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createqueue_locationnamequeue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; + +public class SyncCreateQueueLocationnameQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueueLocationnameQueue(); + } + + public static void syncCreateQueueLocationnameQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Queue queue = Queue.newBuilder().build(); + Queue response = cloudTasksClient.createQueue(parent, queue); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createqueue_locationnamequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java new file mode 100644 index 00000000..0d613bc1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createqueue/SyncCreateQueueStringQueue.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createqueue_stringqueue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; + +public class SyncCreateQueueStringQueue { + + public static void main(String[] args) throws Exception { + syncCreateQueueStringQueue(); + } + + public static void syncCreateQueueStringQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Queue queue = Queue.newBuilder().build(); + Queue response = cloudTasksClient.createQueue(parent, queue); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createqueue_stringqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/AsyncCreateTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/AsyncCreateTask.java new file mode 100644 index 00000000..6305ba81 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/AsyncCreateTask.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createtask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CreateTaskRequest; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class AsyncCreateTask { + + public static void main(String[] args) throws Exception { + asyncCreateTask(); + } + + public static void asyncCreateTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateTaskRequest request = + CreateTaskRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setTask(Task.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.createTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createtask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTask.java new file mode 100644 index 00000000..9e6e187a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createtask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.CreateTaskRequest; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class SyncCreateTask { + + public static void main(String[] args) throws Exception { + syncCreateTask(); + } + + public static void syncCreateTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + CreateTaskRequest request = + CreateTaskRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setTask(Task.newBuilder().build()) + .build(); + Task response = cloudTasksClient.createTask(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java new file mode 100644 index 00000000..bed8b931 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTaskQueuenameTask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createtask_queuenametask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class SyncCreateTaskQueuenameTask { + + public static void main(String[] args) throws Exception { + syncCreateTaskQueuenameTask(); + } + + public static void syncCreateTaskQueuenameTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Task task = Task.newBuilder().build(); + Task response = cloudTasksClient.createTask(parent, task); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createtask_queuenametask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTaskStringTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTaskStringTask.java new file mode 100644 index 00000000..b61f91aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/createtask/SyncCreateTaskStringTask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_createtask_stringtask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class SyncCreateTaskStringTask { + + public static void main(String[] args) throws Exception { + syncCreateTaskStringTask(); + } + + public static void syncCreateTaskStringTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Task task = Task.newBuilder().build(); + Task response = cloudTasksClient.createTask(parent, task); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_createtask_stringtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/AsyncDeleteQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/AsyncDeleteQueue.java new file mode 100644 index 00000000..4f774533 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/AsyncDeleteQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.DeleteQueueRequest; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.protobuf.Empty; + +public class AsyncDeleteQueue { + + public static void main(String[] args) throws Exception { + asyncDeleteQueue(); + } + + public static void asyncDeleteQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteQueueRequest request = + DeleteQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.deleteQueueCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueue.java new file mode 100644 index 00000000..335fd8b9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletequeue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.DeleteQueueRequest; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueue { + + public static void main(String[] args) throws Exception { + syncDeleteQueue(); + } + + public static void syncDeleteQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteQueueRequest request = + DeleteQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + cloudTasksClient.deleteQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java new file mode 100644 index 00000000..b03ca7bd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletequeue_queuename_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueueQueuename { + + public static void main(String[] args) throws Exception { + syncDeleteQueueQueuename(); + } + + public static void syncDeleteQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + cloudTasksClient.deleteQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueueString.java new file mode 100644 index 00000000..a67c1cd7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletequeue/SyncDeleteQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletequeue_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.protobuf.Empty; + +public class SyncDeleteQueueString { + + public static void main(String[] args) throws Exception { + syncDeleteQueueString(); + } + + public static void syncDeleteQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + cloudTasksClient.deleteQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/AsyncDeleteTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/AsyncDeleteTask.java new file mode 100644 index 00000000..4c3d45d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/AsyncDeleteTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletetask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.DeleteTaskRequest; +import com.google.cloud.tasks.v2beta3.TaskName; +import com.google.protobuf.Empty; + +public class AsyncDeleteTask { + + public static void main(String[] args) throws Exception { + asyncDeleteTask(); + } + + public static void asyncDeleteTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteTaskRequest request = + DeleteTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.deleteTaskCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletetask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTask.java new file mode 100644 index 00000000..db5646ff --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletetask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.DeleteTaskRequest; +import com.google.cloud.tasks.v2beta3.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTask { + + public static void main(String[] args) throws Exception { + syncDeleteTask(); + } + + public static void syncDeleteTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + DeleteTaskRequest request = + DeleteTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + cloudTasksClient.deleteTask(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletetask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTaskString.java new file mode 100644 index 00000000..00c42019 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletetask_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTaskString { + + public static void main(String[] args) throws Exception { + syncDeleteTaskString(); + } + + public static void syncDeleteTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + cloudTasksClient.deleteTask(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletetask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java new file mode 100644 index 00000000..1c7f5c7f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/deletetask/SyncDeleteTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_deletetask_taskname_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.TaskName; +import com.google.protobuf.Empty; + +public class SyncDeleteTaskTaskname { + + public static void main(String[] args) throws Exception { + syncDeleteTaskTaskname(); + } + + public static void syncDeleteTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + cloudTasksClient.deleteTask(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_deletetask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 00000000..049d109a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/AsyncGetIamPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 00000000..3b6c93d6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicy.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getiampolicy_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = cloudTasksClient.getIamPolicy(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java new file mode 100644 index 00000000..703b836f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicyResourcename.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getiampolicy_resourcename_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicyResourcename { + + public static void main(String[] args) throws Exception { + syncGetIamPolicyResourcename(); + } + + public static void syncGetIamPolicyResourcename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Policy response = cloudTasksClient.getIamPolicy(resource); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getiampolicy_resourcename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java new file mode 100644 index 00000000..598be27c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getiampolicy/SyncGetIamPolicyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getiampolicy_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicyString { + + public static void main(String[] args) throws Exception { + syncGetIamPolicyString(); + } + + public static void syncGetIamPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Policy response = cloudTasksClient.getIamPolicy(resource); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getiampolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/AsyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/AsyncGetQueue.java new file mode 100644 index 00000000..beb5a0a3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/AsyncGetQueue.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getqueue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.GetQueueRequest; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.protobuf.FieldMask; + +public class AsyncGetQueue { + + public static void main(String[] args) throws Exception { + asyncGetQueue(); + } + + public static void asyncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetQueueRequest request = + GetQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.getQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getqueue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..b7c62e66 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getqueue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.GetQueueRequest; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.protobuf.FieldMask; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetQueueRequest request = + GetQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setReadMask(FieldMask.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.getQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueueQueuename.java new file mode 100644 index 00000000..bbae5407 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getqueue_queuename_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncGetQueueQueuename { + + public static void main(String[] args) throws Exception { + syncGetQueueQueuename(); + } + + public static void syncGetQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.getQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getqueue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueueString.java new file mode 100644 index 00000000..c5df8b17 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/getqueue/SyncGetQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_getqueue_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncGetQueueString { + + public static void main(String[] args) throws Exception { + syncGetQueueString(); + } + + public static void syncGetQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.getQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_getqueue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/AsyncGetTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/AsyncGetTask.java new file mode 100644 index 00000000..b3ed26be --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/AsyncGetTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_gettask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.GetTaskRequest; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class AsyncGetTask { + + public static void main(String[] args) throws Exception { + asyncGetTask(); + } + + public static void asyncGetTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.getTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_gettask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTask.java new file mode 100644 index 00000000..836db60d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_gettask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.GetTaskRequest; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class SyncGetTask { + + public static void main(String[] args) throws Exception { + syncGetTask(); + } + + public static void syncGetTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + Task response = cloudTasksClient.getTask(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_gettask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTaskString.java new file mode 100644 index 00000000..930c4419 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_gettask_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class SyncGetTaskString { + + public static void main(String[] args) throws Exception { + syncGetTaskString(); + } + + public static void syncGetTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Task response = cloudTasksClient.getTask(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_gettask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTaskTaskname.java new file mode 100644 index 00000000..868eefab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/gettask/SyncGetTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_gettask_taskname_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class SyncGetTaskTaskname { + + public static void main(String[] args) throws Exception { + syncGetTaskTaskname(); + } + + public static void syncGetTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Task response = cloudTasksClient.getTask(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_gettask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/AsyncListQueues.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/AsyncListQueues.java new file mode 100644 index 00000000..5ea1bbde --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/AsyncListQueues.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listqueues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.ListQueuesRequest; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.protobuf.FieldMask; + +public class AsyncListQueues { + + public static void main(String[] args) throws Exception { + asyncListQueues(); + } + + public static void asyncListQueues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.listQueuesPagedCallable().futureCall(request); + // Do something. + for (Queue element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listqueues_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/AsyncListQueuesPaged.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/AsyncListQueuesPaged.java new file mode 100644 index 00000000..d679ca18 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/AsyncListQueuesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listqueues_paged_async] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.ListQueuesRequest; +import com.google.cloud.tasks.v2beta3.ListQueuesResponse; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.common.base.Strings; +import com.google.protobuf.FieldMask; + +public class AsyncListQueuesPaged { + + public static void main(String[] args) throws Exception { + asyncListQueuesPaged(); + } + + public static void asyncListQueuesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + while (true) { + ListQueuesResponse response = cloudTasksClient.listQueuesCallable().call(request); + for (Queue element : response.getQueuesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listqueues_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueues.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueues.java new file mode 100644 index 00000000..d7c5a7d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueues.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listqueues_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.ListQueuesRequest; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.protobuf.FieldMask; + +public class SyncListQueues { + + public static void main(String[] args) throws Exception { + syncListQueues(); + } + + public static void syncListQueues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListQueuesRequest request = + ListQueuesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setReadMask(FieldMask.newBuilder().build()) + .build(); + for (Queue element : cloudTasksClient.listQueues(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listqueues_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueuesLocationname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueuesLocationname.java new file mode 100644 index 00000000..9f129089 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueuesLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listqueues_locationname_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; + +public class SyncListQueuesLocationname { + + public static void main(String[] args) throws Exception { + syncListQueuesLocationname(); + } + + public static void syncListQueuesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listqueues_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueuesString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueuesString.java new file mode 100644 index 00000000..60309c64 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listqueues/SyncListQueuesString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listqueues_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.LocationName; +import com.google.cloud.tasks.v2beta3.Queue; + +public class SyncListQueuesString { + + public static void main(String[] args) throws Exception { + syncListQueuesString(); + } + + public static void syncListQueuesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Queue element : cloudTasksClient.listQueues(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listqueues_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/AsyncListTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/AsyncListTasks.java new file mode 100644 index 00000000..c19f0208 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/AsyncListTasks.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listtasks_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.ListTasksRequest; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class AsyncListTasks { + + public static void main(String[] args) throws Exception { + asyncListTasks(); + } + + public static void asyncListTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = cloudTasksClient.listTasksPagedCallable().futureCall(request); + // Do something. + for (Task element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listtasks_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/AsyncListTasksPaged.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/AsyncListTasksPaged.java new file mode 100644 index 00000000..17711db6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/AsyncListTasksPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listtasks_paged_async] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.ListTasksRequest; +import com.google.cloud.tasks.v2beta3.ListTasksResponse; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.common.base.Strings; + +public class AsyncListTasksPaged { + + public static void main(String[] args) throws Exception { + asyncListTasksPaged(); + } + + public static void asyncListTasksPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListTasksResponse response = cloudTasksClient.listTasksCallable().call(request); + for (Task element : response.getTasksList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listtasks_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasks.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasks.java new file mode 100644 index 00000000..046d9477 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasks.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listtasks_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.ListTasksRequest; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class SyncListTasks { + + public static void main(String[] args) throws Exception { + syncListTasks(); + } + + public static void syncListTasks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Task element : cloudTasksClient.listTasks(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listtasks_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasksQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasksQueuename.java new file mode 100644 index 00000000..f67e5d81 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasksQueuename.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listtasks_queuename_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class SyncListTasksQueuename { + + public static void main(String[] args) throws Exception { + syncListTasksQueuename(); + } + + public static void syncListTasksQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listtasks_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasksString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasksString.java new file mode 100644 index 00000000..e8fcd18a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/listtasks/SyncListTasksString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_listtasks_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.Task; + +public class SyncListTasksString { + + public static void main(String[] args) throws Exception { + syncListTasksString(); + } + + public static void syncListTasksString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String parent = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + for (Task element : cloudTasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_listtasks_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/AsyncPauseQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/AsyncPauseQueue.java new file mode 100644 index 00000000..761b5166 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/AsyncPauseQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_pausequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.PauseQueueRequest; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class AsyncPauseQueue { + + public static void main(String[] args) throws Exception { + asyncPauseQueue(); + } + + public static void asyncPauseQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PauseQueueRequest request = + PauseQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.pauseQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_pausequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueue.java new file mode 100644 index 00000000..93394574 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_pausequeue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.PauseQueueRequest; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncPauseQueue { + + public static void main(String[] args) throws Exception { + syncPauseQueue(); + } + + public static void syncPauseQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PauseQueueRequest request = + PauseQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.pauseQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_pausequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java new file mode 100644 index 00000000..ed9e59e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_pausequeue_queuename_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncPauseQueueQueuename { + + public static void main(String[] args) throws Exception { + syncPauseQueueQueuename(); + } + + public static void syncPauseQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.pauseQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_pausequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueueString.java new file mode 100644 index 00000000..25a0cc0a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/pausequeue/SyncPauseQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_pausequeue_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncPauseQueueString { + + public static void main(String[] args) throws Exception { + syncPauseQueueString(); + } + + public static void syncPauseQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.pauseQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_pausequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/AsyncPurgeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/AsyncPurgeQueue.java new file mode 100644 index 00000000..b7d0108d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/AsyncPurgeQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_purgequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.PurgeQueueRequest; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class AsyncPurgeQueue { + + public static void main(String[] args) throws Exception { + asyncPurgeQueue(); + } + + public static void asyncPurgeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PurgeQueueRequest request = + PurgeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.purgeQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_purgequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueue.java new file mode 100644 index 00000000..f555c736 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_purgequeue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.PurgeQueueRequest; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncPurgeQueue { + + public static void main(String[] args) throws Exception { + syncPurgeQueue(); + } + + public static void syncPurgeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + PurgeQueueRequest request = + PurgeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.purgeQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_purgequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java new file mode 100644 index 00000000..9a6f7d07 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_purgequeue_queuename_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncPurgeQueueQueuename { + + public static void main(String[] args) throws Exception { + syncPurgeQueueQueuename(); + } + + public static void syncPurgeQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.purgeQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_purgequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueueString.java new file mode 100644 index 00000000..ba833f52 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/purgequeue/SyncPurgeQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_purgequeue_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncPurgeQueueString { + + public static void main(String[] args) throws Exception { + syncPurgeQueueString(); + } + + public static void syncPurgeQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.purgeQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_purgequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/AsyncResumeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/AsyncResumeQueue.java new file mode 100644 index 00000000..8a522847 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/AsyncResumeQueue.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_resumequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.ResumeQueueRequest; + +public class AsyncResumeQueue { + + public static void main(String[] args) throws Exception { + asyncResumeQueue(); + } + + public static void asyncResumeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResumeQueueRequest request = + ResumeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + ApiFuture future = cloudTasksClient.resumeQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_resumequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueue.java new file mode 100644 index 00000000..50348c46 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueue.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_resumequeue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.cloud.tasks.v2beta3.ResumeQueueRequest; + +public class SyncResumeQueue { + + public static void main(String[] args) throws Exception { + syncResumeQueue(); + } + + public static void syncResumeQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResumeQueueRequest request = + ResumeQueueRequest.newBuilder() + .setName(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .build(); + Queue response = cloudTasksClient.resumeQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_resumequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java new file mode 100644 index 00000000..df75ed99 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueueQueuename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_resumequeue_queuename_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncResumeQueueQueuename { + + public static void main(String[] args) throws Exception { + syncResumeQueueQueuename(); + } + + public static void syncResumeQueueQueuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Queue response = cloudTasksClient.resumeQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_resumequeue_queuename_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueueString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueueString.java new file mode 100644 index 00000000..bdfb0c01 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/resumequeue/SyncResumeQueueString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_resumequeue_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.QueueName; + +public class SyncResumeQueueString { + + public static void main(String[] args) throws Exception { + syncResumeQueueString(); + } + + public static void syncResumeQueueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Queue response = cloudTasksClient.resumeQueue(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_resumequeue_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/AsyncRunTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/AsyncRunTask.java new file mode 100644 index 00000000..8a392118 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/AsyncRunTask.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_runtask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.RunTaskRequest; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class AsyncRunTask { + + public static void main(String[] args) throws Exception { + asyncRunTask(); + } + + public static void asyncRunTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RunTaskRequest request = + RunTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + ApiFuture future = cloudTasksClient.runTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_runtask_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTask.java new file mode 100644 index 00000000..8b73a70b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_runtask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.RunTaskRequest; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class SyncRunTask { + + public static void main(String[] args) throws Exception { + syncRunTask(); + } + + public static void syncRunTask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + RunTaskRequest request = + RunTaskRequest.newBuilder() + .setName(TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString()) + .build(); + Task response = cloudTasksClient.runTask(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_runtask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTaskString.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTaskString.java new file mode 100644 index 00000000..d5da488b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTaskString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_runtask_string_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class SyncRunTaskString { + + public static void main(String[] args) throws Exception { + syncRunTaskString(); + } + + public static void syncRunTaskString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]").toString(); + Task response = cloudTasksClient.runTask(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_runtask_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTaskTaskname.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTaskTaskname.java new file mode 100644 index 00000000..edd2d333 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/runtask/SyncRunTaskTaskname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_runtask_taskname_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Task; +import com.google.cloud.tasks.v2beta3.TaskName; + +public class SyncRunTaskTaskname { + + public static void main(String[] args) throws Exception { + syncRunTaskTaskname(); + } + + public static void syncRunTaskTaskname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); + Task response = cloudTasksClient.runTask(name); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_runtask_taskname_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 00000000..f1e7cd6e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/AsyncSetIamPolicy.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_setiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_setiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 00000000..33d53f0f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_setiampolicy_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = cloudTasksClient.setIamPolicy(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_setiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java new file mode 100644 index 00000000..1b0b0d92 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_setiampolicy_resourcenamepolicy_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.Policy; + +public class SyncSetIamPolicyResourcenamePolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicyResourcenamePolicy(); + } + + public static void syncSetIamPolicyResourcenamePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + Policy policy = Policy.newBuilder().build(); + Policy response = cloudTasksClient.setIamPolicy(resource, policy); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_setiampolicy_resourcenamepolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java new file mode 100644 index 00000000..2cbfddff --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/setiampolicy/SyncSetIamPolicyStringPolicy.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_setiampolicy_stringpolicy_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.Policy; + +public class SyncSetIamPolicyStringPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicyStringPolicy(); + } + + public static void syncSetIamPolicyStringPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + Policy policy = Policy.newBuilder().build(); + Policy response = cloudTasksClient.setIamPolicy(resource, policy); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_setiampolicy_stringpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 00000000..4bece0a9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/AsyncTestIamPermissions.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_testiampermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + cloudTasksClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_testiampermissions_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 00000000..9b6ec431 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissions.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_testiampermissions_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = cloudTasksClient.testIamPermissions(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_testiampermissions_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java new file mode 100644 index 00000000..b92bcce7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncTestIamPermissionsResourcenameListstring { + + public static void main(String[] args) throws Exception { + syncTestIamPermissionsResourcenameListstring(); + } + + public static void syncTestIamPermissionsResourcenameListstring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); + List permissions = new ArrayList<>(); + TestIamPermissionsResponse response = + cloudTasksClient.testIamPermissions(resource, permissions); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java new file mode 100644 index 00000000..b144ff3b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/testiampermissions/SyncTestIamPermissionsStringListstring.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_testiampermissions_stringliststring_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.QueueName; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; +import java.util.List; + +public class SyncTestIamPermissionsStringListstring { + + public static void main(String[] args) throws Exception { + syncTestIamPermissionsStringListstring(); + } + + public static void syncTestIamPermissionsStringListstring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + String resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString(); + List permissions = new ArrayList<>(); + TestIamPermissionsResponse response = + cloudTasksClient.testIamPermissions(resource, permissions); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_testiampermissions_stringliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/AsyncUpdateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/AsyncUpdateQueue.java new file mode 100644 index 00000000..310ec8a0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/AsyncUpdateQueue.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_updatequeue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.UpdateQueueRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateQueue { + + public static void main(String[] args) throws Exception { + asyncUpdateQueue(); + } + + public static void asyncUpdateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + UpdateQueueRequest request = + UpdateQueueRequest.newBuilder() + .setQueue(Queue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = cloudTasksClient.updateQueueCallable().futureCall(request); + // Do something. + Queue response = future.get(); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_updatequeue_async] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/SyncUpdateQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/SyncUpdateQueue.java new file mode 100644 index 00000000..b9b4415c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/SyncUpdateQueue.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_updatequeue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.cloud.tasks.v2beta3.UpdateQueueRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateQueue { + + public static void main(String[] args) throws Exception { + syncUpdateQueue(); + } + + public static void syncUpdateQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + UpdateQueueRequest request = + UpdateQueueRequest.newBuilder() + .setQueue(Queue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Queue response = cloudTasksClient.updateQueue(request); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_updatequeue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java new file mode 100644 index 00000000..077ea6dc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtasksclient/updatequeue/SyncUpdateQueueQueueFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtasksclient_updatequeue_queuefieldmask_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksClient; +import com.google.cloud.tasks.v2beta3.Queue; +import com.google.protobuf.FieldMask; + +public class SyncUpdateQueueQueueFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateQueueQueueFieldmask(); + } + + public static void syncUpdateQueueQueueFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { + Queue queue = Queue.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Queue response = cloudTasksClient.updateQueue(queue, updateMask); + } + } +} +// [END tasks_v2beta3_generated_cloudtasksclient_updatequeue_queuefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtaskssettings/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtaskssettings/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..3475de29 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/cloudtaskssettings/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.samples; + +// [START tasks_v2beta3_generated_cloudtaskssettings_getqueue_sync] +import com.google.cloud.tasks.v2beta3.CloudTasksSettings; +import java.time.Duration; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksSettings.Builder cloudTasksSettingsBuilder = CloudTasksSettings.newBuilder(); + cloudTasksSettingsBuilder + .getQueueSettings() + .setRetrySettings( + cloudTasksSettingsBuilder + .getQueueSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudTasksSettings cloudTasksSettings = cloudTasksSettingsBuilder.build(); + } +} +// [END tasks_v2beta3_generated_cloudtaskssettings_getqueue_sync] diff --git a/samples/snippets/generated/com/google/cloud/tasks/v2beta3/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java new file mode 100644 index 00000000..60609678 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/tasks/v2beta3/stub/cloudtasksstubsettings/getqueue/SyncGetQueue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tasks.v2beta3.stub.samples; + +// [START tasks_v2beta3_generated_cloudtasksstubsettings_getqueue_sync] +import com.google.cloud.tasks.v2beta3.stub.CloudTasksStubSettings; +import java.time.Duration; + +public class SyncGetQueue { + + public static void main(String[] args) throws Exception { + syncGetQueue(); + } + + public static void syncGetQueue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudTasksStubSettings.Builder cloudTasksSettingsBuilder = CloudTasksStubSettings.newBuilder(); + cloudTasksSettingsBuilder + .getQueueSettings() + .setRetrySettings( + cloudTasksSettingsBuilder + .getQueueSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudTasksStubSettings cloudTasksSettings = cloudTasksSettingsBuilder.build(); + } +} +// [END tasks_v2beta3_generated_cloudtasksstubsettings_getqueue_sync] diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 7aaba932..be1eb61e 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 26.0.0 + 26.1.1 pom import diff --git a/versions.txt b/versions.txt index d5c8dafa..8eb90724 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -google-cloud-tasks:2.3.6:2.3.6 -grpc-google-cloud-tasks-v2beta3:0.93.6:0.93.6 -grpc-google-cloud-tasks-v2beta2:0.93.6:0.93.6 -grpc-google-cloud-tasks-v2:2.3.6:2.3.6 -proto-google-cloud-tasks-v2beta3:0.93.6:0.93.6 -proto-google-cloud-tasks-v2beta2:0.93.6:0.93.6 -proto-google-cloud-tasks-v2:2.3.6:2.3.6 +google-cloud-tasks:2.3.7:2.3.7 +grpc-google-cloud-tasks-v2beta3:0.93.7:0.93.7 +grpc-google-cloud-tasks-v2beta2:0.93.7:0.93.7 +grpc-google-cloud-tasks-v2:2.3.7:2.3.7 +proto-google-cloud-tasks-v2beta3:0.93.7:0.93.7 +proto-google-cloud-tasks-v2beta2:0.93.7:0.93.7 +proto-google-cloud-tasks-v2:2.3.7:2.3.7