google-cloud-cloud_controls_partner-v1beta 0.2.0 → 0.4.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.
@@ -185,8 +185,28 @@ module Google
185
185
  endpoint: @config.endpoint,
186
186
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
187
187
  universe_domain: @config.universe_domain,
188
- credentials: credentials
188
+ credentials: credentials,
189
+ logger: @config.logger
189
190
  )
191
+
192
+ @cloud_controls_partner_core_stub.logger(stub: true)&.info do |entry|
193
+ entry.set_system_name
194
+ entry.set_service
195
+ entry.message = "Created client for #{entry.service}"
196
+ entry.set_credentials_fields credentials
197
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
198
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
199
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
200
+ end
201
+ end
202
+
203
+ ##
204
+ # The logger used for request/response debug logging.
205
+ #
206
+ # @return [Logger]
207
+ #
208
+ def logger
209
+ @cloud_controls_partner_core_stub.logger
190
210
  end
191
211
 
192
212
  # Service calls
@@ -265,7 +285,6 @@ module Google
265
285
 
266
286
  @cloud_controls_partner_core_stub.get_workload request, options do |result, operation|
267
287
  yield result, operation if block_given?
268
- return result
269
288
  end
270
289
  rescue ::Gapic::Rest::Error => e
271
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -360,7 +379,6 @@ module Google
360
379
 
361
380
  @cloud_controls_partner_core_stub.list_workloads request, options do |result, operation|
362
381
  yield result, operation if block_given?
363
- return result
364
382
  end
365
383
  rescue ::Gapic::Rest::Error => e
366
384
  raise ::Google::Cloud::Error.from_error(e)
@@ -440,7 +458,6 @@ module Google
440
458
 
441
459
  @cloud_controls_partner_core_stub.get_customer request, options do |result, operation|
442
460
  yield result, operation if block_given?
443
- return result
444
461
  end
445
462
  rescue ::Gapic::Rest::Error => e
446
463
  raise ::Google::Cloud::Error.from_error(e)
@@ -534,7 +551,6 @@ module Google
534
551
 
535
552
  @cloud_controls_partner_core_stub.list_customers request, options do |result, operation|
536
553
  yield result, operation if block_given?
537
- return result
538
554
  end
539
555
  rescue ::Gapic::Rest::Error => e
540
556
  raise ::Google::Cloud::Error.from_error(e)
@@ -614,7 +630,6 @@ module Google
614
630
 
615
631
  @cloud_controls_partner_core_stub.get_ekm_connections request, options do |result, operation|
616
632
  yield result, operation if block_given?
617
- return result
618
633
  end
619
634
  rescue ::Gapic::Rest::Error => e
620
635
  raise ::Google::Cloud::Error.from_error(e)
@@ -694,7 +709,6 @@ module Google
694
709
 
695
710
  @cloud_controls_partner_core_stub.get_partner_permissions request, options do |result, operation|
696
711
  yield result, operation if block_given?
697
- return result
698
712
  end
699
713
  rescue ::Gapic::Rest::Error => e
700
714
  raise ::Google::Cloud::Error.from_error(e)
@@ -792,7 +806,6 @@ module Google
792
806
 
793
807
  @cloud_controls_partner_core_stub.list_access_approval_requests request, options do |result, operation|
794
808
  yield result, operation if block_given?
795
- return result
796
809
  end
797
810
  rescue ::Gapic::Rest::Error => e
798
811
  raise ::Google::Cloud::Error.from_error(e)
@@ -872,7 +885,252 @@ module Google
872
885
 
873
886
  @cloud_controls_partner_core_stub.get_partner request, options do |result, operation|
874
887
  yield result, operation if block_given?
