google-cloud-asset-v1 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 146d92531ea9d255916e790bba685754e5dd33c40bda18a0bca7a5a41b65c463
4
- data.tar.gz: d6ce7170c915fb035581a909bf716dd4d16271027f6c22256149d9a4739afd2d
3
+ metadata.gz: 63c0da330fd0dfa19728ed2ee58050a99ba60976ca286563677a7ad101e1a668
4
+ data.tar.gz: 36cd8caafc0a08f097c9700253efa87e66a44a8cad80987e453612025f382982
5
5
  SHA512:
6
- metadata.gz: 5919727dae53db59a1409e5b011b7b97edf4d0af4b23cf2f7efc0b27275ef201ed7e51695630ffda06d9b0b6c27c6691dfc9503fba21fcbd261e867d139b93b2
7
- data.tar.gz: ef8c73a1dc3da98c135aa199258a2f301ab591b50dfa21b85f755eab31ff49e8d3479adb64b01e2182bc421e3871bca1d8599264238e92b5c7a5af95bb9abfb6
6
+ metadata.gz: 6f3174d274d83a8fc97dab3379fe51eb6af7198eea093050603a015b3075639c088c2f3328a2319c6e5fc39c804050ef5da256347dfc30ea3a9946d4ffb4b621
7
+ data.tar.gz: '0789307e358b75ca69195776bc7805d05c96ce9aa54af2da99c8d3b820eb3987f3b2aa60e1a8608709b675eed7723c987dd19fa1c096e8e82f7f5a6227b859ad'
@@ -75,6 +75,22 @@ module Google
75
75
  retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
76
76
  }
77
77
 
78
+ default_config.rpcs.search_all_resources.timeout = 15.0
79
+ default_config.rpcs.search_all_resources.retry_policy = {
80
+ initial_delay: 0.1,
81
+ max_delay: 60.0,
82
+ multiplier: 1.3,
83
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
84
+ }
85
+
86
+ default_config.rpcs.search_all_iam_policies.timeout = 15.0
87
+ default_config.rpcs.search_all_iam_policies.retry_policy = {
88
+ initial_delay: 0.1,
89
+ max_delay: 60.0,
90
+ multiplier: 1.3,
91
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
92
+ }
93
+
78
94
  default_config
79
95
  end
80
96
  yield @configure if block_given?
@@ -168,8 +184,9 @@ module Google
168
184
  ##
169
185
  # Exports assets with time and resource types to a given Cloud Storage
170
186
  # location. The output format is newline-delimited JSON.
171
- # This API implements the {::Google::Longrunning::Operation google.longrunning.Operation} API allowing you
172
- # to keep track of the export.
187
+ # This API implements the
188
+ # {::Google::Longrunning::Operation google.longrunning.Operation} API allowing
189
+ # you to keep track of the export.
173
190
  #
174
191
  # @overload export_assets(request, options = nil)
175
192
  # Pass arguments to `export_assets` via a request object, either of type
@@ -379,9 +396,8 @@ module Google
379
396
  # Required. This is the client-assigned asset feed identifier and it needs to
380
397
  # be unique under a specific parent project/folder/organization.
381
398
  # @param feed [::Google::Cloud::Asset::V1::Feed, ::Hash]
382
- # Required. The feed details. The field `name` must be empty and it will be generated
383
- # in the format of:
384
- # projects/project_number/feeds/feed_id
399
+ # Required. The feed details. The field `name` must be empty and it will be
400
+ # generated in the format of: projects/project_number/feeds/feed_id
385
401
  # folders/folder_number/feeds/feed_id
386
402
  # organizations/organization_number/feeds/feed_id
387
403
  #
@@ -586,8 +602,8 @@ module Google
586
602
  # the default parameter values, pass an empty Hash as a request object (see above).
587
603
  #
588
604
  # @param feed [::Google::Cloud::Asset::V1::Feed, ::Hash]
589
- # Required. The new values of feed details. It must match an existing feed and the
590
- # field `name` must be in the format of:
605
+ # Required. The new values of feed details. It must match an existing feed
606
+ # and the field `name` must be in the format of:
591
607
  # projects/project_number/feeds/feed_id or
592
608
  # folders/folder_number/feeds/feed_id or
593
609
  # organizations/organization_number/feeds/feed_id.
@@ -710,6 +726,250 @@ module Google
710
726
  raise ::Google::Cloud::Error.from_error(e)
711
727
  end
712
728
 
