google-cloud-security_center-v1 0.3.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +66 -2
  4. data/lib/google/cloud/security_center/v1.rb +3 -0
  5. data/lib/google/cloud/security_center/v1/security_center/client.rb +126 -106
  6. data/lib/google/cloud/security_center/v1/security_center/operations.rb +95 -10
  7. data/lib/google/cloud/security_center/v1/security_center/paths.rb +175 -17
  8. data/lib/google/cloud/security_center/v1/version.rb +1 -1
  9. data/lib/google/cloud/securitycenter/v1/asset_pb.rb +4 -1
  10. data/lib/google/cloud/securitycenter/v1/finding_pb.rb +11 -1
  11. data/lib/google/cloud/securitycenter/v1/folder_pb.rb +24 -0
  12. data/lib/google/cloud/securitycenter/v1/notification_config_pb.rb +1 -1
  13. data/lib/google/cloud/securitycenter/v1/notification_message_pb.rb +1 -1
  14. data/lib/google/cloud/securitycenter/v1/organization_settings_pb.rb +2 -1
  15. data/lib/google/cloud/securitycenter/v1/resource_pb.rb +3 -0
  16. data/lib/google/cloud/securitycenter/v1/run_asset_discovery_response_pb.rb +1 -1
  17. data/lib/google/cloud/securitycenter/v1/security_marks_pb.rb +2 -1
  18. data/lib/google/cloud/securitycenter/v1/securitycenter_service_pb.rb +2 -0
  19. data/lib/google/cloud/securitycenter/v1/securitycenter_service_services_pb.rb +28 -25
  20. data/lib/google/cloud/securitycenter/v1/source_pb.rb +2 -1
  21. data/proto_docs/google/api/field_behavior.rb +6 -0
  22. data/proto_docs/google/api/resource.rb +50 -14
  23. data/proto_docs/google/cloud/securitycenter/v1/asset.rb +13 -2
  24. data/proto_docs/google/cloud/securitycenter/v1/finding.rb +73 -1
  25. data/proto_docs/google/cloud/securitycenter/v1/folder.rb +40 -0
  26. data/proto_docs/google/cloud/securitycenter/v1/notification_config.rb +2 -2
  27. data/proto_docs/google/cloud/securitycenter/v1/organization_settings.rb +4 -0
  28. data/proto_docs/google/cloud/securitycenter/v1/resource.rb +5 -0
  29. data/proto_docs/google/cloud/securitycenter/v1/security_marks.rb +10 -0
  30. data/proto_docs/google/cloud/securitycenter/v1/securitycenter_service.rb +62 -45
  31. data/proto_docs/google/cloud/securitycenter/v1/source.rb +8 -0
  32. data/proto_docs/google/longrunning/operations.rb +17 -3
  33. data/proto_docs/google/protobuf/any.rb +5 -2
  34. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  35. metadata +13 -9
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module SecurityCenter
23
+ module V1
24
+ # Message that contains the resource name and display name of a folder
25
+ # resource.
26
+ # @!attribute [rw] resource_folder
27
+ # @return [::String]
28
+ # Full resource name of this folder. See:
29
+ # https://cloud.google.com/apis/design/resource_names#full_resource_name
30
+ # @!attribute [rw] resource_folder_display_name
31
+ # @return [::String]
32
+ # The user defined display name for this folder.
33
+ class Folder
34
+ include ::Google::Protobuf::MessageExts
35
+ extend ::Google::Protobuf::MessageExts::ClassMethods
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -36,12 +36,12 @@ module Google
36
36
  # The description of the notification config (max of 1024 characters).
37
37
  # @!attribute [rw] pubsub_topic
38
38
  # @return [::String]
39
- # The PubSub topic to send notifications to. Its format is
39
+ # The Pub/Sub topic to send notifications to. Its format is
40
40
  # "projects/[project_id]/topics/[topic]".
41
41
  # @!attribute [r] service_account
42
42
  # @return [::String]
43
43
  # Output only. The service account that needs "pubsub.topics.publish"
