| 1 | package Google::Cloud::Dataplex::V1::DataProductServiceClient; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 0 | ▶ | use Google::gRPC::Client; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 7 | use Google::Cloud::REST::Client; | ||
| 8 | use Google::Auth; | ||
| 9 | use Carp qw(croak); | ||
| 10 | |||
| 11 | use Protobuf; | ||
| 12 | use Google::Api::Common; | ||
| 13 | use Google::Cloud::Dataplex::V1::Metadata; | ||
| 14 | use Google::Cloud::Dataplex::V1::Resources; | ||
| 15 | use Google::Cloud::Dataplex::V1::DataDiscovery; | ||
| 16 | use Google::Cloud::Dataplex::V1::Security; | ||
| 17 | use Google::Cloud::Dataplex::V1::DataQualityRuleTemplate; | ||
| 18 | use Google::Cloud::Dataplex::V1::DatascansCommon; | ||
| 19 | use Google::Cloud::Dataplex::V1::Content; | ||
| 20 | use Google::Cloud::Dataplex::V1::DataDocumentation; | ||
| 21 | use Google::Cloud::Dataplex::V1::Processing; | ||
| 22 | use Google::Cloud::Dataplex::V1::Analyze; | ||
| 23 | use Google::Cloud::Dataplex::V1::Tasks; | ||
| 24 | use Google::Cloud::Dataplex::V1::Logs; | ||
| 25 | use Google::Cloud::Dataplex::V1::DataProfile; | ||
| 26 | use Google::Cloud::Dataplex::V1::DataQuality; | ||
| 27 | use Google::Cloud::Dataplex::V1::Service; | ||
| 28 | use Google::Cloud::Dataplex::V1::Datascans; | ||
| 29 | use Google::Cloud::Dataplex::V1::DataTaxonomy; | ||
| 30 | use Google::Cloud::Dataplex::V1::Cmek; | ||
| 31 | use Google::Cloud::Dataplex::V1::BusinessGlossary; | ||
| 32 | use Google::Cloud::Dataplex::V1::Catalog; | ||
| 33 | use Google::Cloud::Dataplex::V1::ApprovalWorkflow; | ||
| 34 | use Google::Cloud::Dataplex::V1::DataProducts; | ||
| 35 | |||
| 36 | our $VERSION = '0.02'; | ||
| 37 | |||
| 38 | has credentials => ( is => 'ro', required => 0 ); | ||
| 39 | has transport => ( is => 'rw' ); | ||
| 40 | |||
| 41 | sub BUILD { | ||
| 42 | my ($self) = @_; | ||
| 43 | |||
| 44 | # Resolve credentials: use passed credentials object if it implements get_token, or default to ADC | ||
| 45 | my $auth = $self->credentials; | ||
| 46 | if (!$auth || !eval { $auth->can('get_token') }) { | ||
| 47 | $auth = Google::Auth->default(); | ||
| 48 | } | ||
| 49 | my $token = $auth->get_token(); | ||
| 50 | |||
| 51 | my $target = 'localhost:50051'; | ||
| 52 | my $t = $self->transport || 'grpc'; | ||
| 53 | |||
| 54 | if (ref($t) && eval { $t->can('call') }) { | ||
| 55 | # Already a transport object | ||
| 56 | } elsif (lc($t) eq 'rest') { | ||
| 57 | my $client = Google::Cloud::REST::Client->new( | ||
| 58 | target => $target, | ||
| 59 | auth_token => $token, | ||
| 60 | ); | ||
| 61 | $self->transport($client); | ||
| 62 | } else { | ||
| 63 | # Default high-performance HTTP/2 gRPC client | ||
| 64 | my $client = Google::gRPC::Client->new( | ||
| 65 | target => $target, | ||
| 66 | auth_token => $token, | ||
| 67 | ); | ||
| 68 | $self->transport($client); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | sub create_data_product { | ||
| 73 | my ($self, %params) = @_; | ||
| 74 | |||
| 75 | my $request_class = 'Google::Cloud::Dataplex::V1::DataProducts::CreateDataProductRequest'; | ||
| 76 | my $request = eval { $request_class->new(\%params) } || eval { $request_class->new(%params) } || ($request_class->can('encode') ? $request_class->encode(\%params) : \%params); | ||
| 77 | |||
| 78 | my $response_class = 'Google::Longrunning::Operations::Operation'; | ||
| 79 | my $response = $self->transport->call({ | ||
| 80 | service => 'google.cloud.dataplex.v1.DataProductService', | ||
| 81 | method => 'CreateDataProduct', | ||
| 82 | request => $request, | ||
| 83 | response_class => $response_class, | ||
| 84 | }); | ||
| 85 | |||
| 86 | return $response; | ||
| 87 | } | ||
| 88 | 1; # End of Google::Cloud::Dataplex::V1::DataProductServiceClient | ||
| 89 | |||
| 90 | __END__ | ||