729
+ ##
730
+ # Searches all the resources within the given accessible scope (e.g., a
731
+ # project, a folder or an organization). Callers should have
732
+ # cloud.assets.SearchAllResources permission upon the requested scope,
733
+ # otherwise the request will be rejected.
734
+ #
735
+ # @overload search_all_resources(request, options = nil)
736
+ # Pass arguments to `search_all_resources` via a request object, either of type
737
+ # {::Google::Cloud::Asset::V1::SearchAllResourcesRequest} or an equivalent Hash.
738
+ #
739
+ # @param request [::Google::Cloud::Asset::V1::SearchAllResourcesRequest, ::Hash]
740
+ # A request object representing the call parameters. Required. To specify no
741
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
742
+ # @param options [::Gapic::CallOptions, ::Hash]
743
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
744
+ #
745
+ # @overload search_all_resources(scope: nil, query: nil, asset_types: nil, page_size: nil, page_token: nil, order_by: nil)
746
+ # Pass arguments to `search_all_resources` via keyword arguments. Note that at
747
+ # least one keyword argument is required. To specify no parameters, or to keep all
748
+ # the default parameter values, pass an empty Hash as a request object (see above).
749
+ #
750
+ # @param scope [::String]
751
+ # Required. A scope can be a project, a folder or an organization. The search
752
+ # is limited to the resources within the `scope`.
753
+ #
754
+ # The allowed values are:
755
+ #
756
+ # * projects/\\{PROJECT_ID}
757
+ # * projects/\\{PROJECT_NUMBER}
758
+ # * folders/\\{FOLDER_NUMBER}
759
+ # * organizations/\\{ORGANIZATION_NUMBER}
760
+ # @param query [::String]
761
+ # Optional. The query statement. An empty query can be specified to search
762
+ # all the resources of certain `asset_types` within the given `scope`.
763
+ #
764
+ # Examples:
765
+ #
766
+ # * `name : "Important"` to find Cloud resources whose name contains
767
+ # "Important" as a word.
768
+ # * `displayName : "Impor*"` to find Cloud resources whose display name
769
+ # contains "Impor" as a word prefix.
770
+ # * `description : "*por*"` to find Cloud resources whose description
771
+ # contains "por" as a substring.
772
+ # * `location : "us-west*"` to find Cloud resources whose location is
773
+ # prefixed with "us-west".
774
+ # * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
775
+ # a key or value.
776
+ # * `labels.env : "prod"` to find Cloud resources which have a label "env"
777
+ # and its value is "prod".
778
+ # * `labels.env : *` to find Cloud resources which have a label "env".
779
+ # * `"Important"` to find Cloud resources which contain "Important" as a word
780
+ # in any of the searchable fields.
781
+ # * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
782
+ # in any of the searchable fields.
783
+ # * `"*por*"` to find Cloud resources which contain "por" as a substring in
784
+ # any of the searchable fields.
785
+ # * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
786
+ # resources which contain "Important" as a word in any of the searchable
787
+ # fields and are also located in the "us-west1" region or the "global"
788
+ # location.
789
+ #
790
+ # See [how to construct a
791
+ # query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
792
+ # for more details.
793
+ # @param asset_types [::Array<::String>]
794
+ # Optional. A list of asset types that this request searches for. If empty,
795
+ # it will search all the [searchable asset
796
+ # types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
797
+ # @param page_size [::Integer]
798
+ # Optional. The page size for search result pagination. Page size is capped
799
+ # at 500 even if a larger value is given. If set to zero, server will pick an
800
+ # appropriate default. Returned results may be fewer than requested. When
801
+ # this happens, there could be more results as long as `next_page_token` is
802
+ # returned.
803
+ # @param page_token [::String]
804
+ # Optional. If present, then retrieve the next batch of results from the
805
+ # preceding call to this method. `page_token` must be the value of
806
+ # `next_page_token` from the previous response. The values of all other
807
+ # method parameters, must be identical to those in the previous call.
808
+ # @param order_by [::String]
809
+ # Optional. A comma separated list of fields specifying the sorting order of
810
+ # the results. The default order is ascending. Add " DESC" after the field
811
+ # name to indicate descending order. Redundant space characters are ignored.
812
+ # Example: "location DESC, name". See [supported resource metadata
813
+ # fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
814
+ # for more details.
815
+ #
816
+ # @yield [response, operation] Access the result along with the RPC operation
817
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::ResourceSearchResult>]
818
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
819
+ #
820
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::ResourceSearchResult>]
821
+ #
822
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
823
+ #
824
+ def search_all_resources request, options = nil
825
+ raise ::ArgumentError, "request must be provided" if request.nil?
826
+
827
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::SearchAllResourcesRequest
828
+
829
+ # Converts hash and nil to an options object
830
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
831
+
832
+ # Customize the options with defaults
833
+ metadata = @config.rpcs.search_all_resources.metadata.to_h
834
+
835
+ # Set x-goog-api-client and x-goog-user-project headers
836
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
837
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
838
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
839
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
840
+
841
+ header_params = {
842
+ "scope" => request.scope
843
+ }
844
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
845
+ metadata[:"x-goog-request-params"] ||= request_params_header
846
+
847
+ options.apply_defaults timeout: @config.rpcs.search_all_resources.timeout,
848
+ metadata: metadata,
849
+ retry_policy: @config.rpcs.search_all_resources.retry_policy
850
+ options.apply_defaults metadata: @config.metadata,
851
+ retry_policy: @config.retry_policy
852
+
853
+ @asset_service_stub.call_rpc :search_all_resources, request, options: options do |response, operation|
854
+ response = ::Gapic::PagedEnumerable.new @asset_service_stub, :search_all_resources, request, response, operation, options
855
+ yield response, operation if block_given?
856
+ return response
857
+ end
858
+ rescue ::GRPC::BadStatus => e
859
+ raise ::Google::Cloud::Error.from_error(e)
860
+ end
861
+
862
+ ##
863
+ # Searches all the IAM policies within the given accessible scope (e.g., a
864
+ # project, a folder or an organization). Callers should have
865
+ # cloud.assets.SearchAllIamPolicies permission upon the requested scope,
866
+ # otherwise the request will be rejected.
867
+ #
868
+ # @overload search_all_iam_policies(request, options = nil)
869
+ # Pass arguments to `search_all_iam_policies` via a request object, either of type
870
+ # {::Google::Cloud::Asset::V1::SearchAllIamPoliciesRequest} or an equivalent Hash.
871
+ #
872
+ # @param request [::Google::Cloud::Asset::V1::SearchAllIamPoliciesRequest, ::Hash]
873
+ # A request object representing the call parameters. Required. To specify no
874
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
875
+ # @param options [::Gapic::CallOptions, ::Hash]
876
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
877
+ #
878
+ # @overload search_all_iam_policies(scope: nil, query: nil, page_size: nil, page_token: nil)
879
+ # Pass arguments to `search_all_iam_policies` via keyword arguments. Note that at
880
+ # least one keyword argument is required. To specify no parameters, or to keep all
881
+ # the default parameter values, pass an empty Hash as a request object (see above).
882
+ #
883
+ # @param scope [::String]
884
+ # Required. A scope can be a project, a folder or an organization. The search
885
+ # is limited to the IAM policies within the `scope`.
886
+ #
887
+ # The allowed values are:
888
+ #
889
+ # * projects/\\{PROJECT_ID}
890
+ # * projects/\\{PROJECT_NUMBER}
891
+ # * folders/\\{FOLDER_NUMBER}
892
+ # * organizations/\\{ORGANIZATION_NUMBER}
893
+ # @param query [::String]
894
+ # Optional. The query statement. An empty query can be specified to search
895
+ # all the IAM policies within the given `scope`.
896
+ #
897
+ # Examples:
898
+ #
899
+ # * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
900
+ # specify user "amy@gmail.com".
901
+ # * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
902
+ # specify the Compute Admin role.
903
+ # * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
904
+ # policy bindings that specify a role containing "storage.buckets.update"
905
+ # permission.
906
+ # * `resource : "organizations/123"` to find Cloud IAM policy bindings that
907
+ # are set on "organizations/123".
908
+ # * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
909
+ # to find Cloud IAM policy bindings that are set on "organizations/123" or
910
+ # "folders/1234", and also specify user "amy".
911
+ #
912
+ # See [how to construct a
913
+ # query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
914
+ # for more details.
915
+ # @param page_size [::Integer]
916
+ # Optional. The page size for search result pagination. Page size is capped
917
+ # at 500 even if a larger value is given. If set to zero, server will pick an
918
+ # appropriate default. Returned results may be fewer than requested. When
919
+ # this happens, there could be more results as long as `next_page_token` is
920
+ # returned.
921
+ # @param page_token [::String]
922
+ # Optional. If present, retrieve the next batch of results from the preceding
923
+ # call to this method. `page_token` must be the value of `next_page_token`
924
+ # from the previous response. The values of all other method parameters must
925
+ # be identical to those in the previous call.
926
+ #
927
+ # @yield [response, operation] Access the result along with the RPC operation
928
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::IamPolicySearchResult>]
929
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
930
+ #
931
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::IamPolicySearchResult>]
932
+ #
933
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
934
+ #
935
+ def search_all_iam_policies request, options = nil
936
+ raise ::ArgumentError, "request must be provided" if request.nil?
937
+
938
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::SearchAllIamPoliciesRequest
939
+
940
+ # Converts hash and nil to an options object
941
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
942
+
943
+ # Customize the options with defaults
944
+ metadata = @config.rpcs.search_all_iam_policies.metadata.to_h
945
+
946
+ # Set x-goog-api-client and x-goog-user-project headers
947
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
948
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
949
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
950
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
951
+
952
+ header_params = {
953
+ "scope" => request.scope
954
+ }
955
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
956
+ metadata[:"x-goog-request-params"] ||= request_params_header
957
+
958
+ options.apply_defaults timeout: @config.rpcs.search_all_iam_policies.timeout,
959
+ metadata: metadata,
960
+ retry_policy: @config.rpcs.search_all_iam_policies.retry_policy
961
+ options.apply_defaults metadata: @config.metadata,
962
+ retry_policy: @config.retry_policy
963
+
964
+ @asset_service_stub.call_rpc :search_all_iam_policies, request, options: options do |response, operation|
965
+ response = ::Gapic::PagedEnumerable.new @asset_service_stub, :search_all_iam_policies, request, response, operation, options
966
+ yield response, operation if block_given?
967
+ return response
968
+ end
969
+ rescue ::GRPC::BadStatus => e
970
+ raise ::Google::Cloud::Error.from_error(e)
971
+ end
972
+
713
973
  ##