875
- return result
888
+ end
889
+ rescue ::Gapic::Rest::Error => e
890
+ raise ::Google::Cloud::Error.from_error(e)
891
+ end
892
+
893
+ ##
894
+ # Creates a new customer.
895
+ #
896
+ # @overload create_customer(request, options = nil)
897
+ # Pass arguments to `create_customer` via a request object, either of type
898
+ # {::Google::Cloud::CloudControlsPartner::V1beta::CreateCustomerRequest} or an equivalent Hash.
899
+ #
900
+ # @param request [::Google::Cloud::CloudControlsPartner::V1beta::CreateCustomerRequest, ::Hash]
901
+ # A request object representing the call parameters. Required. To specify no
902
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
903
+ # @param options [::Gapic::CallOptions, ::Hash]
904
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
905
+ #
906
+ # @overload create_customer(parent: nil, customer: nil, customer_id: nil)
907
+ # Pass arguments to `create_customer` via keyword arguments. Note that at
908
+ # least one keyword argument is required. To specify no parameters, or to keep all
909
+ # the default parameter values, pass an empty Hash as a request object (see above).
910
+ #
911
+ # @param parent [::String]
912
+ # Required. Parent resource
913
+ # Format: `organizations/{organization}/locations/{location}`
914
+ # @param customer [::Google::Cloud::CloudControlsPartner::V1beta::Customer, ::Hash]
915
+ # Required. The customer to create.
916
+ # @param customer_id [::String]
917
+ # Required. The customer id to use for the customer, which will become the
918
+ # final component of the customer's resource name. The specified value must
919
+ # be a valid Google cloud organization id.
920
+ # @yield [result, operation] Access the result along with the TransportOperation object
921
+ # @yieldparam result [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
922
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
923
+ #
924
+ # @return [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
925
+ #
926
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
927
+ #
928
+ # @example Basic example
929
+ # require "google/cloud/cloud_controls_partner/v1beta"
930
+ #
931
+ # # Create a client object. The client can be reused for multiple calls.
932
+ # client = Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerCore::Rest::Client.new
933
+ #
934
+ # # Create a request. To set request fields, pass in keyword arguments.
935
+ # request = Google::Cloud::CloudControlsPartner::V1beta::CreateCustomerRequest.new
936
+ #
937
+ # # Call the create_customer method.
938
+ # result = client.create_customer request
939
+ #
940
+ # # The returned object is of type Google::Cloud::CloudControlsPartner::V1beta::Customer.
941
+ # p result
942
+ #
943
+ def create_customer request, options = nil
944
+ raise ::ArgumentError, "request must be provided" if request.nil?
945
+
946
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1beta::CreateCustomerRequest
947
+
948
+ # Converts hash and nil to an options object
949
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
950
+
951
+ # Customize the options with defaults
952
+ call_metadata = @config.rpcs.create_customer.metadata.to_h
953
+
954
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
955
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
956
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
957
+ gapic_version: ::Google::Cloud::CloudControlsPartner::V1beta::VERSION,
958
+ transports_version_send: [:rest]
959
+
960
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
961
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
962
+
963
+ options.apply_defaults timeout: @config.rpcs.create_customer.timeout,
964
+ metadata: call_metadata,
965
+ retry_policy: @config.rpcs.create_customer.retry_policy
966
+
967
+ options.apply_defaults timeout: @config.timeout,
968
+ metadata: @config.metadata,
969
+ retry_policy: @config.retry_policy
970
+
971
+ @cloud_controls_partner_core_stub.create_customer request, options do |result, operation|
972
+ yield result, operation if block_given?
973
+ end
974
+ rescue ::Gapic::Rest::Error => e
975
+ raise ::Google::Cloud::Error.from_error(e)
976
+ end
977
+
978
+ ##
979
+ # Update details of a single customer
980
+ #
981
+ # @overload update_customer(request, options = nil)
982
+ # Pass arguments to `update_customer` via a request object, either of type
983
+ # {::Google::Cloud::CloudControlsPartner::V1beta::UpdateCustomerRequest} or an equivalent Hash.
984
+ #
985
+ # @param request [::Google::Cloud::CloudControlsPartner::V1beta::UpdateCustomerRequest, ::Hash]
986
+ # A request object representing the call parameters. Required. To specify no
987
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
988
+ # @param options [::Gapic::CallOptions, ::Hash]
989
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
990
+ #
991
+ # @overload update_customer(customer: nil, update_mask: nil)
992
+ # Pass arguments to `update_customer` via keyword arguments. Note that at
993
+ # least one keyword argument is required. To specify no parameters, or to keep all
994
+ # the default parameter values, pass an empty Hash as a request object (see above).
995
+ #
996
+ # @param customer [::Google::Cloud::CloudControlsPartner::V1beta::Customer, ::Hash]
997
+ # Required. The customer to update
998
+ # Format:
999
+ # `organizations/{organization}/locations/{location}/customers/{customer}`
1000
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1001
+ # Optional. The list of fields to update
1002
+ # @yield [result, operation] Access the result along with the TransportOperation object
1003
+ # @yieldparam result [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
1004
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1005
+ #
1006
+ # @return [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
1007
+ #
1008
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1009
+ #
1010
+ # @example Basic example
1011
+ # require "google/cloud/cloud_controls_partner/v1beta"
1012
+ #
1013
+ # # Create a client object. The client can be reused for multiple calls.
1014
+ # client = Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerCore::Rest::Client.new
1015
+ #
1016
+ # # Create a request. To set request fields, pass in keyword arguments.
1017
+ # request = Google::Cloud::CloudControlsPartner::V1beta::UpdateCustomerRequest.new
1018
+ #
1019
+ # # Call the update_customer method.
1020
+ # result = client.update_customer request
1021
+ #
1022
+ # # The returned object is of type Google::Cloud::CloudControlsPartner::V1beta::Customer.
1023
+ # p result
1024
+ #
1025
+ def update_customer request, options = nil
1026
+ raise ::ArgumentError, "request must be provided" if request.nil?
1027
+
1028
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1beta::UpdateCustomerRequest
1029
+
1030
+ # Converts hash and nil to an options object
1031
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1032
+
1033
+ # Customize the options with defaults
1034
+ call_metadata = @config.rpcs.update_customer.metadata.to_h
1035
+
1036
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1037
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1038
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1039
+ gapic_version: ::Google::Cloud::CloudControlsPartner::V1beta::VERSION,
1040
+ transports_version_send: [:rest]
1041
+
1042
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1043
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1044
+
1045
+ options.apply_defaults timeout: @config.rpcs.update_customer.timeout,
1046
+ metadata: call_metadata,
1047
+ retry_policy: @config.rpcs.update_customer.retry_policy
1048
+
1049
+ options.apply_defaults timeout: @config.timeout,
1050
+ metadata: @config.metadata,
1051
+ retry_policy: @config.retry_policy
1052
+
1053
+ @cloud_controls_partner_core_stub.update_customer request, options do |result, operation|
1054
+ yield result, operation if block_given?
1055
+ end
1056
+ rescue ::Gapic::Rest::Error => e
1057
+ raise ::Google::Cloud::Error.from_error(e)
1058
+ end
1059
+
1060
+ ##
1061
+ # Delete details of a single customer
1062
+ #
1063
+ # @overload delete_customer(request, options = nil)
1064
+ # Pass arguments to `delete_customer` via a request object, either of type
1065
+ # {::Google::Cloud::CloudControlsPartner::V1beta::DeleteCustomerRequest} or an equivalent Hash.
1066
+ #
1067
+ # @param request [::Google::Cloud::CloudControlsPartner::V1beta::DeleteCustomerRequest, ::Hash]
1068
+ # A request object representing the call parameters. Required. To specify no
1069
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1070
+ # @param options [::Gapic::CallOptions, ::Hash]
1071
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1072
+ #
1073
+ # @overload delete_customer(name: nil)
1074
+ # Pass arguments to `delete_customer` via keyword arguments. Note that at
1075
+ # least one keyword argument is required. To specify no parameters, or to keep all
1076
+ # the default parameter values, pass an empty Hash as a request object (see above).
1077
+ #
1078
+ # @param name [::String]
1079
+ # Required. name of the resource to be deleted
1080
+ # format: name=organizations/*/locations/*/customers/*
1081
+ # @yield [result, operation] Access the result along with the TransportOperation object
1082
+ # @yieldparam result [::Google::Protobuf::Empty]
1083
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1084
+ #
1085
+ # @return [::Google::Protobuf::Empty]
1086
+ #
1087
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1088
+ #
1089
+ # @example Basic example
1090
+ # require "google/cloud/cloud_controls_partner/v1beta"
1091
+ #
1092
+ # # Create a client object. The client can be reused for multiple calls.
1093
+ # client = Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerCore::Rest::Client.new
1094
+ #
1095
+ # # Create a request. To set request fields, pass in keyword arguments.
1096
+ # request = Google::Cloud::CloudControlsPartner::V1beta::DeleteCustomerRequest.new
1097
+ #
1098
+ # # Call the delete_customer method.
1099
+ # result = client.delete_customer request
1100
+ #
1101
+ # # The returned object is of type Google::Protobuf::Empty.
1102
+ # p result
1103
+ #
1104
+ def delete_customer request, options = nil
1105
+ raise ::ArgumentError, "request must be provided" if request.nil?
1106
+
1107
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1beta::DeleteCustomerRequest
1108
+
1109
+ # Converts hash and nil to an options object
1110
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1111
+
1112
+ # Customize the options with defaults
1113
+ call_metadata = @config.rpcs.delete_customer.metadata.to_h
1114
+
1115
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1116
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1117
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1118
+ gapic_version: ::Google::Cloud::CloudControlsPartner::V1beta::VERSION,
1119
+ transports_version_send: [:rest]
1120
+
1121
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1122
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1123
+
1124
+ options.apply_defaults timeout: @config.rpcs.delete_customer.timeout,
1125
+ metadata: call_metadata,
1126
+ retry_policy: @config.rpcs.delete_customer.retry_policy
1127
+
1128
+ options.apply_defaults timeout: @config.timeout,
1129
+ metadata: @config.metadata,
1130
+ retry_policy: @config.retry_policy
1131
+
1132
+ @cloud_controls_partner_core_stub.delete_customer request, options do |result, operation|
1133
+ yield result, operation if block_given?
876
1134
  end