44
- # permission to publish to the PubSub topic.
44
+ # permission to publish to the Pub/Sub topic.
45
45
  # @!attribute [rw] streaming_config
46
46
  # @return [::Google::Cloud::SecurityCenter::V1::NotificationConfig::StreamingConfig]
47
47
  # The config for triggering streaming-based notifications.
@@ -49,6 +49,10 @@ module Google
49
49
  # @!attribute [rw] inclusion_mode
50
50
  # @return [::Google::Cloud::SecurityCenter::V1::OrganizationSettings::AssetDiscoveryConfig::InclusionMode]
51
51
  # The mode to use for filtering asset discovery.
52
+ # @!attribute [rw] folder_ids
53
+ # @return [::Array<::String>]
54
+ # The folder ids to use for filtering asset discovery.
55
+ # It consists of only digits, e.g., 756619654966.
52
56
  class AssetDiscoveryConfig
53
57
  include ::Google::Protobuf::MessageExts
54
58
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -38,6 +38,11 @@ module Google
38
38
  # @!attribute [rw] parent_display_name
39
39
  # @return [::String]
40
40
  # The human readable name of resource's parent.
41
+ # @!attribute [r] folders
42
+ # @return [::Array<::Google::Cloud::SecurityCenter::V1::Folder>]
43
+ # Output only. Contains a Folder message for each folder in the assets ancestry.
44
+ # The first folder is the deepest nested folder, and the last folder is the
45
+ # folder directly under the Organization.
41
46
  class Resource
42
47
  include ::Google::Protobuf::MessageExts
43
48
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -42,6 +42,16 @@ module Google
42
42
  # * Keys must be letters, numbers, underscores, or dashes
43
43
  # * Values have leading and trailing whitespace trimmed, remaining
44
44
  # characters must be between 1 - 4096 characters (inclusive)
45
+ # @!attribute [rw] canonical_name
46
+ # @return [::String]
47
+ # The canonical name of the marks.
48
+ # Examples:
49
+ # "organizations/\\{organization_id}/assets/\\{asset_id}/securityMarks"
50
+ # "folders/\\{folder_id}/assets/\\{asset_id}/securityMarks"
51
+ # "projects/\\{project_number}/assets/\\{asset_id}/securityMarks"
52
+ # "organizations/\\{organization_id}/sources/\\{source_id}/findings/\\{finding_id}/securityMarks"
53
+ # "folders/\\{folder_id}/sources/\\{source_id}/findings/\\{finding_id}/securityMarks"
54
+ # "projects/\\{project_number}/sources/\\{source_id}/findings/\\{finding_id}/securityMarks"
45
55
  class SecurityMarks
46
56
  include ::Google::Protobuf::MessageExts
47
57
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -33,8 +33,8 @@ module Google
33
33
  # greater than 0 characters in length.
34
34
  # @!attribute [rw] finding
35
35
  # @return [::Google::Cloud::SecurityCenter::V1::Finding]
36
- # Required. The Finding being created. The name and security_marks will be
37
- # ignored as they are both output only fields on this resource.
36
+ # Required. The Finding being created. The name and security_marks will be ignored as
37
+ # they are both output only fields on this resource.
38
38
  class CreateFindingRequest
39
39
  include ::Google::Protobuf::MessageExts
40
40
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -43,8 +43,8 @@ module Google
43
43
  # Request message for creating a notification config.
44
44
  # @!attribute [rw] parent
45
45
  # @return [::String]
46
- # Required. Resource name of the new notification config's parent. Its format
47
- # is "organizations/[organization_id]".
46
+ # Required. Resource name of the new notification config's parent. Its format is
47
+ # "organizations/[organization_id]".
48
48
  # @!attribute [rw] config_id
49
49
  # @return [::String]
50
50
  # Required.
@@ -53,9 +53,8 @@ module Google
53
53
  # characters, underscores or hyphens only.
54
54
  # @!attribute [rw] notification_config
55
55
  # @return [::Google::Cloud::SecurityCenter::V1::NotificationConfig]