714
974
  # Configuration class for the AssetService API.
715
975
  #
@@ -877,6 +1137,16 @@ module Google
877
1137
  # @return [::Gapic::Config::Method]
878
1138
  #
879
1139
  attr_reader :delete_feed
1140
+ ##
1141
+ # RPC-specific configuration for `search_all_resources`
1142
+ # @return [::Gapic::Config::Method]
1143
+ #
1144
+ attr_reader :search_all_resources
1145
+ ##
1146
+ # RPC-specific configuration for `search_all_iam_policies`
1147
+ # @return [::Gapic::Config::Method]
1148
+ #
1149
+ attr_reader :search_all_iam_policies
880
1150
 
881
1151
  # @private
882
1152
  def initialize parent_rpcs = nil
@@ -894,6 +1164,10 @@ module Google
894
1164
  @update_feed = ::Gapic::Config::Method.new update_feed_config
895
1165
  delete_feed_config = parent_rpcs&.delete_feed if parent_rpcs&.respond_to? :delete_feed
896
1166
  @delete_feed = ::Gapic::Config::Method.new delete_feed_config
1167
+ search_all_resources_config = parent_rpcs&.search_all_resources if parent_rpcs&.respond_to? :search_all_resources
1168
+ @search_all_resources = ::Gapic::Config::Method.new search_all_resources_config
1169
+ search_all_iam_policies_config = parent_rpcs&.search_all_iam_policies if parent_rpcs&.respond_to? :search_all_iam_policies
1170
+ @search_all_iam_policies = ::Gapic::Config::Method.new search_all_iam_policies_config
897
1171
 