877
1135
  rescue ::Gapic::Rest::Error => e
878
1136
  raise ::Google::Cloud::Error.from_error(e)
@@ -920,6 +1178,13 @@ module Google
920
1178
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
921
1179
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
922
1180
  # * (`nil`) indicating no credentials
1181
+ #
1182
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1183
+ # external source for authentication to Google Cloud, you must validate it before
1184
+ # providing it to a Google API client library. Providing an unvalidated credential
1185
+ # configuration to Google APIs can compromise the security of your systems and data.
1186
+ # For more information, refer to [Validate credential configurations from external
1187
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
923
1188
  # @return [::Object]
924
1189
  # @!attribute [rw] scope
925
1190
  # The OAuth scopes
@@ -952,6 +1217,11 @@ module Google
952
1217
  # default endpoint URL. The default value of nil uses the environment
953
1218
  # universe (usually the default "googleapis.com" universe).
954
1219
  # @return [::String,nil]
1220
+ # @!attribute [rw] logger
1221
+ # A custom logger to use for request/response debug logging, or the value
1222
+ # `:default` (the default) to construct a default logger, or `nil` to
1223
+ # explicitly disable logging.
1224
+ # @return [::Logger,:default,nil]
955
1225
  #
956
1226
  class Configuration
957
1227
  extend ::Gapic::Config
