| 1 | package Google::Cloud::Securitycenter::V2; | ||
| 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::Securitycenter::V2::Chokepoint; | ||
| 14 | use Google::Cloud::Securitycenter::V2::Network; | ||
| 15 | use Google::Cloud::Securitycenter::V2::AgentSession; | ||
| 16 | use Google::Cloud::Securitycenter::V2::Agent; | ||
| 17 | use Google::Cloud::Securitycenter::V2::AiModel; | ||
| 18 | use Google::Cloud::Securitycenter::V2::AffectedResources; | ||
| 19 | use Google::Cloud::Securitycenter::V2::LoadBalancer; | ||
| 20 | use Google::Cloud::Securitycenter::V2::Compliance; | ||
| 21 | use Google::Cloud::Securitycenter::V2::ToxicCombination; | ||
| 22 | use Google::Cloud::Securitycenter::V2::SecurityPosture; | ||
| 23 | use Google::Cloud::Securitycenter::V2::Indicator; | ||
| 24 | use Google::Cloud::Securitycenter::V2::GroupMembership; | ||
| 25 | use Google::Cloud::Securitycenter::V2::Connection; | ||
| 26 | use Google::Cloud::Securitycenter::V2::MitreAttack; | ||
| 27 | use Google::Cloud::Securitycenter::V2::VertexAi; | ||
| 28 | use Google::Cloud::Securitycenter::V2::Folder; | ||
| 29 | use Google::Cloud::Securitycenter::V2::IamBinding; | ||
| 30 | use Google::Cloud::Securitycenter::V2::Exfiltration; | ||
| 31 | use Google::Cloud::Securitycenter::V2::AgentAnomaly; | ||
| 32 | use Google::Cloud::Securitycenter::V2::Access; | ||
| 33 | use Google::Cloud::Securitycenter::V2::Database; | ||
| 34 | use Google::Cloud::Securitycenter::V2::Application; | ||
| 35 | use Google::Cloud::Securitycenter::V2::File; | ||
| 36 | use Google::Cloud::Securitycenter::V2::KernelRootkit; | ||
| 37 | use Google::Cloud::Securitycenter::V2::Disk; | ||
| 38 | use Google::Cloud::Securitycenter::V2::ContactDetails; | ||
| 39 | use Google::Cloud::Securitycenter::V2::Label; | ||
| 40 | use Google::Cloud::Securitycenter::V2::IpRules; | ||
| 41 | use Google::Cloud::Securitycenter::V2::Job; | ||
| 42 | use Google::Cloud::Securitycenter::V2::DataAccessEvent; | ||
| 43 | use Google::Cloud::Securitycenter::V2::LogEntry; | ||
| 44 | use Google::Cloud::Securitycenter::V2::Notebook; | ||
| 45 | use Google::Cloud::Securitycenter::V2::Vulnerability; | ||
| 46 | use Google::Cloud::Securitycenter::V2::BackupDisasterRecovery; | ||
| 47 | use Google::Cloud::Securitycenter::V2::DataFlowEvent; | ||
| 48 | use Google::Cloud::Securitycenter::V2::AttackExposure; | ||
| 49 | use Google::Cloud::Securitycenter::V2::SecurityMarks; | ||
| 50 | use Google::Cloud::Securitycenter::V2::NotificationConfig; | ||
| 51 | use Google::Cloud::Securitycenter::V2::Resource; | ||
| 52 | use Google::Cloud::Securitycenter::V2::ValuedResource; | ||
| 53 | use Google::Cloud::Securitycenter::V2::MuteConfig; | ||
| 54 | use Google::Cloud::Securitycenter::V2::CloudDlpInspection; | ||
| 55 | use Google::Cloud::Securitycenter::V2::BigqueryExport; | ||
| 56 | use Google::Cloud::Securitycenter::V2::OrgPolicy; | ||
| 57 | use Google::Cloud::Securitycenter::V2::CloudDlpDataProfile; | ||
| 58 | use Google::Cloud::Securitycenter::V2::Source; | ||
| 59 | use Google::Cloud::Securitycenter::V2::ExternalSystem; | ||
| 60 | use Google::Cloud::Securitycenter::V2::AttackPath; | ||
| 61 | use Google::Cloud::Securitycenter::V2::Process; | ||
| 62 | use Google::Cloud::Securitycenter::V2::CloudArmor; | ||
| 63 | use Google::Cloud::Securitycenter::V2::DataRetentionDeletionEvent; | ||
| 64 | use Google::Cloud::Securitycenter::V2::Container; | ||
| 65 | use Google::Cloud::Securitycenter::V2::ResourceValueConfig; | ||
| 66 | use Google::Cloud::Securitycenter::V2::Simulation; | ||
| 67 | use Google::Cloud::Securitycenter::V2::Kubernetes; | ||
| 68 | use Google::Cloud::Securitycenter::V2::Finding; | ||
| 69 | use Google::Cloud::Securitycenter::V2::SecuritycenterService; | ||
| 70 | use Google::Cloud::Securitycenter::V2::NotificationMessage; | ||
| 71 | |||
| 72 | our $VERSION = '0.06'; | ||
| 73 | |||
| 74 | has credentials => ( is => 'ro', required => 0 ); | ||
| 75 | has transport => ( is => 'rw' ); | ||
| 76 | |||
| 77 | sub BUILD { | ||
| 78 | my ($self) = @_; | ||
| 79 | |||
| 80 | my $auth = $self->credentials; | ||
| 81 | if (!defined $auth) { | ||
| 82 | $auth = Google::Auth->default(); | ||
| 83 | } elsif (!eval { $auth->can('get_token') }) { | ||
| 84 | croak 'Invalid credentials object: must implement get_token()'; | ||
| 85 | } | ||
| 86 | my $token = $auth->get_token(); | ||
| 87 | |||
| 88 | my $target = 'securitycenter.googleapis.com:443'; | ||
| 89 | my $t = $self->transport || 'grpc'; | ||
| 90 | |||
| 91 | if (ref($t) && eval { $t->can('call') }) { | ||
| 92 | # Already a transport object | ||
| 93 | } elsif (lc($t) eq 'rest') { | ||
| 94 | my $client = Google::Cloud::REST::Client->new( | ||
| 95 | target => $target, | ||
| 96 | auth_token => $token, | ||
| 97 | ); | ||
| 98 | $self->transport($client); | ||
| 99 | } else { | ||
| 100 | my $client = Google::gRPC::Client->new( | ||
| 101 | target => $target, | ||
| 102 | auth_token => $token, | ||
| 103 | ); | ||
| 104 | $self->transport($client); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | sub batch_create_resource_value_configs { | ||
| 109 | my ($self, %params) = @_; | ||
| 110 | |||
| 111 | my $request_class = 'Google::Cloud::Securitycenter::V2::SecuritycenterService::BatchCreateResourceValueConfigsRequest'; | ||
| 112 | my $request = eval { $request_class->new(\%params) }; | ||
| 113 | my $new_err = $@; | ||
| 114 | if (!$request) { | ||
| 115 | $request = eval { $request_class->new(%params) }; | ||
| 116 | $new_err ||= $@; | ||
| 117 | } | ||
| 118 | if (!$request) { | ||
| 119 | croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error'); | ||
| 120 | } | ||
| 121 | |||
| 122 | my $response_class = 'Google::Cloud::Securitycenter::V2::SecuritycenterService::BatchCreateResourceValueConfigsResponse'; | ||
| 123 | if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) { | ||
| 124 | return $self->transport->call({ | ||
| 125 | http_method => 'POST', | ||
| 126 | path => '/google.cloud.securitycenter.v2.SecurityCenter/BatchCreateResourceValueConfigs', | ||
| 127 | request => $request, | ||
| 128 | response_class => $response_class, | ||
| 129 | }); | ||
| 130 | } | ||
| 131 | |||
| 132 | my $response = $self->transport->call({ | ||
| 133 | service => 'google.cloud.securitycenter.v2.SecurityCenter', | ||
| 134 | method => 'BatchCreateResourceValueConfigs', | ||
| 135 | request => $request, | ||
| 136 | response_class => $response_class, | ||
| 137 | }); | ||
| 138 | |||
| 139 | return $response; | ||
| 140 | } | ||
| 141 | |||
| 142 | sub create_notification_config { | ||
| 143 | my ($self, %params) = @_; | ||
| 144 | |||
| 145 | my $request_class = 'Google::Cloud::Securitycenter::V2::SecuritycenterService::CreateNotificationConfigRequest'; | ||
| 146 | my $request = eval { $request_class->new(\%params) }; | ||
| 147 | my $new_err = $@; | ||
| 148 | if (!$request) { | ||
| 149 | $request = eval { $request_class->new(%params) }; | ||
| 150 | $new_err ||= $@; | ||
| 151 | } | ||
| 152 | if (!$request) { | ||
| 153 | croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error'); | ||
| 154 | } | ||
| 155 | |||
| 156 | my $response_class = 'Google::Cloud::Securitycenter::V2::NotificationConfig::NotificationConfig'; | ||
| 157 | if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) { | ||
| 158 | return $self->transport->call({ | ||
| 159 | http_method => 'POST', | ||
| 160 | path => '/google.cloud.securitycenter.v2.SecurityCenter/CreateNotificationConfig', | ||
| 161 | request => $request, | ||
| 162 | response_class => $response_class, | ||
| 163 | }); | ||
| 164 | } | ||
| 165 | |||
| 166 | my $response = $self->transport->call({ | ||
| 167 | service => 'google.cloud.securitycenter.v2.SecurityCenter', | ||
| 168 | method => 'CreateNotificationConfig', | ||
| 169 | request => $request, | ||
| 170 | response_class => $response_class, | ||
| 171 | }); | ||
| 172 | |||
| 173 | return $response; | ||
| 174 | } | ||
| 175 | |||
| 176 | sub list_notification_configs { | ||
| 177 | my ($self, %params) = @_; | ||
| 178 | |||
| 179 | my $request_class = 'Google::Cloud::Securitycenter::V2::SecuritycenterService::ListNotificationConfigsRequest'; | ||
| 180 | my $request = eval { $request_class->new(\%params) }; | ||
| 181 | my $new_err = $@; | ||
| 182 | if (!$request) { | ||
| 183 | $request = eval { $request_class->new(%params) }; | ||
| 184 | $new_err ||= $@; | ||
| 185 | } | ||
| 186 | if (!$request) { | ||
| 187 | croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error'); | ||
| 188 | } | ||
| 189 | |||
| 190 | my $response_class = 'Google::Cloud::Securitycenter::V2::SecuritycenterService::ListNotificationConfigsResponse'; | ||
| 191 | if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) { | ||
| 192 | return $self->transport->call({ | ||
| 193 | http_method => 'POST', | ||
| 194 | path => '/google.cloud.securitycenter.v2.SecurityCenter/ListNotificationConfigs', | ||
| 195 | request => $request, | ||
| 196 | response_class => $response_class, | ||
| 197 | }); | ||
| 198 | } | ||
| 199 | |||
| 200 | my $response = $self->transport->call({ | ||
| 201 | service => 'google.cloud.securitycenter.v2.SecurityCenter', | ||
| 202 | method => 'ListNotificationConfigs', | ||
| 203 | request => $request, | ||
| 204 | response_class => $response_class, | ||
| 205 | }); | ||
| 206 | |||
| 207 | return $response; | ||
| 208 | } | ||
| 209 | |||
| 210 | sub update_source { | ||
| 211 | my ($self, %params) = @_; | ||
| 212 | |||
| 213 | my $request_class = 'Google::Cloud::Securitycenter::V2::SecuritycenterService::UpdateSourceRequest'; | ||
| 214 | my $request = eval { $request_class->new(\%params) }; | ||
| 215 | my $new_err = $@; | ||
| 216 | if (!$request) { | ||
| 217 | $request = eval { $request_class->new(%params) }; | ||
| 218 | $new_err ||= $@; | ||
| 219 | } | ||
| 220 | if (!$request) { | ||
| 221 | croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error'); | ||
| 222 | } | ||
| 223 | |||
| 224 | my $response_class = 'Google::Cloud::Securitycenter::V2::Source::Source'; | ||
| 225 | if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) { | ||
| 226 | return $self->transport->call({ | ||
| 227 | http_method => 'POST', | ||
| 228 | path => '/google.cloud.securitycenter.v2.SecurityCenter/UpdateSource', | ||
| 229 | request => $request, | ||
| 230 | response_class => $response_class, | ||
| 231 | }); | ||
| 232 | } | ||
| 233 | |||
| 234 | my $response = $self->transport->call({ | ||
| 235 | service => 'google.cloud.securitycenter.v2.SecurityCenter', | ||
| 236 | method => 'UpdateSource', | ||
| 237 | request => $request, | ||
| 238 | response_class => $response_class, | ||
| 239 | }); | ||
| 240 | |||
| 241 | return $response; | ||
| 242 | } | ||
| 243 | 1; # End of Google::Cloud::Securitycenter::V2 | ||
| 244 | |||
| 245 | __END__ | ||