898
1172
  yield self if block_given?
899
1173
  end
@@ -88,6 +88,28 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
88
88
  optional :content_type, :enum, 4, "google.cloud.asset.v1.ContentType"
89
89
  optional :feed_output_config, :message, 5, "google.cloud.asset.v1.FeedOutputConfig"
90
90
  end
91
+ add_message "google.cloud.asset.v1.SearchAllResourcesRequest" do
92
+ optional :scope, :string, 1
93
+ optional :query, :string, 2
94
+ repeated :asset_types, :string, 3
95
+ optional :page_size, :int32, 4
96
+ optional :page_token, :string, 5
97
+ optional :order_by, :string, 6
98
+ end
99
+ add_message "google.cloud.asset.v1.SearchAllResourcesResponse" do
100
+ repeated :results, :message, 1, "google.cloud.asset.v1.ResourceSearchResult"
101
+ optional :next_page_token, :string, 2
102
+ end
103
+ add_message "google.cloud.asset.v1.SearchAllIamPoliciesRequest" do
104
+ optional :scope, :string, 1
105
+ optional :query, :string, 2
106
+ optional :page_size, :int32, 3
107
+ optional :page_token, :string, 4
108
+ end
109
+ add_message "google.cloud.asset.v1.SearchAllIamPoliciesResponse" do
110
+ repeated :results, :message, 1, "google.cloud.asset.v1.IamPolicySearchResult"
111
+ optional :next_page_token, :string, 2
112
+ end
91
113
  add_enum "google.cloud.asset.v1.ContentType" do
92
114
  value :CONTENT_TYPE_UNSPECIFIED, 0
93
115
  value :RESOURCE, 1
@@ -118,6 +140,10 @@ module Google
118
140
  PubsubDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.PubsubDestination").msgclass
119
141
  FeedOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.FeedOutputConfig").msgclass
120
142
  Feed = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.Feed").msgclass
143
+ SearchAllResourcesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.SearchAllResourcesRequest").msgclass
144
+ SearchAllResourcesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.SearchAllResourcesResponse").msgclass
145
+ SearchAllIamPoliciesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.SearchAllIamPoliciesRequest").msgclass
146
+ SearchAllIamPoliciesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.SearchAllIamPoliciesResponse").msgclass
121
147
  ContentType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.ContentType").enummodule
122
148
  end
123
149
  end
@@ -35,8 +35,9 @@ module Google
35
35
 
36
36
  # Exports assets with time and resource types to a given Cloud Storage
37
37
  # location. The output format is newline-delimited JSON.
38
- # This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
39
- # to keep track of the export.
38
+ # This API implements the
39
+ # [google.longrunning.Operation][google.longrunning.Operation] API allowing
40
+ # you to keep track of the export.
40
41
  rpc :ExportAssets, ExportAssetsRequest, Google::Longrunning::Operation
41
42
  # Batch gets the update history of assets that overlap a time window.
42
43
  # For RESOURCE content, this API outputs history with asset in both
@@ -57,6 +58,16 @@ module Google
57
58
  rpc :UpdateFeed, UpdateFeedRequest, Feed
58
59
  # Deletes an asset feed.
59
60
  rpc :DeleteFeed, DeleteFeedRequest, Google::Protobuf::Empty
61
+ # Searches all the resources within the given accessible scope (e.g., a
62
+ # project, a folder or an organization). Callers should have
63
+ # cloud.assets.SearchAllResources permission upon the requested scope,
64
+ # otherwise the request will be rejected.
65
+ rpc :SearchAllResources, SearchAllResourcesRequest, SearchAllResourcesResponse
66
+ # Searches all the IAM policies within the given accessible scope (e.g., a
67
+ # project, a folder or an organization). Callers should have
68
+ # cloud.assets.SearchAllIamPolicies permission upon the requested scope,
69
+ # otherwise the request will be rejected.
70
+ rpc :SearchAllIamPolicies, SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse
60
71
  end
61
72
 
62
73
  Stub = Service.rpc_stub_class
@@ -3,6 +3,7 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
+ require 'google/api/annotations_pb'
6
7
  require 'google/api/resource_pb'
7
8
  require 'google/cloud/orgpolicy/v1/orgpolicy_pb'
8
9
  require 'google/iam/v1/policy_pb'