@@ -973,6 +1243,7 @@ module Google
973
1243
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
974
1244
  config_attr :quota_project, nil, ::String, nil
975
1245
  config_attr :universe_domain, nil, ::String, nil
1246
+ config_attr :logger, :default, ::Logger, nil, :default
976
1247
 
977
1248
  # @private
978
1249
  def initialize parent_config = nil
@@ -1051,6 +1322,21 @@ module Google
1051
1322
  # @return [::Gapic::Config::Method]
1052
1323
  #
1053
1324
  attr_reader :get_partner
1325
+ ##
1326
+ # RPC-specific configuration for `create_customer`
1327
+ # @return [::Gapic::Config::Method]
1328
+ #
1329
+ attr_reader :create_customer
1330
+ ##
1331
+ # RPC-specific configuration for `update_customer`
1332
+ # @return [::Gapic::Config::Method]
1333
+ #
1334
+ attr_reader :update_customer
1335
+ ##
1336
+ # RPC-specific configuration for `delete_customer`
1337
+ # @return [::Gapic::Config::Method]
1338
+ #
1339
+ attr_reader :delete_customer
1054
1340
 
1055
1341
  # @private
1056
1342
  def initialize parent_rpcs = nil
@@ -1070,6 +1356,12 @@ module Google
1070
1356
  @list_access_approval_requests = ::Gapic::Config::Method.new list_access_approval_requests_config
1071
1357
  get_partner_config = parent_rpcs.get_partner if parent_rpcs.respond_to? :get_partner
1072
1358
  @get_partner = ::Gapic::Config::Method.new get_partner_config
1359
+ create_customer_config = parent_rpcs.create_customer if parent_rpcs.respond_to? :create_customer
1360
+ @create_customer = ::Gapic::Config::Method.new create_customer_config
1361
+ update_customer_config = parent_rpcs.update_customer if parent_rpcs.respond_to? :update_customer
1362
+ @update_customer = ::Gapic::Config::Method.new update_customer_config
1363
+ delete_customer_config = parent_rpcs.delete_customer if parent_rpcs.respond_to? :delete_customer
1364
+ @delete_customer = ::Gapic::Config::Method.new delete_customer_config
1073
1365
 
1074
1366
  yield self if block_given?
1075
1367
  end