56
- # Required. The notification config being created. The name and the service
57
- # account will be ignored as they are both output only fields on this
58
- # resource.
56
+ # Required. The notification config being created. The name and the service account
57
+ # will be ignored as they are both output only fields on this resource.
59
58
  class CreateNotificationConfigRequest
60
59
  include ::Google::Protobuf::MessageExts
61
60
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -68,8 +67,8 @@ module Google
68
67
  # "organizations/[organization_id]".
69
68
  # @!attribute [rw] source
70
69
  # @return [::Google::Cloud::SecurityCenter::V1::Source]
71
- # Required. The Source being created, only the display_name and description
72
- # will be used. All other fields will be ignored.
70
+ # Required. The Source being created, only the display_name and description will be
71
+ # used. All other fields will be ignored.
73
72
  class CreateSourceRequest
74
73
  include ::Google::Protobuf::MessageExts
75
74
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -98,8 +97,8 @@ module Google
98
97
  # Request message for getting organization settings.
99
98
  # @!attribute [rw] name
100
99
  # @return [::String]
101
- # Required. Name of the organization to get organization settings for. Its
102
- # format is "organizations/[organization_id]/organizationSettings".
100
+ # Required. Name of the organization to get organization settings for. Its format is
101
+ # "organizations/[organization_id]/organizationSettings".
103
102
  class GetOrganizationSettingsRequest
104
103
  include ::Google::Protobuf::MessageExts
105
104
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -119,7 +118,8 @@ module Google
119
118
  # @!attribute [rw] parent
120
119
  # @return [::String]
121
120
  # Required. Name of the organization to groupBy. Its format is
122
- # "organizations/[organization_id]".
121
+ # "organizations/[organization_id], folders/[folder_id], or
122
+ # projects/[project_id]".
123
123
  # @!attribute [rw] filter
124
124
  # @return [::String]
125
125
  # Expression that defines the filter to apply across assets.
@@ -180,15 +180,15 @@ module Google
180
180
  # For example, `resource_properties.size = 100` is a valid filter string.
181
181
  #
182
182
  # Use a partial match on the empty string to filter based on a property
183
- # existing:`resource_properties.my_property : ""`
183
+ # existing: `resource_properties.my_property : ""`
184
184
  #
185
185
  # Use a negated partial match on the empty string to filter based on a
186
186
  # property not existing: `-resource_properties.my_property : ""`
187
187
  # @!attribute [rw] group_by
188
188
  # @return [::String]
189
- # Required. Expression that defines what assets fields to use for grouping.
190
- # The string value should follow SQL syntax: comma separated list of fields.
191
- # For example:
189
+ # Required. Expression that defines what assets fields to use for grouping. The string
190
+ # value should follow SQL syntax: comma separated list of fields. For
191
+ # example:
192
192
  # "security_center_properties.resource_project,security_center_properties.project".
193
193
  #
194
194
  # The following fields are supported when compare_duration is not set:
@@ -278,9 +278,12 @@ module Google
278
278
  # @!attribute [rw] parent
279
279
  # @return [::String]
280
280
  # Required. Name of the source to groupBy. Its format is
281
- # "organizations/[organization_id]/sources/[source_id]". To groupBy across
282
- # all sources provide a source_id of `-`. For example:
283
- # organizations/\\{organization_id}/sources/-
281
+ # "organizations/[organization_id]/sources/[source_id]",
282
+ # folders/[folder_id]/sources/[source_id], or
283
+ # projects/[project_id]/sources/[source_id]. To groupBy across all sources
284
+ # provide a source_id of `-`. For example:
285
+ # organizations/\\{organization_id}/sources/-, folders/\\{folder_id}/sources/-,
286
+ # or projects/\\{project_id}/sources/-
284
287
  # @!attribute [rw] filter
285
288
  # @return [::String]
286
289
  # Expression that defines the filter to apply across findings.
@@ -316,6 +319,7 @@ module Google
316
319
  # * category: `=`, `:`
317
320
  # * external_uri: `=`, `:`
318
321
  # * event_time: `=`, `>`, `<`, `>=`, `<=`
322
+ # * severity: `=`, `:`
319
323
  #