@@ -12,7 +13,6 @@ require 'google/identity/accesscontextmanager/v1/service_perimeter_pb'
12
13
  require 'google/protobuf/any_pb'
13
14
  require 'google/protobuf/struct_pb'
14
15
  require 'google/protobuf/timestamp_pb'
15
- require 'google/api/annotations_pb'
16
16
  Google::Protobuf::DescriptorPool.generated_pool.build do
17
17
  add_file("google/cloud/asset/v1/assets.proto", :syntax => :proto3) do
18
18
  add_message "google.cloud.asset.v1.TemporalAsset" do
@@ -44,6 +44,30 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
44
44
  optional :resource_url, :string, 4
45
45
  optional :parent, :string, 5
46
46
  optional :data, :message, 6, "google.protobuf.Struct"
47
+ optional :location, :string, 8
48
+ end
49
+ add_message "google.cloud.asset.v1.ResourceSearchResult" do
50
+ optional :name, :string, 1
51
+ optional :asset_type, :string, 2
52
+ optional :project, :string, 3
53
+ optional :display_name, :string, 4
54
+ optional :description, :string, 5
55
+ optional :location, :string, 6
56
+ map :labels, :string, :string, 7
57
+ repeated :network_tags, :string, 8
58
+ optional :additional_attributes, :message, 9, "google.protobuf.Struct"
59
+ end
60
+ add_message "google.cloud.asset.v1.IamPolicySearchResult" do
61
+ optional :resource, :string, 1
62
+ optional :project, :string, 2
63
+ optional :policy, :message, 3, "google.iam.v1.Policy"
64
+ optional :explanation, :message, 4, "google.cloud.asset.v1.IamPolicySearchResult.Explanation"
65
+ end
66
+ add_message "google.cloud.asset.v1.IamPolicySearchResult.Explanation" do
67
+ map :matched_permissions, :string, :message, 1, "google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions"
68
+ end
69
+ add_message "google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions" do
70
+ repeated :permissions, :string, 1
47
71
  end
48
72
  end
49
73
  end
@@ -56,6 +80,10 @@ module Google
56
80
  TimeWindow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.TimeWindow").msgclass
57
81
  Asset = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.Asset").msgclass
58
82
  Resource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.Resource").msgclass
83
+ ResourceSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.ResourceSearchResult").msgclass
84
+ IamPolicySearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.IamPolicySearchResult").msgclass
85
+ IamPolicySearchResult::Explanation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.IamPolicySearchResult.Explanation").msgclass
86
+ IamPolicySearchResult::Explanation::Permissions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions").msgclass
59
87
  end
60
88
  end
61
89
  end
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Asset
23
23
  module V1
24
- VERSION = "0.2.3"
24
+ VERSION = "0.3.0"
25
25
  end
26
26
  end
27
27
  end
@@ -56,8 +56,10 @@ module Google
56
56
  end
57
57
 
58
58
  # The export asset response. This message is returned by the
59
- # google.longrunning.Operations.GetOperation method in the returned
60
- # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} field.
59
+ # google.longrunning.Operations.GetOperation
60
+ # method in the returned
61
+ # {::Google::Longrunning::Operation#response google.longrunning.Operation.response}
62
+ # field.
61
63
  # @!attribute [rw] read_time
62
64
  # @return [::Google::Protobuf::Timestamp]
63
65
  # Time the snapshot was taken.
@@ -127,9 +129,8 @@ module Google
127
129
  # be unique under a specific parent project/folder/organization.
128
130
  # @!attribute [rw] feed
129
131
  # @return [::Google::Cloud::Asset::V1::Feed]
130
- # Required. The feed details. The field `name` must be empty and it will be generated
131
- # in the format of:
132
- # projects/project_number/feeds/feed_id
132
+ # Required. The feed details. The field `name` must be empty and it will be
133
+ # generated in the format of: projects/project_number/feeds/feed_id
133
134
  # folders/folder_number/feeds/feed_id
134
135
  # organizations/organization_number/feeds/feed_id
135
136
  class CreateFeedRequest
@@ -171,8 +172,8 @@ module Google
171
172
  # Update asset feed request.
172
173
  # @!attribute [rw] feed
173
174
  # @return [::Google::Cloud::Asset::V1::Feed]
174
- # Required. The new values of feed details. It must match an existing feed and the
175
- # field `name` must be in the format of:
175
+ # Required. The new values of feed details. It must match an existing feed
176
+ # and the field `name` must be in the format of:
176
177
  # projects/project_number/feeds/feed_id or
177
178
  # folders/folder_number/feeds/feed_id or
178
179
  # organizations/organization_number/feeds/feed_id.
@@ -325,6 +326,166 @@ module Google
325
326
  extend ::Google::Protobuf::MessageExts::ClassMethods
326
327
  end
327
328
 
329
+ # Search all resources request.
330
+ # @!attribute [rw] scope
331
+ # @return [::String]
332
+ # Required. A scope can be a project, a folder or an organization. The search
333
+ # is limited to the resources within the `scope`.
334
+ #
335
+ # The allowed values are:
336
+ #
337
+ # * projects/\\{PROJECT_ID}
338
+ # * projects/\\{PROJECT_NUMBER}
339
+ # * folders/\\{FOLDER_NUMBER}
340
+ # * organizations/\\{ORGANIZATION_NUMBER}
341
+ # @!attribute [rw] query
342
+ # @return [::String]
343
+ # Optional. The query statement. An empty query can be specified to search
344
+ # all the resources of certain `asset_types` within the given `scope`.
345
+ #
346
+ # Examples:
347
+ #
348
+ # * `name : "Important"` to find Cloud resources whose name contains
349
+ # "Important" as a word.
350
+ # * `displayName : "Impor*"` to find Cloud resources whose display name
351
+ # contains "Impor" as a word prefix.
352
+ # * `description : "*por*"` to find Cloud resources whose description
353
+ # contains "por" as a substring.
354
+ # * `location : "us-west*"` to find Cloud resources whose location is
355
+ # prefixed with "us-west".
356
+ # * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
357
+ # a key or value.
358
+ # * `labels.env : "prod"` to find Cloud resources which have a label "env"
359
+ # and its value is "prod".
360
+ # * `labels.env : *` to find Cloud resources which have a label "env".
361
+ # * `"Important"` to find Cloud resources which contain "Important" as a word
362
+ # in any of the searchable fields.
363
+ # * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
364
+ # in any of the searchable fields.
365
+ # * `"*por*"` to find Cloud resources which contain "por" as a substring in
366
+ # any of the searchable fields.
367
+ # * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
368
+ # resources which contain "Important" as a word in any of the searchable
369
+ # fields and are also located in the "us-west1" region or the "global"
370
+ # location.
371
+ #
372
+ # See [how to construct a
373
+ # query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
374
+ # for more details.
375
+ # @!attribute [rw] asset_types
376
+ # @return [::Array<::String>]
377
+ # Optional. A list of asset types that this request searches for. If empty,
378
+ # it will search all the [searchable asset
379
+ # types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
380
+ # @!attribute [rw] page_size
381
+ # @return [::Integer]
382
+ # Optional. The page size for search result pagination. Page size is capped
383
+ # at 500 even if a larger value is given. If set to zero, server will pick an
384
+ # appropriate default. Returned results may be fewer than requested. When
385
+ # this happens, there could be more results as long as `next_page_token` is
386
+ # returned.
387
+ # @!attribute [rw] page_token
388
+ # @return [::String]
389
+ # Optional. If present, then retrieve the next batch of results from the
390
+ # preceding call to this method. `page_token` must be the value of
391
+ # `next_page_token` from the previous response. The values of all other
392
+ # method parameters, must be identical to those in the previous call.
393
+ # @!attribute [rw] order_by
394
+ # @return [::String]
395
+ # Optional. A comma separated list of fields specifying the sorting order of
396
+ # the results. The default order is ascending. Add " DESC" after the field
397
+ # name to indicate descending order. Redundant space characters are ignored.
398
+ # Example: "location DESC, name". See [supported resource metadata
399
+ # fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
400
+ # for more details.
401
+ class SearchAllResourcesRequest
402
+ include ::Google::Protobuf::MessageExts
403
+ extend ::Google::Protobuf::MessageExts::ClassMethods
404
+ end
405
+
406
+ # Search all resources response.
407
+ # @!attribute [rw] results
408
+ # @return [::Array<::Google::Cloud::Asset::V1::ResourceSearchResult>]
409
+ # A list of Resources that match the search query. It contains the resource
410
+ # standard metadata information.
411
+ # @!attribute [rw] next_page_token
412
+ # @return [::String]
413
+ # If there are more results than those appearing in this response, then
414
+ # `next_page_token` is included. To get the next set of results, call this
415
+ # method again using the value of `next_page_token` as `page_token`.
416
+ class SearchAllResourcesResponse
417
+ include ::Google::Protobuf::MessageExts
418
+ extend ::Google::Protobuf::MessageExts::ClassMethods
419
+ end
420
+
421
+ # Search all IAM policies request.
422
+ # @!attribute [rw] scope
423
+ # @return [::String]
424
+ # Required. A scope can be a project, a folder or an organization. The search
425
+ # is limited to the IAM policies within the `scope`.
426
+ #
427
+ # The allowed values are:
428
+ #
429
+ # * projects/\\{PROJECT_ID}
430
+ # * projects/\\{PROJECT_NUMBER}
431
+ # * folders/\\{FOLDER_NUMBER}
432
+ # * organizations/\\{ORGANIZATION_NUMBER}
433
+ # @!attribute [rw] query
434
+ # @return [::String]
435
+ # Optional. The query statement. An empty query can be specified to search
436
+ # all the IAM policies within the given `scope`.
437
+ #
438
+ # Examples:
439
+ #
440
+ # * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
441
+ # specify user "amy@gmail.com".
442
+ # * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
443
+ # specify the Compute Admin role.
444
+ # * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
445
+ # policy bindings that specify a role containing "storage.buckets.update"
446
+ # permission.
447
+ # * `resource : "organizations/123"` to find Cloud IAM policy bindings that
448
+ # are set on "organizations/123".
449
+ # * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
450
+ # to find Cloud IAM policy bindings that are set on "organizations/123" or
451
+ # "folders/1234", and also specify user "amy".
452
+ #
453
+ # See [how to construct a
454
+ # query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
455
+ # for more details.
456
+ # @!attribute [rw] page_size
457
+ # @return [::Integer]
458
+ # Optional. The page size for search result pagination. Page size is capped
459
+ # at 500 even if a larger value is given. If set to zero, server will pick an
460
+ # appropriate default. Returned results may be fewer than requested. When
461
+ # this happens, there could be more results as long as `next_page_token` is
462
+ # returned.
463
+ # @!attribute [rw] page_token
464
+ # @return [::String]
465
+ # Optional. If present, retrieve the next batch of results from the preceding
466
+ # call to this method. `page_token` must be the value of `next_page_token`
467
+ # from the previous response. The values of all other method parameters must
468
+ # be identical to those in the previous call.
469
+ class SearchAllIamPoliciesRequest
470
+ include ::Google::Protobuf::MessageExts
471
+ extend ::Google::Protobuf::MessageExts::ClassMethods
472
+ end
473
+
474
+ # Search all IAM policies response.
475
+ # @!attribute [rw] results
476
+ # @return [::Array<::Google::Cloud::Asset::V1::IamPolicySearchResult>]
477
+ # A list of IamPolicy that match the search query. Related information such
478
+ # as the associated resource is returned along with the policy.
479
+ # @!attribute [rw] next_page_token
480
+ # @return [::String]
481
+ # Set if there are more results than those appearing in this response; to get
482
+ # the next set of results, call this method again, using this value as the
483
+ # `page_token`.
484
+ class SearchAllIamPoliciesResponse
485
+ include ::Google::Protobuf::MessageExts
486
+ extend ::Google::Protobuf::MessageExts::ClassMethods
487
+ end
488
+
328
489
  # Asset content type.