320
324
  # Usage: This should be milliseconds since epoch or an RFC3339 string.
321
325
  # Examples:
@@ -334,9 +338,9 @@ module Google
334
338
  # property not existing: `-source_properties.my_property : ""`
335
339
  # @!attribute [rw] group_by
336
340
  # @return [::String]
337
- # Required. Expression that defines what assets fields to use for grouping
338
- # (including `state_change`). The string value should follow SQL syntax:
339
- # comma separated list of fields. For example: "parent,resource_name".
341
+ # Required. Expression that defines what assets fields to use for grouping (including
342
+ # `state_change`). The string value should follow SQL syntax: comma separated
343
+ # list of fields. For example: "parent,resource_name".
340
344
  #
341
345
  # The following fields are supported:
342
346
  #
@@ -344,6 +348,7 @@ module Google
344
348
  # * category
345
349
  # * state
346
350
  # * parent
351
+ # * severity
347
352
  #
348
353
  # The following fields are supported when compare_duration is set:
349
354
  #
@@ -479,8 +484,9 @@ module Google
479
484
  # Request message for listing sources.
480
485
  # @!attribute [rw] parent
481
486
  # @return [::String]
482
- # Required. Resource name of the parent of sources to list. Its format should
483
- # be "organizations/[organization_id]".
487
+ # Required. Resource name of the parent of sources to list. Its format should be
488
+ # "organizations/[organization_id], folders/[folder_id], or
489
+ # projects/[project_id]".
484
490
  # @!attribute [rw] page_token
485
491
  # @return [::String]
486
492
  # The value returned by the last `ListSourcesResponse`; indicates
@@ -512,7 +518,8 @@ module Google
512
518
  # @!attribute [rw] parent
513
519
  # @return [::String]
514
520
  # Required. Name of the organization assets should belong to. Its format is
515
- # "organizations/[organization_id]".
521
+ # "organizations/[organization_id], folders/[folder_id], or
522
+ # projects/[project_id]".
516
523
  # @!attribute [rw] filter
517
524
  # @return [::String]
518
525
  # Expression that defines the filter to apply across assets.
@@ -634,8 +641,9 @@ module Google
634
641
  # read_time.
635
642
  # @!attribute [rw] field_mask
636
643
  # @return [::Google::Protobuf::FieldMask]
637
- # Optional. A field mask to specify the ListAssetsResult fields to be listed
638
- # in the response. An empty field mask will list all fields.
644
+ # A field mask to specify the ListAssetsResult fields to be listed in the
645
+ # response.
646
+ # An empty field mask will list all fields.
639
647
  # @!attribute [rw] page_token
640
648
  # @return [::String]
641
649
  # The value returned by the last `ListAssetsResponse`; indicates
@@ -705,9 +713,12 @@ module Google
705
713
  # @!attribute [rw] parent
706
714
  # @return [::String]
707
715
  # Required. Name of the source the findings belong to. Its format is
708
- # "organizations/[organization_id]/sources/[source_id]". To list across all
709
- # sources provide a source_id of `-`. For example:
710
- # organizations/\\{organization_id}/sources/-
716
+ # "organizations/[organization_id]/sources/[source_id],
717
+ # folders/[folder_id]/sources/[source_id], or
718
+ # projects/[project_id]/sources/[source_id]". To list across all sources
719
+ # provide a source_id of `-`. For example:
720
+ # organizations/\\{organization_id}/sources/-, folders/\\{folder_id}/sources/- or
721
+ # projects/\\{projects_id}/sources/-
711
722
  # @!attribute [rw] filter
712
723
  # @return [::String]
713
724
  # Expression that defines the filter to apply across findings.
@@ -736,13 +747,14 @@ module Google
736
747
  #
737
748
  # The following field and operator combinations are supported:
738
749
  #