329
490
  module ContentType
330
491
  # Unspecified content type.
@@ -155,10 +155,199 @@ module Google
155
155
  # @return [::Google::Protobuf::Struct]
156
156
  # The content of the resource, in which some sensitive fields are removed
157
157
  # and may not be present.
158
+ # @!attribute [rw] location
159
+ # @return [::String]
160
+ # The location of the resource in Google Cloud, such as its zone and region.
161
+ # For more information, see https://cloud.google.com/about/locations/.
158
162
  class Resource
159
163
  include ::Google::Protobuf::MessageExts
160
164
  extend ::Google::Protobuf::MessageExts::ClassMethods
161
165
  end
166
+
167
+ # A result of Resource Search, containing information of a cloud resoure.
168
+ # @!attribute [rw] name
169
+ # @return [::String]
170
+ # The full resource name of this resource. Example:
171
+ # "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
172
+ # See [Cloud Asset Inventory Resource Name
173
+ # Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
174
+ # for more information.
175
+ #
176
+ # To search against the `name`:
177
+ #
178
+ # * use a field query. Example: `name : "instance1"`
179
+ # * use a free text query. Example: `"instance1"`
180
+ # @!attribute [rw] asset_type
181
+ # @return [::String]
182
+ # The type of this resource. Example: "compute.googleapis.com/Disk".
183
+ #
184
+ # To search against the `asset_type`:
185
+ #
186
+ # * specify the `asset_type` field in your search request.
187
+ # @!attribute [rw] project
188
+ # @return [::String]
189
+ # The project that this resource belongs to, in the form of
190
+ # projects/\\{PROJECT_NUMBER}.
191
+ #
192
+ # To search against the `project`:
193
+ #
194
+ # * specify the `scope` field as this project in your search request.
195
+ # @!attribute [rw] display_name
196
+ # @return [::String]
197
+ # The display name of this resource.
198
+ #
199
+ # To search against the `display_name`:
200
+ #
201
+ # * use a field query. Example: `displayName : "My Instance"`
202
+ # * use a free text query. Example: `"My Instance"`
203
+ # @!attribute [rw] description
204
+ # @return [::String]
205
+ # One or more paragraphs of text description of this resource. Maximum length
206
+ # could be up to 1M bytes.
207
+ #
208
+ # To search against the `description`:
209
+ #
210
+ # * use a field query. Example: `description : "*important instance*"`
211
+ # * use a free text query. Example: `"*important instance*"`
212
+ # @!attribute [rw] location
213
+ # @return [::String]
214
+ # Location can be "global", regional like "us-east1", or zonal like
215
+ # "us-west1-b".
216
+ #
217
+ # To search against the `location`:
218
+ #
219
+ # * use a field query. Example: `location : "us-west*"`
220
+ # * use a free text query. Example: `"us-west*"`
221
+ # @!attribute [rw] labels
222
+ # @return [::Google::Protobuf::Map{::String => ::String}]
223
+ # Labels associated with this resource. See [Labelling and grouping GCP
224
+ # resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
225
+ # for more information.
226
+ #
227
+ # To search against the `labels`:
228
+ #
229
+ # * use a field query, as following:
230
+ # - query on any label's key or value. Example: `labels : "prod"`
231
+ # - query by a given label. Example: `labels.env : "prod"`
232
+ # - query by a given label'sexistence. Example: `labels.env : *`
233
+ # * use a free text query. Example: `"prod"`
234
+ # @!attribute [rw] network_tags
235
+ # @return [::Array<::String>]
236
+ # Network tags associated with this resource. Like labels, network tags are a
237
+ # type of annotations used to group GCP resources. See [Labelling GCP
238
+ # resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
239
+ # for more information.
240
+ #
241
+ # To search against the `network_tags`:
242
+ #
243
+ # * use a field query. Example: `networkTags : "internal"`
244
+ # * use a free text query. Example: `"internal"`
245
+ # @!attribute [rw] additional_attributes
246
+ # @return [::Google::Protobuf::Struct]
247
+ # The additional attributes of this resource. The attributes may vary from
248
+ # one resource type to another. Examples: "projectId" for Project,
249
+ # "dnsName" for DNS ManagedZone.
250
+ #
251
+ # To search against the `additional_attributes`:
252
+ #
253
+ # * use a free text query to match the attributes values. Example: to search
254
+ # additional_attributes = { dnsName: "foobar" }, you can issue a query
255
+ # `"foobar"`.
256
+ class ResourceSearchResult
257
+ include ::Google::Protobuf::MessageExts
258
+ extend ::Google::Protobuf::MessageExts::ClassMethods
259
+
260
+ # @!attribute [rw] key
261
+ # @return [::String]
262
+ # @!attribute [rw] value
263
+ # @return [::String]
264
+ class LabelsEntry
265
+ include ::Google::Protobuf::MessageExts
266
+ extend ::Google::Protobuf::MessageExts::ClassMethods
267
+ end
268
+ end
269
+
270
+ # A result of IAM Policy search, containing information of an IAM policy.
271
+ # @!attribute [rw] resource
272
+ # @return [::String]
273
+ # The full resource name of the resource associated with this IAM policy.
274
+ # Example:
275
+ # "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
276
+ # See [Cloud Asset Inventory Resource Name
277
+ # Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
278
+ # for more information.
279
+ #
280
+ # To search against the `resource`:
281
+ #
282
+ # * use a field query. Example: `resource : "organizations/123"`
283
+ # @!attribute [rw] project
284
+ # @return [::String]
285
+ # The project that the associated GCP resource belongs to, in the form of
286
+ # projects/\\{PROJECT_NUMBER}. If an IAM policy is set on a resource (like VM
287
+ # instance, Cloud Storage bucket), the project field will indicate the
288
+ # project that contains the resource. If an IAM policy is set on a folder or
289
+ # orgnization, the project field will be empty.
290
+ #
291
+ # To search against the `project`:
292
+ #
293
+ # * specify the `scope` field as this project in your search request.
294
+ # @!attribute [rw] policy
295
+ # @return [::Google::Iam::V1::Policy]
296
+ # The IAM policy directly set on the given resource. Note that the original
297
+ # IAM policy can contain multiple bindings. This only contains the bindings
298
+ # that match the given query. For queries that don't contain a constrain on
299
+ # policies (e.g., an empty query), this contains all the bindings.
300
+ #
301
+ # To search against the `policy` bindings:
302
+ #
303
+ # * use a field query, as following:
304
+ # - query by the policy contained members. Example:
305
+ # `policy : "amy@gmail.com"`
306
+ # - query by the policy contained roles. Example:
307
+ # `policy : "roles/compute.admin"`
308
+ # - query by the policy contained roles' implied permissions. Example:
309
+ # `policy.role.permissions : "compute.instances.create"`
310
+ # @!attribute [rw] explanation
311
+ # @return [::Google::Cloud::Asset::V1::IamPolicySearchResult::Explanation]
312
+ # Explanation about the IAM policy search result. It contains additional
313
+ # information to explain why the search result matches the query.
314
+ class IamPolicySearchResult
315
+ include ::Google::Protobuf::MessageExts
316
+ extend ::Google::Protobuf::MessageExts::ClassMethods
317
+
318
+ # Explanation about the IAM policy search result.
319
+ # @!attribute [rw] matched_permissions
320
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Asset::V1::IamPolicySearchResult::Explanation::Permissions}]
321
+ # The map from roles to their included permissions that match the
322
+ # permission query (i.e., a query containing `policy.role.permissions:`).
323
+ # Example: if query `policy.role.permissions : "compute.disk.get"`
324
+ # matches a policy binding that contains owner role, the
325
+ # matched_permissions will be \\{"roles/owner": ["compute.disk.get"]}. The
326
+ # roles can also be found in the returned `policy` bindings. Note that the
327
+ # map is populated only for requests with permission queries.
328
+ class Explanation
329
+ include ::Google::Protobuf::MessageExts
330
+ extend ::Google::Protobuf::MessageExts::ClassMethods
331
+
332
+ # IAM permissions
333
+ # @!attribute [rw] permissions
334
+ # @return [::Array<::String>]
335
+ # A list of permissions. A sample permission string: "compute.disk.get".
336
+ class Permissions
337
+ include ::Google::Protobuf::MessageExts
338
+ extend ::Google::Protobuf::MessageExts::ClassMethods
339
+ end
340
+
341
+ # @!attribute [rw] key
342
+ # @return [::String]
343
+ # @!attribute [rw] value
344
+ # @return [::Google::Cloud::Asset::V1::IamPolicySearchResult::Explanation::Permissions]
345
+ class MatchedPermissionsEntry
346
+ include ::Google::Protobuf::MessageExts
347
+ extend ::Google::Protobuf::MessageExts::ClassMethods
348
+ end
349
+ end
350
+ end
162
351
  end
163
352
  end
164
353
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-asset-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-05 00:00:00.000000000 Z
11
+ date: 2020-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common