739
- # name: `=`
740
- # parent: `=`, `:`
741
- # resource_name: `=`, `:`
742
- # state: `=`, `:`
743
- # category: `=`, `:`
744
- # external_uri: `=`, `:`
745
- # event_time: `=`, `>`, `<`, `>=`, `<=`
750
+ # * name: `=`
751
+ # * parent: `=`, `:`
752
+ # * resource_name: `=`, `:`
753
+ # * state: `=`, `:`
754
+ # * category: `=`, `:`
755
+ # * external_uri: `=`, `:`
756
+ # * event_time: `=`, `>`, `<`, `>=`, `<=`
757
+ # * severity: `=`, `:`
746
758
  #
747
759
  # Usage: This should be milliseconds since epoch or an RFC3339 string.
748
760
  # Examples:
@@ -819,8 +831,8 @@ module Google
819
831
  # read_time.
820
832
  # @!attribute [rw] field_mask
821
833
  # @return [::Google::Protobuf::FieldMask]
822
- # Optional. A field mask to specify the Finding fields to be listed in the
823
- # response. An empty field mask will list all fields.
834
+ # A field mask to specify the Finding fields to be listed in the response.
835
+ # An empty field mask will list all fields.
824
836
  # @!attribute [rw] page_token
825
837
  # @return [::String]
826
838
  # The value returned by the last `ListFindingsResponse`; indicates
@@ -860,7 +872,7 @@ module Google
860
872
  # @!attribute [rw] state_change
861
873
  # @return [::Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult::StateChange]
862
874
  # State change of the finding between the points in time.
863
- # @!attribute [rw] resource
875
+ # @!attribute [r] resource
864
876
  # @return [::Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult::Resource]
865
877
  # Output only. Resource that is associated with this finding.
866
878
  class ListFindingsResult
@@ -885,6 +897,11 @@ module Google
885
897
  # @!attribute [rw] parent_display_name
886
898
  # @return [::String]
887
899
  # The human readable name of resource's parent.
900
+ # @!attribute [rw] folders
901
+ # @return [::Array<::Google::Cloud::SecurityCenter::V1::Folder>]
902
+ # Contains a Folder message for each folder in the assets ancestry.
903
+ # The first folder is the deepest nested folder, and the last folder is
904
+ # the folder directly under the Organization.
888
905
  class Resource
889
906
  include ::Google::Protobuf::MessageExts
890
907
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -941,8 +958,8 @@ module Google
941
958
  # Request message for running asset discovery for an organization.
942
959
  # @!attribute [rw] parent
943
960
  # @return [::String]
944
- # Required. Name of the organization to run asset discovery for. Its format
945
- # is "organizations/[organization_id]".
961
+ # Required. Name of the organization to run asset discovery for. Its format is
962
+ # "organizations/[organization_id]".
946
963
  class RunAssetDiscoveryRequest
947
964
  include ::Google::Protobuf::MessageExts
948
965
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -951,8 +968,8 @@ module Google
951
968
  # Request message for updating or creating a finding.
952
969
  # @!attribute [rw] finding
953
970
  # @return [::Google::Cloud::SecurityCenter::V1::Finding]
954
- # Required. The finding resource to update or create if it does not already
955
- # exist. parent, security_marks, and update_time will be ignored.
971
+ # Required. The finding resource to update or create if it does not already exist.
972
+ # parent, security_marks, and update_time will be ignored.
956
973
  #
957
974
  # In the case of creation, the finding id portion of the name must be
958
975
  # alphanumeric and less than or equal to 32 characters and greater than 0
@@ -993,7 +1010,7 @@ module Google
993
1010
  # @return [::Google::Protobuf::FieldMask]
994
1011
  # The FieldMask to use when updating the settings resource.
995
1012
  #
996
- # If empty all mutable fields will be updated.
1013
+ # If empty all mutable fields will be updated.
997
1014
  class UpdateOrganizationSettingsRequest
998
1015
  include ::Google::Protobuf::MessageExts
999
1016
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -47,6 +47,14 @@ module Google
47
47
  # scan and detect four common vulnerabilities, including cross-site-scripting
48
48
  # (XSS), Flash injection, mixed content (HTTP in HTTPS), and
49
49
  # outdated or insecure libraries."
50
+ # @!attribute [rw] canonical_name
51
+ # @return [::String]
52
+ # The canonical name of the finding. It's either
53
+ # "organizations/\\{organization_id}/sources/\\{source_id}",
54
+ # "folders/\\{folder_id}/sources/\\{source_id}" or
55
+ # "projects/\\{project_number}/sources/\\{source_id}",
56
+ # depending on the closest CRM ancestor of the resource associated with the
57
+ # finding.
50
58
  class Source
51
59
  include ::Google::Protobuf::MessageExts
52
60
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -25,7 +25,7 @@ module Google
25
25
  # @return [::String]
26
26
  # The server-assigned name, which is only unique within the same service that
27
27
  # originally returns it. If you use the default HTTP mapping, the
28
- # `name` should have the format of `operations/some/unique/name`.
28
+ # `name` should be a resource name ending with `operations/{unique_id}`.
29
29
  # @!attribute [rw] metadata
30
30
  # @return [::Google::Protobuf::Any]
31
31
  # Service-specific metadata associated with the operation. It typically
@@ -35,7 +35,7 @@ module Google
35
35
  # @!attribute [rw] done
36
36
  # @return [::Boolean]
37
37
  # If the value is `false`, it means the operation is still in progress.
38
- # If true, the operation is completed, and either `error` or `response` is
38
+ # If `true`, the operation is completed, and either `error` or `response` is
39
39
  # available.
40
40
  # @!attribute [rw] error
41
41
  # @return [::Google::Rpc::Status]
@@ -67,7 +67,7 @@ module Google
67
67
  # The request message for Operations.ListOperations.
68
68
  # @!attribute [rw] name
69
69
  # @return [::String]
70
- # The name of the operation collection.
70
+ # The name of the operation's parent resource.
71
71
  # @!attribute [rw] filter
72
72
  # @return [::String]
73
73
  # The standard list filter.
@@ -112,6 +112,20 @@ module Google
112
112
  extend ::Google::Protobuf::MessageExts::ClassMethods
113
113
  end
114
114
 
115
+ # The request message for Operations.WaitOperation.
116
+ # @!attribute [rw] name
117
+ # @return [::String]
118
+ # The name of the operation resource to wait on.
119
+ # @!attribute [rw] timeout
120
+ # @return [::Google::Protobuf::Duration]
121
+ # The maximum duration to wait before timing out. If left blank, the wait
122
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
123
+ # If RPC context deadline is also specified, the shorter one will be used.
124
+ class WaitOperationRequest
125
+ include ::Google::Protobuf::MessageExts
126
+ extend ::Google::Protobuf::MessageExts::ClassMethods
127
+ end
128
+
115
129
  # A message representing the message types used by a long-running operation.
116
130
  #
117
131
  # Example:
@@ -57,10 +57,13 @@ module Google
57
57
  # Example 4: Pack and unpack a message in Go
58
58
  #
59
59
  # foo := &pb.Foo{...}
60
- # any, err := ptypes.MarshalAny(foo)
60
+ # any, err := anypb.New(foo)
61
+ # if err != nil {
62
+ # ...
63
+ # }
61
64
  # ...
62
65
  # foo := &pb.Foo{}
63
- # if err := ptypes.UnmarshalAny(any, foo); err != nil {
66
+ # if err := any.UnmarshalTo(foo); err != nil {
64
67
  # ...
65
68
  # }
66
69
  #
@@ -70,7 +70,16 @@ module Google
70
70
  # .setNanos((int) ((millis % 1000) * 1000000)).build();
71
71
  #
72
72
  #
73
- # Example 5: Compute Timestamp from current time in Python.
73
+ # Example 5: Compute Timestamp from Java `Instant.now()`.
74
+ #
75
+ # Instant now = Instant.now();
76
+ #
77
+ # Timestamp timestamp =
78
+ # Timestamp.newBuilder().setSeconds(now.getEpochSecond())
79
+ # .setNanos(now.getNano()).build();
80
+ #
81
+ #
82
+ # Example 6: Compute Timestamp from current time in Python.
74
83
  #
75
84
  # timestamp = Timestamp()
76
85
  # timestamp.GetCurrentTime()